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 -> Re: Does this work or do I have to use dynamic sql?

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

From: Marc Eggenberger <marc.eggenberger_at_itc.alstom.com>
Date: Thu, 31 Jul 2003 10:14:32 +0200
Message-ID: <MPG.1992ee5272b98c789896be@iww.cacti.ch.alstom.com>


In article <1a75df45.0307302209.1a97498b_at_posting.google.com>, vslabs_at_onwe.co.za says...
> Marc Eggenberger <nw1_at_devnull.ch> wrote i
>
> > Should this work:
> <snipped>
>
> Yep. A Daniel said, there are no glaring errors.

In fact it works as it should. Shame on me. Because most of the data is the same (they dont change much in the metadir and they cant export only the changes) I did a manual change of a username and another field in another session ... BUT I did not commit it ... when I woke up this morning it just struke me and I know the error I made ..

> > It runs without errors but it seems that it doesn't actually update my
> > table ud.
>
> IMO that can only be because of the assumption that:
> ud.Username = metaupdate_rec.sNetzwerklogin
> (take a look at the WHERE clause of your update statement)
>
> Marc, are you sure that this assumption is correct? Are there not
> maybe an issue with case here?

Nope .. no case issue .. but stupidity on my side ;)

> How about doing a SELECT count(*) join between the ud table and meta
> table using the WHERE clause you specified in the UPDATE? That way you
> will see whether this assumption is correct or not.
>
> > Havent done much coding in Oracle yet.
>
> Even so, you seem to have grasp the basics better than many other 1st
> time posters here that run into PL/SQL issues. Don't tell me. You know
> how to RTFM. Good for you. And keep it up. :-)

Thanks a lot. Feeling better now ;)

> > 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?
>
> No. The only time you want to use dynamic SQL is when you are dealing
> tablenames as variables, or column names and criteria as variables.
> Dynamic SQL only parses at the time of execution.

Ah .. ok ..

thanks anyways to all the posters for their help.

-- 
mfg
Marc Eggenberger
Received on Thu Jul 31 2003 - 03:14:32 CDT

Original text of this message

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