What will be the SQLCODE for below select query?

All sort of Mainframes Interview Questions.
Post Reply
Nitin Jain
Registered Member
Posts: 20
Joined: Tue Aug 20, 2013 11:33 am

What will be the SQLCODE for below select query?

Post by Nitin Jain »

Hi,

I was asked this question in an Interview:

What will be the SQLCODE for below select query

Code: Select all

SELECT COUNT(*) FROM EMP WHERE EMPNO=1234
and suppose row with employee number 1234 is not present in table.

Thanks,
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: What will be the SQLCODE for below select query?

Post by Anuj Dhawan »

Hello,

If you run the query in COBOL as an embedded SQL -- you'll get SQLCODE as 0, when row EMPNO=1234 is not present in the table. OTOH, if you remove COUNT then you'll get the SQLCODE as +100.

Hope this helps.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Nitin Jain
Registered Member
Posts: 20
Joined: Tue Aug 20, 2013 11:33 am

Re: What will be the SQLCODE for below select query?

Post by Nitin Jain »

Thank you Anuj! :)
User avatar
Anuj Dhawan
Founder
Posts: 2801
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: What will be the SQLCODE for below select query?

Post by Anuj Dhawan »

You're welcome and Good Luck! :)
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”