Why i am getting below error while running this query in eclipse?
java.sql.SQLException: ORA-00933: SQL command not properly ended
Code:
String policy = "select p.policy_id,i.insurance_type,c.reason,i.insured_amount,i.max_claim_amount,c.claim_status from claim as c join policy as p on c.policy_id=p.policy_id join insurance as i on p.insurance_id=i.insurance_id where c.user_id=?";
PreparedStatement policyst = con.prepareStatement(policy);
policyst.setString(1, userId);
ResultSet policyrs = policyst.executeQuery();
BalusC
1.1m377 gold badges3.7k silver badges3.6k bronze badges
2 Answers 2
Oracle does not support as for table aliasing; you should remove them:
SELECT p.policy_id,
i.insurance_type,
c.reason,
i.insured_amount,
i.max_claim_amount,
c.claim_status
FROM claim c
JOIN policy p ON c.policy_id = p.policy_id
JOIN insurance i ON p.insurance_id = i.insurance_id
WHERE c.user_id = ?
answered May 18, 2016 at 7:22
Aleksej
23.1k6 gold badges39 silver badges41 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
Remove word "AS" from your statement
answered May 18, 2016 at 7:22
Petr Pribyl
3,6151 gold badge23 silver badges22 bronze badges
Comments
lang-java