Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Does this work or do I have to use dynamic sql?

Does this work or do I have to use dynamic sql?

From: Marc Eggenberger <nw1_at_devnull.ch>
Date: Wed, 30 Jul 2003 20:45:29 +0200
Message-ID: <MPG.199230b0ae3ec384989690@news.cis.dfn.de>


Hi there.

Should this work:

DECLARE

	   CURSOR metadir_cur IS
	   		  SELECT sobjUniqueKey, sPersonalNumber, sLastName, 
sFirstName, sNetzwerkLogin, sDepartment, sKST, sOfficePhoneNumber
			  		 FROM metadir_import.tblPersonalData;

BEGIN
	 FOR metaupdate_rec IN metadir_cur
	 LOOP
	 	 UPDATE ud SET NAME = SUBSTR(metaupdate_rec.sLastName,1,25) 
, Vorname = SUBSTR(metaupdate_rec.sFirstName,1,25) , Bereich = metaupdate_rec.sDepartment, Stammnr = metaupdate_rec.sPersonalNumber, Tel_Int = SUBSTR(metaupdate_rec.sOfficePhoneNumber,1,15) , Kostenstl = SUBSTR(metaupdate_rec.sKST,1,10), Unique_ID = metaupdate_rec.sobjUniqueKey
		 WHERE Username = metaupdate_rec.sNetzwerklogin;
	 END LOOP;
	 COMMIT;

END;   It runs without errors but it seems that it doesn't actually update my table ud.

It runs on Oracle 8.1.7.0.0.

Havent done much coding in Oracle yet.
In T-SQL I would put the Update statement in a varchar first and then exec it. Do I have to something similar in Oracle too?

Thanks for any hints.

-- 
mfg
Marc Eggenberger
Received on Wed Jul 30 2003 - 13:45:29 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US