You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

SQLEXEC ?

4 replies [Last post]
Guest's picture
Guest

Can anybody help me understand the SQLExec () Function with an example ? Whay & where it's used ?

Ashar's picture
User offline. Last seen 5 years 1 week ago. Offline
Joined: 03/26/2008
Posts: 227
Re: SQLEXEC ?

SQLExec is used to execute SQL statement from PeopleCode.

Lepa's picture
User offline. Last seen 2 years 20 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: SQLEXEC ?

One thing to keep in mind is that SQLExec can only Select a single row of data. If your SQL statement (or your SQL.sqlname statement) retrieves more than one row of data, SQLExec sends only the first row to its output variables. Any subsequent rows are discarded.

And an example of an SQLExec would be:

SQLExec("Select sum(posted_total_amt) from PS_LEDGER where deptid = :1", DEPTID, &SUM);

you pass in deptid to replace the :1 and &SUM is where your SQL return value will get stored. Read more about SQLExec function in Peoplebooks. There are lots of info there.

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

simrose's picture
User offline. Last seen 6 years 32 weeks ago. Offline
Joined: 08/01/2008
Posts: 33
Re: SQLEXEC ?

SQLExec can only Select a single row of data but update/insert any number of rows.

Nitin's picture
User offline. Last seen 5 years 44 weeks ago. Offline
Joined: 06/30/2008
Posts: 73
Re: SQLEXEC ?

The main functionality /usage is when a user want to update thru SQL statements something which is not available in Buffer .

Thanks
Nitin