SQLs in SPUFI Vs Embedded SQLs



SQLs in SPUFI Vs Embedded SQLs

Postby Pebble » Mon Oct 26, 2009 12:17 pm

Hi,

Suppose that, I want list of customers, whose Birth Day is of today.

What would be the difference between the query (in the above mentioned scenario) writtten in SPUFI to that of embedded SQL ?

Pebble.
User avatar
Pebble
 
Posts: 8
Joined: Wed Aug 26, 2009 7:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: SQLs in SPUFI Vs Embedded SQLs

Postby swd » Mon Oct 26, 2009 10:13 pm

Pebble,
Using SPUFI, you have to add the DB2 QUALIFIER name before the tablename, so it knows which database table to point your SQL statement at. For instance if a Qualifier is called CUSTPLAN and your customer table was CUSTOMER, then you would specify this in the SPUFI.

SELECT * FROM CUSTPLAN.CUSTOMER WHERE BIRTH_DATE = CURRENT DATE;

In a COBOL program with embedded SQL, your SQL would only specify the table CUSTOMER

SELECT * FROM CUSTOMER WHERE BIRTH_DATE = CURRENT DATE;

This is because your program will have a runparm that points to a plan name, which defines what access path your program takes, and so points to the correct database that was specified at BIND time.

I hope this is enough info for you.
User avatar
swd
 
Posts: 109
Joined: Wed Feb 18, 2009 9:18 pm
Location: UK
Has thanked: 0 time
Been thanked: 0 time

Re: SQLs in SPUFI Vs Embedded SQLs

Postby Pebble » Tue Oct 27, 2009 4:25 pm

Thank you very much SWD.
Information is very useful.
User avatar
Pebble
 
Posts: 8
Joined: Wed Aug 26, 2009 7:55 am
Has thanked: 0 time
Been thanked: 0 time

Re: SQLs in SPUFI Vs Embedded SQLs

Postby swd » Tue Oct 27, 2009 5:38 pm

Thank you. I appriciate the response. So many people don't bother to reply to say whether or not a post was useful or not. It's good to know. This does help other people if they see a response was helpful.

Thanks
Steve.
User avatar
swd
 
Posts: 109
Joined: Wed Feb 18, 2009 9:18 pm
Location: UK
Has thanked: 0 time
Been thanked: 0 time


Return to Interview Questions