sqlca into

With into command you can define the target variables for sql command

 

the target-list is between "into" and "from" - all keywords in lowercase.

Correct:

select "ItemCode" into :ls_itemcode from ..

 

Wrong:

select "ItemCode" INTO :ls_itemcode from ..    // uppercase not allowed
select 'hello' into ls_itemcode                      // keyword "FROM" missing

 

use as separator a comma

select "ItemCode","ItemName" into ls_itemcode,ls_itemname from "OITM" where "ItemCode"=<itemcode,dbstring>

 

You can work in Powerbuilder-Syntax with ":" for the target

 

select "ItemCode","ItemName" into :ls_itemcode,:ls_itemname from ..

or without ":"

select "ItemCode","ItemName" into :ls_itemcode,:ls_itemname from ..

 

if you will format the result: Write the format after ":"

 

select sum("OnHand") into ls_onhand:#0 from "OITW" where itemcode=<ls_itemcode,dbstring>
select "ItemName" into ls_itemname:lower from "OITM" where itemcode=<ls_itemcode,dbstring>

 

you can use as target:

 

 

local variable

local string ls_itemname
select "ItemName" into ls_itemname from oitm where itemcode=<itemcode,dbstring>

Format: You can only use the Format after ":", if the source is type "string"

Example:

select sum("OnHand") into lc_stock:#0.00 from "OITW" where ...

is not working.

instance variable

instance string ls_itemname
select "ItemName" into ls_itemname from oitm where itemcode=<itemcode,dbstring>

Format: You can only use the Format, if the source is type "string". Siee local Variable

str_parm

select "ItemName" into str_parm.s_parm1 from oitm where itemcode=<itemcode,dbstring>

 

window variable

// without declare

select "ItemName" into ls_itemname from oitm where itemcode=<itemcode,dbstring>

column in dw_1

set in dw_1 the field "itemname"

select "ItemName" into dw_1.item.itemname from oitm where itemcode=<itemcode,dbstring>

 

example: select stock and set this in dw_2 column "currentstock"

select sum("OnHand") into dw_2.item.correntstock from "OITW" where "OITW"."ItemCode"='ls_itemcode,dbstring>

with format: ..into itemcode:lower from ...

Only in the current row in dw_1. if you want a other row, use ..into dw_1.itemcode:[ll_row] from ...

dw_1-Column


dw_x in row y

you can define the row in :row:format

if you've no format, set :row:

 

example: select stock and set this in dw_2 column "currentstock" in row

for ll_loop=to <dw_2.rowcount>
  select sum("OnHand") into dw_2.item.correntstock:[ll_loop]: from "OITW" where &      
     "ItemCode"=<dw_2.item.itemcode:[ll_loop].value,dbstring>
next

 

Short form:

You can write: .. into dw_2.item.onhand.value:[row]:format from..

without row and format: .. into dw_2.item.onhand.value from ..

without item and value-keyword: .. into dw_2.onhand from ..

without item and value-keyword, with row: .. into dw_2.onhand:[row]:format from ..

or only format: .. into dw_2.itemname:left 20 from ..

 

 

 

Priority:

select search for target-Variable in

1. datawindow (columname or dw_x)

2. str_parm

3. local-Variable

4. instance-Variable

5. window-variable