Re: PARAMETER SUBSTITUION ON UPDATE STATEMENT
What is the relationship between table1 and table2? Igor Neyman, OCP DBA [EMAIL PROTECTED] - Original Message - To: "Multiple recipients of list ORACLE-L" <[EMAIL PROTECTED]> Sent: Friday, April 05, 2002 6:23 AM > You can use DBMS_SQL if it will help you. > > -Original Message- > Moya > Sent: 05 April 2002 15:28 > To: Multiple recipients of list ORACLE-L > > > Hi all, > > DECLARE >mfield varchar2(20); >CURSOR t1 Select region, value from table2; > > BEGIN > FOR t1rec IN t1 LOOP >mfield := t1rec.region||'_00'; >UPDATE table1 >SET mfield = mfield + 1; > END LOOP; > END; > > Basically, I would want to update field1 in table1 based on the value of > region from table2. If region = ABC, I want to concatenate region and _00 to > determine field to update in table1. > > Structure of Table1 > REG_00 > ABC_00 > DES_00 > > Is this possible? > > Moses > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: Moses Ngati Moya > INET: [EMAIL PROTECTED] > > Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California-- Public Internet access / Mailing Lists > > To REMOVE yourself from this mailing list, send an E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). > -- > Please see the official ORACLE-L FAQ: http://www.orafaq.com > -- > Author: Alroy Mascranghe > INET: [EMAIL PROTECTED] > > Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 > San Diego, California-- Public Internet access / Mailing Lists > > To REMOVE yourself from this mailing list, send an E-Mail message > to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in > the message BODY, include a line containing: UNSUB ORACLE-L > (or the name of mailing list you want to be removed from). You may > also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Igor Neyman INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
RE: PARAMETER SUBSTITUION ON UPDATE STATEMENT
You can use DBMS_SQL if it will help you. -Original Message- Moya Sent: 05 April 2002 15:28 To: Multiple recipients of list ORACLE-L Hi all, DECLARE mfield varchar2(20); CURSOR t1 Select region, value from table2; BEGIN FOR t1rec IN t1 LOOP mfield := t1rec.region||'_00'; UPDATE table1 SET mfield = mfield + 1; END LOOP; END; Basically, I would want to update field1 in table1 based on the value of region from table2. If region = ABC, I want to concatenate region and _00 to determine field to update in table1. Structure of Table1 REG_00 ABC_00 DES_00 Is this possible? Moses -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Moses Ngati Moya INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Alroy Mascranghe INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
PARAMETER SUBSTITUION ON UPDATE STATEMENT
Hi all, DECLARE mfield varchar2(20); CURSOR t1 Select region, value from table2; BEGIN FOR t1rec IN t1 LOOP mfield := t1rec.region||'_00'; UPDATE table1 SET mfield = mfield + 1; END LOOP; END; Basically, I would want to update field1 in table1 based on the value of region from table2. If region = ABC, I want to concatenate region and _00 to determine field to update in table1. Structure of Table1 REG_00 ABC_00 DES_00 Is this possible? Moses -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Moses Ngati Moya INET: [EMAIL PROTECTED] Fat City Network Services-- (858) 538-5051 FAX: (858) 538-5051 San Diego, California-- Public Internet access / Mailing Lists To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).