How to run multiple scripts in sql*plus?

I would like to run 2 scripts in sql*plus, how do I do this? I tried the following, but it won't run.
create table student_new
AS
select *
from student
insert into student_new
(last_name, first_name
values
(Crop, Jenny)
The above are the two scripts I want to run, what am I doing wrong.
Thanks

Do you have a solution to run multiple scripts continuosly, one after the other as one script.
Say I have file1.sql file2.sql, file3.sql.
I want to create a script run.sql, where this will run file1.sql,file2.sql,file3.sql one after other without any one running one after the other like follows:
run.sql should have
begin
@file1.sql
@file2.sql
@file3.sql
dbms_output.put_line(select sysdate from dual);
end;
If I run run.sql all the three scripts should be executed successfully and then display the current time . All these files have update statements(50,000 updates each file).
Very urgetn. Can some one hlpe, please.
Thanks in advance.

Similar Messages

  • How to invoke multiple sessions of sql*plus thru pl/sql program

    Hi
    How to invoke multiple sessions of sql*plus thru pl/sql program.
    Thanks

    How to invoke sql*plus in a procedure?????
    I have to invoke more pl/sql sessions?????No you don't "have to".
    Look at what you are trying to do.
    You have a program running inside the PL/SQL engine. This is running nicely inside the Oracle database and is perfectly capable of issuing other SQL statements, PL/SQL programs etc. inside it's nice cosy Oracle environment.
    You are asking for this PL/SQL to shell out to the operating system, run an external application, for which it will have to supply a username and password (are you planning on hard coding those into your PL/SQL?), and then that external application is supposed to run more SQL or PL/SQL against the database.
    a) Why hold all this code external to the database when it can quite happily reside on the database itself and be executed through jobs or whatever.
    b) Consider what would happen if someone were to replace the external application with their own program of the same file name... they'd be able to capture the username and password for connecting to the database, therefore a major security flaw.
    The whole idea of doing what you want through external calls to SQL*Plus is ridiculous.

  • How to view full script in sql*plus

    Hi,
    i am having a user who want to view the script for trigger by querying user_triggers in SQL*PLUS. i just remembered that there is some DBMS_ package for doing this. can anyone please provide that package name.
    thanks in advance

    Were you thinking of DBMS_METADATA?
    Have a look at this: http://blogs.ittoolbox.com/database/solutions/archives/ddl-generationoracles-answer-to-save-you-time-and-money-7590

  • How to run OWB mappings from SQL*Plus

    Hi:
    I used to run OWB mappings using the sample code RUN_MY_OWB_STUFF in a customized PL/SQL procedure. This works for OWB 10g release 1 but not for OWB Paris (10g Release 2) because the execution always returns FAILURE.
    Is there something new in OWB Paris that RUN_MY_OWB_STUFF doesn't work anymore?
    Thanks,
    Hazbleydi C. Verástegui

    Hi Maruthi:
    I already check the input parameters of the mapping. I'm setting them as a custom parameters. This is the output of the execution:
    16:01:11 SQL> EXEC PR_RUN_OWBMAPPING_TABLA2('MPG_EMPLEADOS_NOMINA_PERIODO',2007,01);
    Stage 1: Decoding Parameters
    | location_name=LOC_DM_STAGING
    | task_type=PLSQL
    | task_name=MPG_EMPLEADOS_NOMINA_PERIODO
    Stage 2: Opening Task
    | l_audit_execution_id=39635
    Stage 3: Overriding Parameters
    | P_ANO%CUSTOM='2007'
    | P_MES%CUSTOM='1'
    Stage 4: Executing Task
    | l_audit_result=3 (FAILURE)
    Stage 5: Closing Task
    Stage 6: Processing Result
    | exit=3
    By the way, RUN_MY_OWB_STUFF is the same as RUN_OWB_CODE.sql except for the two first parameters (p_result and p_audit_id):
    create or replace procedure run_owb_code
    ( p_result out number
    , p_audit_id out number
    , p_repos_owner in varchar2 default null
    , p_location_name in varchar2 default null
    , p_task_type in varchar2 default null
    , p_task_name in varchar2 default null
    , p_system_params in varchar2 default '","'
    , p_custom_params in varchar2 default '","'
    , p_oem_friendly in number default 0
    is
    CREATE OR REPLACE function run_my_owb_stuff
    ( p_repos_owner in varchar2 default null
    , p_location_name in varchar2 default null
    , p_task_type in varchar2 default null
    , p_task_name in varchar2 default null
    , p_system_params in varchar2 default '","'
    , p_custom_params in varchar2 default '","'
    , p_oem_friendly in number default 0
    ) return number
    is
    How do you invoke your wrapper PL/SQL with these two first parameters?
    Thanks in advance,
    Hazbleydi C. Verástegui

  • Can we run a unix script from sql plus

    Hello,
    Is there any possibility to run unix command from sql plus? I would appreciate if you can provide with the syntax.
    Thank You
    KK

    user539616 wrote:
    Hello,
    Is there any possibility to run unix command from sql plus? I would appreciate if you can provide with the syntax.
    Thank You
    KKWithin sqlplus you can run
    1) SQL statements
    2) PL/SQL blocks
    3) any valid sqlplus command.
    SQLplus commands are documented in the SQLPlus reference manual. For 10g this is found at http://docs.oracle.com/cd/B19306_01/server.102/b14357/toc.htm. You might be interested in the HOST command, detailed at http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch12026.htm#sthref2314
    Just beware that the HOST command (or the shortcut version of it alluded to by Warren Tolentino) spawns a child process. When control comes back to sqlplus, that child process is gone.
    What is the business problem you are trying to solve? If we knew that we could probably give better advice than blindly giving you the correct technical answer to a narrow question.

  • How to run a script on Oracle server from isqlplus

    Hi I am trying to run a script on my workstation from Oracle server through isqlplus workarea. I entered following command and get the following error. i have enabled isqlplus URL by editing web.xml file already. Can please someone help how to run the script?
    @http://myaixserver.com:5560/scripts/Databasestartupstages.sql;
    SP2-0920: HTTP error 'page not found (505)' on attempt to open URL

    So far, you haven't specified your rdbms version and isqlplus behaved differently on a 9iR1, 9iR2 from the one release on 10gR1/R2. on 9i it was a servlet based on a JServ servlet executor machine, meanwhile on 10g it is a J2EE compliant application deployed on an OC4J container, so configuration is different.
    You may want to take a look at these references -->
    * Starting iSQL*Plus from a URL
    * Creating Reports using iSQL*Plus
    ~ Madrid

  • "ORA-1722 Invalid number" error while runing a SQL script in SQL*Plus

    Hello,
    I created a SQL script that is intended to populate tables with
    baseline data. When I run the script in the SQL*Plus program
    that comes with the Oracle 8.1.6 (client), I receive an "ORA-
    1722 Invalid number".
    The error always occurs when SQL*Plus tries to execute the
    following SQL statement:
    insert into components(db_ind,module_id,ext_compid,active) values
    ('cm',modules_seq.currval,1046682,'y');
    The datatypes for the columns on the components table are as
    follows:
    db_ind varchar2(2);
    module_id number;
    ext_compid number;
    active varchar2(1);
    It seems that for some reason Oracle is having trouble
    recognizing 1046682 as a number.
    I also tried the following INSERT statements to see if that
    would work:
    insert into components(db_ind,module_id,ext_compid,active) values
    ('cm',modules_seq.currval,to_number('1046682'),'y');
    insert into components(db_ind,module_id,ext_compid,active) values
    ('cm',modules_seq.currval,'1046682','y');
    but I still receive the same error message
    Is there some NLS setting(s) I need to modify so that Oracle
    does not give me this error? Does anyone know the answer to
    this problem?
    Your help is greatly appreciated.
    Oscar
    (NOTE: I also receive this same error when trying run the
    script in SQL Navigator and Toad programs)

    Please see the following docs.
    R12: JBO-27122 Error Message Clicking On Supplier Accounting Link With Unexpected Error [ID 1218903.1]
    Supplier Management Accounting Link Gives Unexpected Error and JBO-27122 at SELECT * FROM (select pvsa.ADDRESS_STYLE [ID 1340655.1]
    Adding Accounting Information or Operating Unit Information fails with APP-FND-1564: ORACLE error 1722 in FDFGVD [ID 364265.1]
    Thanks,
    Hussein

  • Accept input from Shell script in sql*plus

    Hey! Guys..
    i need the following info.
    I am running a shell script from sql*plus. I need to accept a value from shell script into my .sql file.
    thanks..
    Harsh.

    prompt for input, pass to another shell
    # contract_status_prompt.sh
    read udate?"Enter week-ending date in format dd-mmm-yyyy: "
    contract_status_update.sh $udate >$FDWLOG/current/contractstatusupdate`date +%d%h%y`.log
    echo `date`
    # End contract_status_prompt.sh
    Read the variable passed and use in SQLPlus:
    # contract_status_update.sh
    echo "Running contract_status.sh"
    echo "create records for contract_status"
    echo `date`
    echo " "
    echo " date used is "; print $1
    echo " "
    sqlplus <<exit
    @$FDWSQL/sqlparms
    set time on
    prompt *** Set contract_status_period ***
    update contract_status_period
    set period_date = '$1';
    commit;
    exit
    etc.

  • 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 OPEN MULTIPLE TABLES IN SQL DEVELOPER SIMULTANEOUSLY

    hello i m new to sqldeveloper so plz dnt laugh if m asking silly question
    HOW TO OPEN MULTIPLE TABLES IN SQL DEVELOPER SIMULTANEOUSLY

    Use the 'pin' on your table editor
    http://www.thatjeffsmith.com/archive/2011/11/sql-developer-quick-tip-pin-query-result-sets-and-plans/
    Then open your 2nd table. If you want to see both at the same time, right-click on the table editor tab and select 'New Editor Tab Group'
    Not a silly question, but no need to shout :)

  • How to run a script from Calculation Manager

    Hi All,
    I would like to know how to run a script made by using Calculation Manager. I have converted a simple rule script which has just one statement(HS.EXP "A#Sales = 100") in "Sub Calculate()" by using FMRulesMigrator.exe and then imported, deployed to an application. when I execute "Calculate" from a Data Grid, the rule didn't take effect to application data. If I load the script by using classic rule editor, it works fine.
    Is there anything I have to know to run a rule script which is made by using Calculation Manager?
    Thanks in advance.
    CY.

    Hi,
    Refer the following the link for calling logic from new custom buttons using VBA.
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f085dd92-a40c-2c10-dcb1-a7c24476b23a
    hpe this ll help.
    thnks.

  • How to run txt file in sql enviroment

    i want to run txt script in sql
    when i wrote
    @path of file and name of file .txt
    i recieved this message
    SP2-0310: unable to open file
    any one help me please

    In what version?
    with what operating system?
    what the the exact path to the file?
    have you verified that it exists?
    have you verified that the file can be opened by the user Oracle?
    In the future please post relevant information. We can not read your mind or look over your shoulder.

  • 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

  • How to find session information in sql plus

    Can someone please tell me how to find session information in sql plus? I specifically want to know my privileges for the current session. Thanks in advance.

    SELECT * FROM session_privs;
    SELECT * FROM session_roles;

  • How to control logic flow in SQL Plus script

    Hi
    I have the requirement below:
    Before I start running an SQL script, I need to ensure that I am connecting as a particular user. If I am not that user, then the script should show a msg "Error - Invalid User - Log in as <<username>>"
    Let's say i am executing a script A.sql.
    SQL > @<path>a.sql
    But before this script is executed -- i shall check for the user:
    block begins...
    select user into var1 from dual
    if upper(var1) != 'ABCUSER' then
    -- display the error message and stop execution of this script
    else
    @<path>a.sql (*it executes what i want :) )
    end if;
    block ends...
    How do I write this code using an SQL script ? Pls sugges

    Hi,
    As Centinul said, SQL*Plus is poorly equipped to deal with problems like this. If possible, try to do what you want outside of SQL*Plus.
    If you really have to do it in SQL*Plus, here are two ideas:
    (1) run a script conditionally
    (2) deliberately raise an error
    (1) Using SQL*Plus substitution variables, you can decide which of several scripts to run as a sub-script, based on the results of some query.
    For example, if a.sql is the script that only user ABCUSER is allowed to run, then write two other very short scripts:
    (a) warning.sql, such as the following:
    --  warning.sql
    PROMPT  You are not authorized to do this.
    QUIT(b) step_1.sql, which decides whether a.sql or warning.sql should be run, and does it:
    --     step_1.sql - Decide whether a.sql or warning.sql is to be run next, and do it.
    --     (a) decide:
    COLUMN  script_name_col     NEW_VALUE     script_name
    SELECT     CASE
              WHEN  USER = 'ABCUSER'
              THEN  'a.sql'
              ELSE  'warning.sql'
         END     AS script_name_col
    FROM     dual;
    --     do:
    @&script_nameYou may want to use @@, or specify a complete path name.
    (2) Deliberately raise an error, either in a separate script or in a.sql itself, like this:
    WHENEVER     SQLERROR     EXIT
    SELECT     CASE
              WHEN  USER = 'ABCUSER'
              THEN  NULL
              ELSE  TO_NUMBER ('This will raise ORA-01722')
         END     AS "Welcome!"
    FROM     dual;
    WHENEVER     SQLERROR     NONE
    -- continue with the original a.sql

Maybe you are looking for