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.

Difference between do select and sql actions in application engine

3 replies [Last post]
Guest's picture
Guest

Its possible to write select ,insert,update ,delete statements in SQL action.
what is the need to use do select statement?

Sam's picture
Sam (not verified)
Re: Difference between do select and sql actions in appl engine

You can do a select in a SQL action, but you can only do something with the first row you are retrieving (by using %select to put them on the state record). It ignores all other rows (a bit like the SqlExec function in PeopleCode).

A do select allows you to also select a set of rows. You still put the values on the state record. But then App Engine will perform the other actions in the same step - per row found. It will loop as often as there are rows retrieved by your select statement.

So: selects are done with Do Select, data manipulation with the SQL action. Only if your select only retrieves one row you could use it in a SQL action.

Cheers,
Sam

Lepa's picture
User offline. Last seen 2 years 6 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: Difference between do select and sql actions

Sam is exactly right. Think about a Do Select in the same way you think about a for, end-for in PeopleCode :)

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

Nitin's picture
User offline. Last seen 5 years 30 weeks ago. Offline
Joined: 06/30/2008
Posts: 73
Re: Difference between do select and sql actions in application

You May also look at DO-UNTIL.

Thanks
Nitin