Use file as sql*plus input

Can I use a file as sql*plus input?
I have a query like below:
select * from employees
where deptno = &1
and job = &2
It will prompt me for the values of course.
I can execute it at the command line like below:
sql>@script.sql 10 salesrep
Is is possible to put the values in a file and call the script like below:
sql>@script.sql <filename>
Then this file could be in a directory in the OS and I can add any values to it.
thanks.

Hi,
The following script reads a 1-line file and puts its contents into the substitution variable &file_contents:
COLUMN     file_contents_col   NEW_VALUE  file_contents
SELECT     TRANSLATE ( '
@&1
            , 'A' || CHR (10) || CHR (13)
            , 'A'
            )     AS file_contents_col
FROM    dual;So, if my_params.txt contains
10    salesrepthen you can say:
@read_file  my_params.txt
@script.sql   &file_contentsYou can generalize this by putting the two lines above into a file called caswf.sql:
@read_file  &2
@&1  &file_contentsand call it like this
@caswf  script.sql  my_params.txt"Caswf" is a Welsh word that means "call any script with file".

Similar Messages

  • How can I spool file in SQL*Plus using sysdate as filename?

    Dear Oracle Experts,
    Would you help me to solve following problem?
    I want spool a file in SQL*Plus but using sysdate as filename.
    e.g. today is 30-Nov-1999
    then the filename is 19991130.lst
    tommorrow is 1-Dec-1999
    then the filename is 19991201.lst
    My e-mail address is [email protected]
    Thanks!!!
    Tony Sit
    null

    Tony Sit (guest) wrote:
    : Dear Oracle Experts,
    : Would you help me to solve following problem?
    : I want spool a file in SQL*Plus but using sysdate as filename.
    : e.g. today is 30-Nov-1999
    : then the filename is 19991130.lst
    : tommorrow is 1-Dec-1999
    : then the filename is 19991201.lst
    : My e-mail address is [email protected]
    : Thanks!!!
    : Tony Sit
    Tony, hi!
    Let you test this way:
    set ECHO OFF
    set TERMOUT OFF
    set FEEDBACK OFF
    set VERIFY OFF
    SET PAGESIZE 0
    SET LINESIZE 80
    SET HEADING OFF
    spool setout.sql
    SELECT 'SPOOL '

  • How to retreive this file in SQL*Plus

    If I upload files which name is KOREAN, name of files is invisible.
    I dont't know cause of this problem.
    How is keeping korean name of file from breaking?
    Also, answer how to retreive this file in SQL*Plus
    Thanks
    silverbell

    To access ifs data from SQL, you need to (officially) setup a 'user view'. Refer to the Java API documentation on how to do this. Once you have created the user view, then you may access this view using any SQL tool.

  • How to Generate Trace Files in SQL*Plus

    Hi Friends ,
    How to Generate Trace Files in SQL*Plus ?
    i have no idea
    thanks
    raj

    What trace files would you like to generate?
    Are we talking SQL trace files?
    ALTER SESSION SET sql_trace = TRUE;This will be generated in the user_dump_dest on the server.
    show parameter dump

  • Seek help to format spool file from SQL*PLUS

    I am running a Unix shell script to call a Oracle 11g SQL script from a Oracle database. In this SQL script, I need to connect to many different remote databases to select data, then sool these records as one big text file to a directory. Then email the file to related Group users. In the spool file, there is a line on the top of each page like this:
    DUMMY
    DB_NAME
    I know this is caused by connect to remote database in SQL*PLUS. My connection string is like this:
    Conn system/password@Oracle_SID
    How can I remove these lines or how to skip these lines into spool file? Please advise. Thanks in advnce. Wish all of you Happy New Year!!!

    Hi,
    It sounds like you have some kind of formatting (such as SQL*Plus TTITLE) producing the output you don't want. If that's the case, temporarily stopping the spooling might not help you. Find out what is causing the output that you don't want. You say that you know it is caused by the CONNECT statements, but it must be more than that. I've written scripts with CONNECT statements that don't have anything like what you reported at the top of each page; in fact, they don't even have pages: the output is one continuous stream. Find out what's putting the unwanted output there, and that will be a big clue as to how you can stop it.
    You say that you know the unwanted titles are there because of the CONNECT statements. If so, use database links instead of CONNECT. You don't have to use dbms_scheduler or utl_file; just eliminate the CONNECT statements. (I'm not saying that there's anything wrong with dbms_scheduler or utl_file; you should definitely investigate those tools. I'm just saying that using database links is independent of them.)
    What would happen if you did all your connecting to different databases at the OS level? Can you write a shell script that connects to each database in turn, and runs a SQL*Plus script in each one. Each SQL*Plus script would have a SPOOL or SPOOL ... APPEND command, or maybe you could build the SPOOL into a LOGIN.SQL script.

  • Using Internet enabled SQL*Plus

    I' d like to use this feature just as it is describe in the document from Luan Nim.
    I wrote a simple test_sql.sh that work very well under unix.
    # test utilisation sqlplus sous Web
    #! /usr/bin/sh
    # . $HOME/.profile
    echo Content-type: text/html
    # Mise en place des variables
    ORACLE_HOME=/oracle/u01/app/oracle/product/9i/
    export ORACLE_HOME
    ORACLE_SID=oracle_sid
    export ORACLE_SID
    #export TNS_ADMIN
    #NLS_LANG=FRENCH_FRANCE.WE8ISO8859P1
    #export NLS_LANG
    #echo $ORACLE_HOME
    #echo $ORACLE_SID
    # Execution de sqlplus
    #echo $ORACLE_HOME/sqlplus -M \"html on\" user/pwd@$ORACLE_SID @./test_sql.sql
    sqlplus -M "html on" -S user/pwd@$ORACLE_SID @./test_sql.sql
    When calling it from Web Browser (IE5) I get the following error :
    403 - Forbidden
    You don't have permission to access cgi-bin directory ?
    How can I do ?

    It looks like your web server is not configured to handle
    CGI scripts. Does your web server documentation give steps
    to configure CGI? Sometimes simple example CGI scripts
    are included. Once these are working, then we can help
    setting up a SQL*Plus CGI.
    If you are using Apache, check the httpd.conf file for the
    ExecCGI option. See if you can get the "printenv"
    demonstration CGI script working. Then move your SQL*Plus
    CGI shell script to the same directory, and try it there.
    Don't forget to echo a blank line after the "Content-type:
    text/html", else the CGI output will not be interpreted
    correctly.
    The SQL*Plus 9.2 UG&R has an example of a Perl CGI script
    for calling SQL*Plus:
    http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/server.920/a90842/ch8.htm#1005951
    The iSQL*Plus web-based interface does most of the things
    done by a CGI based call to command-line SQL*Plus. Its
    "Dynamic Reports" feature is very similar to getting a CGI
    script to return a report from a static .SQL file. If you
    (i) have Oracle 9.2 (or 9.0 on Windows) installed (ii) don't
    mind getting HTML pages back, then it may be a better
    alternative to CGI. (Note the SET MARKUP HTML PREFORMAT OFF
    command can be used to give traditional character aligned
    text, but there will still be HTML page headers and
    footers).
    -- CJ

  • SQL *Plus input buffer

    I have a large script that works fine on my oracle server. When I bring it to my clients, it gets truncated after around 60 lines. I know how to increase the output buffer (EXEC DBS_Output.Enable(10000) for 10000 lines) but I can't seem to find the equivalent for the input buffer. Please help.

    Are you using SQL Plus client, then you need to change the buffer size on the menu of the SQL Plus window.

  • Using variables in SQL Plus Worksheet

    I'm new to Oracle. I've developed in MS SQL for some time. I'm trying to debug a query we're using in an application. I paste it into SQL Plus Worksheet and get the message:
    SP2-0552: Bind variable "COUNTYPK" not declared.
    I could paste in a value, but I would like to define a variable before the query so that it will work the same way as it would in production.
    SELECT rsiplate.OWNER.work_area_code || '-' || SUBSTR(rsiplate.OWNER.work_phone_number, 1, 3) || '-' || SUBSTR(rsiplate.OWNER.work_phone_number, 4, 4) AS BUSINESSPHONE, trim(rsiplate.OWNER.first_name||' '||rsiplate.OWNER.middle_name||' '||rsiplate.OWNER.last_name) AS BUSINESSNAME, rsiplate.ADDRESS.address_line1 AS ADDRESSLINE1, rsiplate.ADDRESS.address_line2 AS ADDRESSLINE2, rsiplate.ADDRESS.city_name AS CITY, rsiplate.ADDRESS.state_code AS STATE, SUBSTR(rsiplate.ADDRESS.zip_code, 1, 5) AS POSTALCODE FROM rsiplate.WATERCRAFT_MASTER, rsiplate.WATERCRAFT_CURRENT, rsiplate.WATERCRAFT_REGIST_CURRENT, rsiplate.OWNER, rsiplate.WATERCRAFT_OWNER_CURRENT, rsiplate.ADDRESS WHERE rsiplate.WATERCRAFT_MASTER.WATERCRAFT_ID = rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_ID AND rsiplate.WATERCRAFT_MASTER.LF_WATERCRAFT_REGIST_ORDER = rsiplate.WATERCRAFT_REGIST_CURRENT.WATERCRAFT_REGIST_ORDER AND rsiplate.WATERCRAFT_MASTER.LF_WATERCRAFT_ORDER = rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_ORDER AND rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = :CountyPK GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code;

    Okay, I made some adjustements:
    SET DEFINE :
    DEFINE :COUNTYPK = '01'
    SELECT rsiplate.OWNER.work_area_code||'-'||SUBSTR(rsiplate.OWNER.work_phone_number, 1, 3)||'-'||SUBSTR(rsiplate.OWNER.work_phone_number, 4, 4) AS BUSINESSPHONE, trim(rsiplate.OWNER.first_name||' '||rsiplate.OWNER.middle_name||' '||rsiplate.OWNER.last_name) AS BUSINESSNAME, rsiplate.ADDRESS.address_line1 AS ADDRESSLINE1, rsiplate.ADDRESS.address_line2 AS ADDRESSLINE2, rsiplate.ADDRESS.city_name AS CITY, rsiplate.ADDRESS.state_code AS STATE, SUBSTR(rsiplate.ADDRESS.zip_code, 1, 5) AS POSTALCODE FROM rsiplate.WATERCRAFT_MASTER, rsiplate.WATERCRAFT_CURRENT, rsiplate.WATERCRAFT_REGIST_CURRENT, rsiplate.OWNER, rsiplate.WATERCRAFT_OWNER_CURRENT, rsiplate.ADDRESS WHERE rsiplate.WATERCRAFT_MASTER.WATERCRAFT_ID = rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_ID AND rsiplate.WATERCRAFT_MASTER.LF_WATERCRAFT_REGIST_ORDER = rsiplate.WATERCRAFT_REGIST_CURRENT.WATERCRAFT_REGIST_ORDER AND rsiplate.WATERCRAFT_MASTER.LF_WATERCRAFT_ORDER = rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_ORDER AND rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = :CountyPK GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code;
    But I still get this:
    SP2-0317: expected symbol name is missing
    old 2: iplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = :CountyPK GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code
    new 2: iplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = 01 GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code
    iplate.WATERCRAFT_REGIST_CURRENT.watercraft_id and rsiplate.WATERCRAFT_MASTER.watercraft_id = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_id and rsiplate.WATERCRAFT_OWNER_CURRENT.owner_id = rsiplate.OWNER.owner_id and rsiplate.WATERCRAFT_MASTER.watercraft_owner_group = rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_group and rsiplate.ADDRESS.address_set_id = rsiplate.OWNER.address_set_id and rsiplate.WATERCRAFT_MASTER.data_status_code = 1 and rsiplate.WATERCRAFT_OWNER_CURRENT.watercraft_owner_order = 1 and rsiplate.WATERCRAFT_REGIST_CURRENT.REGIST_EXPIRATION_DATE >= SYSDATE AND rsiplate.WATERCRAFT_CURRENT.WATERCRAFT_USE_CODE = 3 AND rsiplate.ADDRESS.COUNTY_NUMBER = 01 GROUP BY rsiplate.OWNER.work_area_code, rsiplate.OWNER.work_phone_number, rsiplate.OWNER.first_name, rsiplate.OWNER.middle_name, rsiplate.OWNER.last_name, rsiplate.ADDRESS.address_line1, rsiplate.ADDRESS.address_line2, rsiplate.ADDRESS.city_name, rsiplate.ADDRESS.state_code, rsiplate.ADDRESS.zip_code
    ERROR at line 2:
    ORA-00933: SQL command not properly ended

  • How to append timestamp to log file in SQL*Plus ?

    Version: 11.2.0.3
    Platform : RHEL 5.8 (But I am looking for platform independant solution)
    I want to append the timestamp to spooled log file name in SQL*Plus.
    The spooled log filename should look like
    WMS_APP_23-March-2013.logI tried the following 3 methods found in the google. But none of them worked !
    I tried this
    col sysdt noprint new_value sysdt_var
    SELECT TO_CHAR(SYSDATE, 'yyyymmdd_hh24miss') sysdt FROM DUAL;
    spool run_filename_&sysdt_var.Logas suggested in
    http://power2build.wordpress.com/2011/03/11/sqlplus-spool-name-with-embedded-timestamp/
    and this
    spool filename with timestamp
    col sysdt noprint new_value sysdt
    SELECT TO_CHAR(SYSDATE, 'yyyymmdd_hh24miss') sysdt FROM DUAL;
    spool run_filename_&sysdt..Logas suggested in
    http://powerbuildev.wordpress.com/2011/03/11/sqlplus-spool-name-with-embedded-timestamp/
    and this
    column tm new_value file_time noprint
    select to_char(sysdate, 'YYYYMMDD') tm from dual ;
    prompt &file_time
    spool logfile_id&file_time..logas suggested in
    Creating a spool file with date/time appended to file name
    None of the above worked in RHEL or MS DOS. Any workaround ?

    I have tested your suggestions. But I still couldn't append the date to the logfile in RHEL or MS DOS SQL*Plus
    Here are the attempts I've made. I am posting how the logfile looked like after every test.
    #Attempt1 with two dots (&sysdate..log )
    set echo on
    set feedback on
    set define off
    set pages 999
    column dcol new_value SYSDATE noprint
    select to_char(sysdate,'YYYYMMDD') dcol from dual;
    spool testlog.&sysdate..log
    select 'hello' from dual;
    spool off;Log File Name -- > testlog.&sysdate..log
    #Attempt2 with single dot (&sysdate.log)
    set echo on
    set feedback on
    set define off
    set pages 999
    column dcol new_value SYSDATE noprint
    select to_char(sysdate,'YYYYMMDD') dcol from dual;
    spool testlog.&sysdate.log
    select 'hello' from dual;
    spool off;Log File Name ---> testlog.&sysdate.log
    #Attempt3. Replacing first dot with Hyphen (testlog- ) to check if the first dot was causing the issue
    set echo on
    set feedback on
    set define off
    set pages 999
    column dcol new_value SYSDATE noprint
    select to_char(sysdate,'YYYYMMDD') dcol from dual;
    spool testlog-&sysdate.log
    select 'hello' from dual;
    spool off;Log Filename: testlog-&sysdate.log
    #Attempt4: replacing SYSDATE with SDATE
    set echo on
    set feedback on
    set define off
    set pages 999
    column dcol new_value SDATE noprint
    select to_char(sysdate,'YYYYMMDD') dcol from dual;
    spool testlog1.&SDATE..log
    select 'hello' from dual;
    spool off;Log File Name -- > testlog1.&SDATE..log

  • Is it possible to use MERGE with sql*plus and if yes how?

    Hello everybody,
    I have an xls file and I have to load its data with sql*loader, but instead of "APPEND" operation stated in the control file I need MERGE operation.Here is what my control file contains:
    LOAD DATA
    INFILE 'C:\WORK\DSK_WH\LOAD_FIRST\sqlldr\data.csv'
    BADFILE 'C:\WORK\DSK_WH\LOAD_FIRST\sqlldr\p_badfile.txt'
    APPEND
    INTO TABLE D_ACCOUNT_NAMES_TMP
    FIELDS TERMINATED BY ";"
    TRAILING NULLCOLS
    (account_number , consignment, sub_consignment, consign_sub_consign, account_name_bg, account_number_2, consign_parent_2, account_name_bg_2, account_number_3, account_name_bg_3, account_number_4, account_name_bg_4, account_number_5 , ACCOUNT_NAME_BG_5 ).
    How can I use merge in this case , instead of insert ?
    Regards,
    Maria

    I'm not sure if there is any MERGE thing in SQL*Loader, but you can have a backup table which gets loaded by SQL*Loader and then use MERGE statement from backup to the original table, if your data is not huge to become a performance barrier. This is just a suggestion, may be you can try some reading of SQL*Loader here.
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/part2.htm#436160
    Cheers
    Sarma.

  • Using Variables in SQL*PLUS

    Hi,
    I hope to get any insight possible. I am using External tables and the Default directory is set. Now the process is that I get an automatic downloads of files placed in that directory. They are all to have the same naming system.
    Test_June_2006 or Test_July_2006 and so on. Basically the month will be one behind, so Since it is August, I am looking for Test_July_2006.
    I was able to set the "location" parameter to accept a variable, but i am having some trouble with set the value to that variable.
    My code:
    define month = EXTRACT(MONTH FROM CURRENT_DATE)-1||'_'||EXTRACT(YEAR FROM CURRENT_DATE).txt
    variable month varchar2(100)
    drop table ext_Test;
    create table ext_Test
    (field1      varchar2(25),
    field2      varchar2(10),
    field3     varchar2(10),
    field4 varchar2(15),
    field5 Float,
    field6     Float,
    field7 Float
    organization external
    ( default directory sourcedata
    access parameters
    ( records delimited by newline
    SKIP 1
    fields terminated by ','
    OPTIONALLY ENCLOSED BY '"'
    missing field values are null
    location ('Test_&month')
    reject limit 0;
    When I tried "location ('&month') and setting month to July, it worked fine, but now that I am adding functions, it is not setting the variable properly.
    Any help would be appreciated. Thank you.

    You cannot use & substitution variable to replace file name dynamically.
    You will have to use the ALTER TABLE command at run time to alter the location of the file to what you want before you start processing.
    SQL> create table ext_Test
      2  (field1 varchar2(25),
      3  field2 varchar2(10),
      4  field3 varchar2(10),
      5  field4 varchar2(15),
      6  field5 Float,
      7  field6 Float,
      8  field7 Float
      9  )
    10  organization external
    11  ( default directory sourcedata
    12  access parameters
    13  ( records delimited by newline
    14  SKIP 1
    15  fields terminated by ','
    16  OPTIONALLY ENCLOSED BY '"'
    17  missing field values are null
    18  )
    19  location ('Test_&month')
    20  )
    21  reject limit 0;
    Enter value for month: july
    old  19: location ('Test_&month')
    new  19: location ('Test_july')
    Table created.
    SQL> alter table ext_test location('Test_August') ;
    Table altered.
    SQL>

  • Creating database using command in SQL*plus

    Hi,
    Its not an urgent question.
    I'm learning Oracle DBA. I have installed Oracle 9.2 in my windows system. And I am trying to create a database using SQL command.
    OracleVersion : 9.2
    Operating System Windows XP
    CREATE DATABASE suri
    USER SYS identified by manager
    USER system identified by surendra
    LOGFILE GROUP 1 ('F:\Oracle\oradata\suri\redo01.log') SIZE 100M,
            GROUP 2 ('F:\Oracle\oradata\suri\redo02.log') SIZE 100M,
            GROUP 3 ('F:\Oracle\oradata\suri\redo03.log') SIZE 100M
       MAXLOGFILES 5
       MAXLOGMEMBERS 5
       MAXLOGHISTORY 1
       MAXDATAFILES 100
       MAXINSTANCES 1
       CHARACTER SET US7ASCII
       NATIONAL CHARACTER SET AL16UTF16
    DATAFILE 'F:\Oracle\oradata\suri\system01.dbf' size 200M EXTENT MANAGEMENT LOCAL
    UNDO tablespace undots datafile 'F:\Oracle\oradata\suri\undots01.dbf' size 200M
    DEFAULT TEMPORARY TABLESPACE tempts1 DATAFILE 'F:\Oracle\oradata\suri\temp01.dbf' SIZE 100M EXTENT MANAGEMENT LOCAL
    I'm getting error like below while executing the CREATE DATABASE command.
    ERROR at line 16:
    ORA-25139: invalid option for CREATE TEMPORARY TABLESPACEI have validated the syntax but not able to find where the error is.
    Please let me know if you need any further details.
    Thanks in advance for your help.
    Regards,
    Suri

    Welcome.
    why I got error when I use DATAFILE in CREATE DATABASE command (In oracle documentation also it shows as DATAFILE only)See http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_55a.htm#2127439
    Also, error description may be helpful...

  • SQL Plus flat file

    I'm trying to write a SQL script that will generate a comma delimited file for use with Excel. When I execute the following line by line in SQL Plus, everything works fine. However, when I save the script in a file and open the file with SQL plus, it doesn't generate the file.
    Can someone please tell me what I'm missing here?
    Thank you very much.
    Robert
    set heading off
    set feedback off
    set trimspool on
    set echo off
    set pagesize 0
    spool c:\spool\data.txt
    select la.code ||','|| lai.code|| ',' || la.title as data
    from drLAInstanceMeeting laim
    inner join drLearningActivityInstance LAI on lai.id=laim.learningActivityInstanceID
    inner join drLearningACtivity LA on la.id=lai.learningActivityID
    where abs(meetingEnd - meetingStart) > (6/24);
    spool off

    I have continued to play with the above script, and found more information that may be helpful. When the script is executed I receive the following error:
    Is there something I need to do to use the SET command in a saved script?
    SQL> list
    1 set heading off
    2 set feedback off
    3 set trimspool on
    4 set echo off
    5 set pagesize 0
    6 spool c:\spool\data.txt
    7 select la.code ||','|| lai.code|| ',' || la.title as data
    8 from drLAInstanceMeeting laim
    9 inner join drLearningActivityInstance LAI on lai.id=laim.learningActivityInstanceID
    10 inner join drLearningACtivity LA on la.id=lai.learningActivityID
    11 where abs(meetingEnd - meetingStart) > (6/24)
    12 /
    13* spool off
    SQL> /
    set heading off
    ERROR at line 1:
    ORA-00922: missing or invalid option

  • Using SQL*PLUS Insert ??

    oracle 10G, using command line SQL*PLUS.
    I want to make 10 insert at a time, USING the ED mode.
    I want to load this into SQL
    ie insert ..;
    insert...;
    insert ..;
    commit ;

    Here is an example for a windows client.
    If you type 'ed' at the sql prompt and hit enter key, an editor window will show up. Type all your statements.
    Use the 'Save as' option from the 'file' menu to save the file (for example, 'abc.sql'). Close the editor. At the sql prompt, type '@path\abc' or 'start path\abc'.

  • Can i comment out lines of code in a .sql script file to be run in SQL PLUS

    Hi All,
    I have commented out part of the script, and when i ran the script (.sql) file in Sql*Plus
    I am getting some errors like
    SP2-0734: unknown command beginning
    how to avoid these errors?
    any help is appreciated
    Thanks
    R.R

    >
    select * from dual; -- me too!Nope, not this one...
    test@ORA10G>
    test@ORA10G> host type c:\test.sql
    select * from dual; -- me too!
    test@ORA10G>
    test@ORA10G> -- doesn't work
    test@ORA10G>
    test@ORA10G> @c:\test.sql
      2
    test@ORA10G>
    test@ORA10G> @c:\test.sql
      2  /
    select * from dual; -- me too!
    ERROR at line 1:
    ORA-00911: invalid character
    test@ORA10G>
    test@ORA10G> -- now this works...
    test@ORA10G> host type c:\test.sql
    select * from dual -- me too!
    test@ORA10G>
    test@ORA10G> @c:\test.sql
    D
    X
    test@ORA10G>
    test@ORA10G> -- and so does this...
    test@ORA10G> host type c:\test.sql
    select * from dual -- me too!
    test@ORA10G>
    test@ORA10G> @c:\test.sql
    D
    X
    test@ORA10G>
    test@ORA10G>pratz

Maybe you are looking for

  • Exciseable free goods in purchasing

    hi i want to create free goods PO by deselecting invoice and Gr based IV but i want to mention some percentage of excise. how to handle this without base price.

  • Flash Builder 4.5 for PHP Licensing with CS5 Subscription

    its unclear to me if we subscribe to CS5 Master Collection or Web Premium, but want the PHP edition how you go about that, can the upgrade be part of the subscription, if not can the subscription builder be upgraded?

  • Using PIPELINED in VO

    Hello, I have 2 types: create or replace type e1e2 AS OBJECT ( e1 varchar2(3), e2 varchar2(3)); CREATE OR REPLACE TYPE e1e2_tabtype AS TABLE OF e1e2; and function: CREATE OR REPLACE function manage_type(ee in varchar2) return e1e2_tabtype PIPELINED a

  • Logic crashes too often

    i really don´t check it! please help! i have a project running and i can´t no more open my song!?! logic just closes! this is the report, i have no idea what it means! i hope there is somebody out there who knows more, thanx: Date/Time: 2007-05-10 02

  • Legal music services question

    Hi- I got a new 30 gb video ipod for Xmas and was wanting to download a few tracks from an album that is out of print. iTunes has a partial album available for download, but a few tracks are missing, including the one I'd like to get most. What legal