Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Updating 2 Columns using Execute Immediate

Cloud Nines BlissJan 15 2011 — edited Jan 16 2011
This would be my first post after reading many articles in the internet, and it seems I haven't run into a page that would explain if it really is possible to update two columns using execute immediate... or i just didn't tried searching for more *scratch head.

Problem: I am running a PL/SQL block wherein a statement is set and when i use execute immediate 2 columns in the given table is then updated. Scenario below.

Code Sample:

L_statement := 'update table1 '||
'set col_1 = value '||','||
'set col_2 = value';

EXECUTE IMMEDIATE L_statement;

That's a chunk of code from my PL/SQL Block. Is there a way to update 2 columns using 1 statement? I tried using 2 statement and executed both at the same time, it worked just fine but still I wanted to make it compact.Last, I just wanted to minimize and simplify the code and it would look better and will give me the option expand the code.

Any help is appreciated.

Thanks!

Anthony
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 12 2011
Added on Jan 15 2011
7 comments
406 views