oracle - Retrieving the first value of the column to a variable in pl sql -
i'll try clear possible.
i have these 3 tables customer
, link
& customer_link
.
i using following query retrieve customer_no
column customer
has values not available in customer_no
of table customer_link
:
select c.customer_no customer c left join customer_link cl on c.customer_no = cl.customer_no cl.customer_no null
the table customer_link
has following columns:
id (generated automatically using sequence) customer_no (linked customer table) link_no (linked link table) maker_id
what i'm trying is, use above query customer_no
customer
table not added table customer_link
yet (this constraint since customer_link
cannot have same customer_no
twice in table unique. same goes link_no
well) & similar query link_no
link
table.
then use link_no
& customer_no
respective results & add table customer_link
(there function need call values in result).
i need use loop here can update results after adding value each table table customer_link
not error trying add same customer_no
or link_no
twice table.
using cursor 1 way found on internet. it's not clear me.
so i'm trying here result unused customer_no customer
& link_no link
& insert values in row1 respective columns in table customer_link
& loop on update results & values in row1 again add them parameter function call
i think doesn't require loop follow step
1) insert customer_no not in customer_link #temp table
select c.customer_no #temp customer c left join customer_link cl on c.customer_no = cl.customer_no cl.customer_no null
2)insert customer_no customer_link
insert customer_link(customer_no) select customer_no #temp
Comments
Post a Comment