Page 1 of 1

SQLs in SPUFI Vs Embedded SQLs

PostPosted: Mon Oct 26, 2009 12:17 pm
by Pebble
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.

Re: SQLs in SPUFI Vs Embedded SQLs

PostPosted: Mon Oct 26, 2009 10:13 pm
by swd
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.

Re: SQLs in SPUFI Vs Embedded SQLs

PostPosted: Tue Oct 27, 2009 4:25 pm
by Pebble
Thank you very much SWD.
Information is very useful.

Re: SQLs in SPUFI Vs Embedded SQLs

PostPosted: Tue Oct 27, 2009 5:38 pm
by swd
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.