Question from Riico on Jan 17 at 4:45 PM Is there a way to write this query without having to hardcode the names? I would need to run a query to find which names, count them, create an update statement for each, etc. I would have many more than 3, this is just an example .... Is there logic that would allow me to do this dynamically? Thanks ... BEGIN FOR i IN REVERSE 1..3 LOOP UPDATE sysadm.PS_MY_TABLE SET MY_FIELD = (SELECT a.emplid FROM serv.path@databasedblink a WHERE a.username = 'name1' and rownum = 1) WHERE MY_FIELD ='name1'; UPDATE sysadm.PS_MY_TABLE SET MY_FIELD = (SELECT a.emplid FROM serv.path@databasedblink a WHERE a.username = 'name2' and rownum = 1) WHERE LSC_SAP_LOG_ADMN ='name2'; UPDATE sysadm.PS_MY_TABLE SET MY_FIELD = (SELECT a.emplid FROM serv.path@databasedblink a WHERE a.username = 'name3' and rownum = 1) WHERE MY_FIELD ='name3'; END LOOP; END; | Reply to this email to post your response. __.____._ | _.____.__ |
No comments:
Post a Comment