Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Why can't I use a INput parameter to make a update ?
> Imagine that profes is a parameter, then
>
>------------------------------------------
> UPDATE usuari u
> SET u.profes = profes
> WHERE u.nomrec = nomrec;
>------------------------------------------
> dosn't function, but
>
>------------------------------------------
> cadena char(30);
>
>begin
>
>cadena:=profes;
>
> UPDATE usuari u
> SET u.profes = cadena
> WHERE u.nomrec = nomrec;
>------------------------------------------
>
>works correctly !! Why ??
>
>
It doesn't work quite simply because profes is the name of your column and SQL is not going to look for any other meaning for it.
Good practice is to ALWAYS use p_XXXXXXX for parameter names, that way they are easily identifiable and you'll never fall into this trap.
UPDATE usuari u
SET u.profes = p_profes
WHERE u.nomrec = nomrec;
Would work just fine.
John
FOR UTILITY PARTNERS EMPLOYMENT
OPPORTUNITIES VISIT www.utilpart.com
e-mail: jomarlen_at_aol.com
Web Site: http://members.aol.com/jomarlen/
The views expressed in this message
are those of the author and not
necessarily those of U.P. Inc.
and/or its employees.
![]() |
![]() |