[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[no subject]



You can achieve this through sql

Begin-Select
$a
$b
$c

 Do Insert-Vendor-Addr

>From PS_ADDR_TABLE
where LOCTYPE in (10,20,35)
End-Select

Note: It would be best to define the "where" in the select as dynamic,
thereby ensuring that it can be re-used. See the SQR manual to find out more
about dynamic query variables.


Begin-Procedure Insert-Vendor-Addr
Begin-SQL
Insert into ps_vendor_addr (a,b,c)
values ($a,$b,$c)
End-SQL
End-Procedure


.

Hope this helps.


> ---Original Message-----
> From: Vikram Muratee [SMTP:vmuratee@ATT.NET]
> Sent: Wednesday, 14 April 1999 12:46 PM
> To:   Multiple recipients of list SQR-USERS
> Subject:
>
> hello all,
>
> I will greatly appreciate some views on my problem.
>
> I am on Oracle 7.3 and SQR 4.3 (and PS 7.5). I am trying
> to get the equivalen of a "FOR " Loop in SQR. (Which I
> understand is not available in SQR)
>
> I am attempting something like the pseudo code below.
> The objective is that I am picking up three rows for one
> VENDOR from a single source table and inserting three
> rows into one target table (PS_VENDOR_ADDR).
>
> I would greatly appreciate some direction on how to
> emulate the
> below pseudo code  in SQR :
>
> #INCR=0;
> #LOCTYPE1 =10;
> #LOCTYPE3 =20;
> #LOCTYPE2 = 35;
>
> FOR #INCR 1 TO 3 (EVALUATE #INCR
> WHEN =1
> select $a,$b,$c from ADDR_TABLE WHERE LOCTYPE =#LOCTYPE1;
> WHEN =2
> select $a,$b,$c from ADDR_TABLE WHERE LOCTYPE=#LOCTYPE2;
> WHEN =3
> select $a,$b,$c from ADDR_TABLE WHERE LOCTYPE=#LOCTYPE3;
> WHEN OTHER
> EXIT;
> INSERT $a,$b,$c INTO target_table !(as address
> seqno#INCR)
> #INCR+1  )
> !!The earlier you can help the better our whole team is
> doing 12-14 hrs a day to catch deadlines !!
>
> Thanks in advance,
>
> vikram