Results 1 to 5 of 5

Thread: Run the query as Script in SQLPLUS

  1. #1
    Contributing Member
    Join Date
    Apr 2007
    Answers
    41

    Run the query as Script in SQLPLUS

    Hello,

    I have written SQL query as script on windows machine. How do i access this file from sqlplus. To put the question other way How can i run the query as Script in SQLPLUS?

    One way to do is to copy the script direclt and Paste it.

    But I want to know how do we run it as script?


  2. #2
    Moderator
    Join Date
    Jun 2007
    Answers
    2,074

    Re: Run the query as Script in SQLPLUS

    You need to save the file as .SQL extension. Better to store in BIN folder in oracle home path.
    To call the file use

    start filename
    or
    @filename


  3. #3
    Junior Member
    Join Date
    Aug 2007
    Answers
    15

    Re: Run the query as Script in SQLPLUS

    Quote Originally Posted by prakash.kudrekar View Post
    Hello,

    One way to do is to copy the script direclt and Paste it.
    One thing you can do in regard to this is that, Like Debasis has mentioned save the file with SQL extension and at the SQLPLUS prompt give @filename.

    Else you can use get filename to write the contents of that file into the SQL buffer and then simply use / to run it.

    Hope this helps...


  4. #4
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: Run the query as Script in SQLPLUS

    First save the file with .sql extension and in sqlplus call the file using
    @ requiredpath
    ex: @ c:\ex i think it will help u


  5. #5
    Junior Member
    Join Date
    Sep 2006
    Answers
    2

    Re: Run the query as Script in SQLPLUS

    Run the query as Script in SQLPLUS

    follow the following steps for the solutions:-

    1) create the file either in word-pad,Ms-word or in notepad.but prefer notepad usually.

    2) save the file with the name having extension ".sql".for eg.. save the file as abc.sql. here abc is the file name and .sql is extension.

    3) open oracle.give the appropriate path of the file following by "get" keyword.
    suppose file is saved in c:/.the the statement will be

    with double quotes i.e " get @ c:/abc.sql"; press enter.

    4) sometime forward '\' is applicable while sometime backward'/' is used.if there is error in '/' then try with '\' or vice-versa.

    but always keep in mind that the script must be save with extension " .sql" as we were using the script in oracle/sql.

    hope ur problem will be solved.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact