Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: help dynamically adding a 'datafile' to a script
I only partially understand what you are trying to do but the string
concatenation is wrong. You need two separate quoted strings:
SQL> select '&cPath'||' mytablespace.dbf'
2 from dual
3 /
Enter value for cpath: xxx
old 1: select '&cPath'||' mytablespace.dbf'
new 1: select 'xxx'||' mytablespace.dbf'
'XXX'||'MYTABLESPACE
I think what you really want to do is write a select to generate the create tablespace and spool that to a file where it can be called passing positional parameters
SQL> set define off SQL> SQL> select 'create tablespace &1 '|| 2 'datafile '||'&2'||'&1'||' size 5M;'3 from dual
'CREATETABLESPACE&1'||'DATAFILE'||'&2'||'&1
then you would issue start cretblspc mytablespace 'C:\\xxxxxxx\'. Some minor coding may be required along with a fair number of SQLPlus set statements: feedback, linesize, pagesize, etc...
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of ryan.gaffuri_at_cox.net
Sent: Friday, February 20, 2004 12:30 PM
To: oracle-l_at_freelists.org
Subject: help dynamically adding a 'datafile' to a script
I am trying to do the following and I cant get it to take(I would prefer not to use dynamic sql and write my create tablespace scripts to a second file).
Prompt Please enter a datafile path
Accept cPath
create tablespace myTablespace datafile '&cPath ||mytablespace.dbf' size 5m;
I've tried lots of methods including bind variables and appending before the create tablespace statement. Any way to do this?
FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlput 'unsubscribe' in the subject line.
-----------------------------------------------------------------
----------------------------------------------------------------
Please see the official ORACLE-L FAQ: http://www.orafaq.com
----------------------------------------------------------------
To unsubscribe send email to: oracle-l-request_at_freelists.org
![]() |
![]() |