Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Variable in a select-script
wilhelm a écrit :
>
> Hallo friends
> i am a beginner in pl/sql.............
>
> how can i introduce a variable in a select-script ?
> for example:
>
> BEGIN
> DECLARE
> now_time varchar2(2);
> ColName varchar2(7);
>
> BEGIN
> now_time:=to_char(sysdate,'mi');
>
> IF now_time='01' THEN
> SpName:='wert_20';
>
> select datum, ???now_time??? from tabel1
Just write :
select datum, now_time from tabel1
You probably need an INTO clause to receive your datas ... ... but I can't see why you want to use the variable in the SELECT clause, it will always give you the same value !
> where datum = (select max(datum) from tabel1)
> END;
> END;
>
> Got questions? Get answers over the phone at Keen.com.
> Up to 100 minutes free!
> http://www.keen.com
-- Pierre CHARPENAYReceived on Wed Jun 28 2000 - 00:00:00 CDT