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

Home -> Community -> Usenet -> c.d.o.server -> Re: Pass a PL/SQL variable into SQL DEFINE

Re: Pass a PL/SQL variable into SQL DEFINE

From: Richard Kuhler <noone_at_nowhere.com>
Date: Wed, 01 May 2002 00:52:25 GMT
Message-ID: <d%Gz8.74956$zN.39160305@twister.socal.rr.com>


column weekday new_value weekday_subvar; select weekday from dual;
define dir = 'h:\Backup\&&weekday_subvar'; prompt &&dir

you could skip the function ...

column weekday new_value weekday_subvar; select to_char(sysdate, 'DY') weekday from dual; define dir = 'h:\Backup\&&weekday_subvar'; prompt &&dir

Richard

"Jeff Y. Y." wrote:
>
> I want to pass variable wkday from a PL/SQL function into a SQL
> variavle, but can not make it work. I need the result 'dir =
> h:\Backup\WED'. Do you know how to do it?
> Thanks a lot.
> -------------------------------------
> variable wkday varchar2(3)
> exec :wkday := weekday;
> print wkday
>
> define kk = :wkday
>
> define dir = 'h:\Backup\&kk'
> prompt &dir
>
> ---------------------------------
> The function is
> create or replace FUNCTION weekday return varchar2 IS
> wkday varchar2(3);
> BEGIN
> select to_char(sysdate, 'DY') into wkday from dual;
> return wkday;
> END;
Received on Tue Apr 30 2002 - 19:52:25 CDT

Original text of this message

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