0

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
asked May 18, 2016 at 7:17

2 Answers 2

3

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
Sign up to request clarification or add additional context in comments.

Comments

2

Remove word "AS" from your statement

answered May 18, 2016 at 7:22

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.