Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute dbms_output.put_line

Status
Not open for further replies.

Thiko

Programmer
Mar 9, 2001
49
GB
I would like to after running the below from a pl-sql block run the line that is produced...

Any ideas how to do this?

set serveroutput on
Server Output ON

declare
runexport VARCHAR2(200);
begin
SELECT 'host ''exp FILE=exp_'
||user||'_'||TO_CHAR(sysdate,'dd-mm-yyyy_HH24:MI:SS')||'_seq'
||ExportDumpID.NEXTVAL
||'.dmp OWNER=Y GRANTS=Y ROWS=Y COMPRESS=Y'''
INTO runexport
FROM dual;

dbms_output.put_line(runexport);
end;
/

Statement processed.

host 'exp FILE=exp_DBSERVICES_23-07-2001_12:03:41_seq69.dmp OWNER=Y GRANTS=Y ROWS=Y COMPRESS=Y' Many Thanks.

Thiko!
 
Try dynamic SQL (I don't know if it will be able to execute it, though):

Code:
EXECUTE IMMEDIATE runexport;
 
try these modifications to your script:



set serveroutput on
Server Output ON
set timing off
set time off

set term off
set feedback off
set heading off
set echo off
spool run_host.sql

SELECT 'host ''exp FILE=exp_'
||user||'_'||TO_CHAR(sysdate,'dd-mm-yyyy_HH24:MI:SS')||'_seq'
||ExportDumpID.NEXTVAL
||'.dmp OWNER=Y GRANTS=Y ROWS=Y COMPRESS=Y'''
FROM dual;

spool off

set term on
set feedback on
set heading on
set echo on

@run_host.sql

-- the spooled run_host.sql script should contain your result string :
host 'exp FILE=exp_DBSERVICES_23-07-2001_12:03:41_seq69.dmp
OWNER=Y GRANTS=Y ROWS=Y COMPRESS=Y'


Good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top