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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: syntax variable question

Re: syntax variable question

From: Maxim Demenko <mdemenko_at_gmail.com>
Date: Wed, 19 Apr 2006 09:28:49 +0200
Message-ID: <4445E6B1.1000706@google.com>


orcl schrieb:

> Hi, Im trying to get a variable passed , something is obviously wrong
> as every combination I've tried failed.
> Any suggestions for this simple syntax ?
>
> set serveroutput on
> DECLARE
> ranon varchar2(14);
> BEGIN
> select to_char(sysdate, 'YYYYMMDDHH24MISS')INTO ranon from dual;
> execute immediate 'ALTER DATABASE backup CONTROLFILE to trace as
> '||ranon||'ctl';
> -- DBMS_OUTPUT.PUT_LINE(ranon);
> END;
> /
>
> sorry I dont post much, I lurk ;-)
>
> thanks!
> bob
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

This should work
DECLARE
ranon varchar2(14);
BEGIN
select to_char(sysdate, 'YYYYMMDDHH24MISS')INTO ranon from dual; execute immediate 'ALTER DATABASE backup CONTROLFILE to trace as '''||ranon||'.ctl''';
-- DBMS_OUTPUT.PUT_LINE(ranon);
END;
/

Backup will be written not to the udump, but to $ORACLE_HOME/dbs

Best regards

Maxim

--
http://www.freelists.org/webpage/oracle-l
Received on Wed Apr 19 2006 - 02:28:49 CDT

Original text of this message

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