Execute  *.sql file ????

Hello every body.
I need to execute a *.sql file from my VB 6.0 application.
I connect to oracle by ODBC ....
connBD.Open "PROVIDER=MSDASQL;dsn=PRUEBA;uid=" & Prueba.User.Text & ";pwd=" & Prueba.Password.Text & ";database=" & Prueba.connBD.Text & ";"
Ok... no problem
But,,, How can I do for execute my "cTable.sql" file???
I try with ... connBD.Execute "@cTable.sql" , but no
I try with ... connBD.Execute "START cTable.sql", but no..
Some body can Help Me???
Thank You very much
Glenn

SQL*Plus is generally the preferred tool to execute a .sql file-- that's what it is designed for. Assuming that your users all install SQL*Plus, you could call out to the command line and invoke that app with the .sql file, then parse the output.
The other option would be to read in the .sql file in your application, parse it, and send the individual PL/SQL blocks to the database.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC

Similar Messages

  • How to execute .sql file in Stored Procedure?

    Hi,
    I have an urgent requirement, where i have to execute .sql file form Stored Procedure.
    This .sql file will have set of update statement. I need to pass value to this update statement.
    Kindly please help me.
    Regards,
    Irfan

    This is required as part of Data Migration where  i have to do 100 of table's update. Each time update table will defer, so its better to have in separate script file (.sql). Can u paste some sample/syntax to exceute .sql file from stored procedure. I am new to this PL/SQL.
    How have you determined that it's "better" to have seperate scripts?  I assume you mean the table name will "differ" (and not "defer" - I assume that's just because English isn't your first language? no problem - I think I understand what you're asking).
    So what I think you're asking is that you have dynamic table names but each table needs to be updated in the same way?
    Question: Why do you have tables with different names that all need the same process doing to them?
    Assuming it's a valid requirement (and 99% of the time doing dynamic coding implies it's not).... you could use dynamic code, rather than 'scripts'...
    e.g.
    create procedure update_table(tbl_name varchar2) is
    begin
      execute immediate 'update '||tbl_name||' set lastupdate = null';
    end;
    As you haven't bothered to provide a database version, any example code/data or explanation of what you're actually doing, you're not going to get any detailed answer.  Please do take the time to read the FAQ and post appropriate details so people can help you.

  • Execute sql files

    Hi,
    I'm trying to execute sql files located in
    unix environment using sqlplus from forms 6i
    in windows Me environment. I give the full
    directory like @/usr/users/oracle/toto.sql.
    But an error occures telling me that file
    cannot found (error SP2 0310).
    I hpe deeply that you can help me, please.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by dany:
    Hi,
    I'm trying to execute sql files located in
    unix environment using sqlplus from forms 6i
    in windows Me environment. I give the full
    directory like @/usr/users/oracle/toto.sql.
    But an error occures telling me that file
    cannot found (error SP2 0310).
    I hpe deeply that you can help me, please.<HR></BLOCKQUOTE>
    Be carreful of upper/lower-case. Unix is case sensitive !! Maybe @/usr/users/oracle/toto.SQL or @/usr/users/oracle/Toto.Sql or ...

  • How to execute sql file from servlet

    Hi,
    I am using JSP, Servlets and Oracle 8i in my application. I want to execute .sql file from java code. Is it possible to do that,
    as we execute .sql file from sql plus prompt.
    Suppose I have abc.sql file and I want to execute it from java code.
    If any body have the solution then pl. reply with sample code.
    Thanks,
    Rajesh

    If any body have the solution then pl. reply with
    sample code.No, no, dec - s/he doesn't want the actual solution, but the full code!
    /k1

  • How to execute .sql file

    hi,
    i want to execute .sql files in sql plus from a fixed location whether it may be network location or from system drive. so that i can use it from other computers when i will be working on different pc.
    so please tell me for network location solution and from drive. by default it fetch from BIN directory
    i am using oracle 10g.
    thanks

    Hi FRNzzz!! wrote:
    if the .sql files are placed on some network place then also i just need to put the path of that directory ? Sure. You can either set up a desktop shortcut for SQL*Plus using the remote folder as the "Start in" location, or (what I usually do) drag the script file into your SQL*Plus window.
    Edited by: William Robertson on Feb 26, 2011 2:21 PM

  • How to execute .sql file using ODI

    Hi All,
    I need to execute .sql file using ODI.
    I tried @{path}{file} command in ODI procedure selecting oracle technology.but it is failing.
    Do any one have any other idea to execute .sql file.
    Thanks in advance

    Ohk...I think you can try creating batch file(.bat) if its Windows & call that from ODIOSCommand.
    The bat file should contain scripts which call .sql file using sqlplus  & there you can use @{path}{file} format.
    See if this helps.
    Regards,
    Santy

  • Executing .sql file in oracle using php

    Hello friends
    I am converting the oracle form into web application.
    My requirement is to execute a .sql file when i click on a button in the html form.
    What i need to do is when the user click on the button then the sql+ window shoudl open up and a file located on the server should get executed.
    Please note i have to do this in php. If any other alternative is there for this requirement then that also is welcomed.
    Any help would be appreciated.
    Thanks
    Vinod

    The thing is i am using
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE 10.2.0.1.0 Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    I am connecting to the DATABASE using
    the below php code
    =========================
    <?php
    if (!ini_get('display_errors')) {
    ini_set('display_errors', 1);
    PutEnv("ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/");
    PutEnv("LD_LIBRARY_PATH=-Wl,-rpath,/usr/lib/oracle/xe/app/oracle/product/10.2.0/server//lib -L/usr/lib/oracle/xe/app/oracle/product/10.2.0/server//lib -lclntsh");
    $dbstr ="(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = XXX.XXX.XXX.XXX)(PORT = XXXX))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = XE)
    if(!@($conn = oci_connect('SYSTEM','passwordString',$dbstr)))
         print_r(ocierror());
    else
    echo "connected succesfully";
    exit;
    ?>
    ========================
    I am able to connect the database and ececute query and fetch the results.
    Now one file will be present in some directory on the server let say abc.sql
    Now i need to execute that file and display the output to the user by means of php code.
    So please provide me the detailed step on how to get this done.
    Thanks

  • Executing SQL FILE to generate CSV

    I have xxxxx.sql file, I need to execute it against Oracle10g(10.2.0.1.0) databse and should get the output as CSV file.
    What is the best way doing it using Oracle proceduer/ function, etc... and I can call it using Java class

    If you cannot create it in SQL/Plus beforehand, you can still read it (e.g. using FileInputStream) with Java and use executeQuery() with PreparedStatement.
    You can find some open source library (e.g. opencsv) to read the ResultSet with CSVWriter(java.io.Writer writer, char separator, char quotechar), and then output to a file with writeAll(java.sql.ResultSet rs, boolean includeColumnNames).
    regards,
    a.t.

  • Execute sql file from forms

    Hello, how is it possible to execute a sql file from forms without using sqlplus, because we have only the forms runtime on our pc.
    We can't use forms_ddl because we have a very big sql script for creating a package.
    Please help,
    GJ

    Strange, whenever I have installed forms I got sqlplus too without asking for it. If it is not installed, wouldn't your best bet be to install it ?

  • Execute .sql file using JDBC

    I have a .sql file which contains a SELECT query and spools the ouput into a .txt file.
    The problem is, I have some formatting queries like SET LINESIZE 500 etc.
    How do I execute the .SQL file

    vignesh_shrinivasan wrote:
    I have a .sql file which contains a SELECT query and spools the ouput into a .txt file.
    The problem is, I have some formatting queries like SET LINESIZE 500 etc.
    How do I execute the .SQL fileYou have a file which has SQLPLUS script.
    Nothing you do will make SQLPLUS command statements work via JDBC.
    There are only two options.
    1. Create a PL/SQL which does the same thing.
    2. Use SQLPLUS and do not use jdbc.

  • How to execute sql files with windows path ?

    Hi , here's my stupid question :
    I have my parent SQL script say A.sql in directory C:\program files\my files\A.sql
    A.sql has calls to multiple sql files like this
    @@1.sql;
    @@2.sql;
    When I call A.sql using sqlplus as:
    sqlplus <username> <connection_string> @"C:\program files\my files\A.sql"
    A.sql gets executed but then while calling "1.sql" it fails with the error
    SP2-0310: unable to open file "C:\program.sql"
    This is happening because of the space, how can this be handled. thx in advance :)
    Regards,
    Neuron

    my A.sql is:
    @@1.sql
    @@2.sql
    1.sql and 2.sql are in the same directory as A.sql.
    sqlplus <username> <connection_string> @"C:\program files\my files\A.sql"
    VG2,
    Yes. Specify the entire path/filename and put double quotes around itA.sql has the double quotes around it, however what additional things can be done so that 1.sql and 2.sql which are present in same directory as A.sql also runs.
    Ashish,
    Yes the assumption is correct. Although when I cd to this directory then this issue won't come for sure.
    But the requirement is you can't 'cd' to the directory and want to execute with complete path.
    There is no issues in Solaris as the space is not allowed.

  • How to execute .sql file if it contains unicode characters?

    DB version : 10.2.0.1
    OS : Windwos XP
    Today I got an .sql file which needs to be executed from sql*plus prompt.
    When I am trying I got error as below
    SP2-0042: unknown command " ■I" - rest of line ignored.
    When I checked the .sql file, I found there are Urdu characters (I believe we treat them as unicode) because of which I am facing error.
    Can anyone help me in finding the way to execute this .sql file which contains unicode characters?
    Thanks in advance

    That sql file contains so many insert statements. Here is one such statement
    INSERT INTO MAIN_LAND_TABLE_DEMO(OBJECTID, BLK_ARA_SER_SECTOR_ID, BLK_ARA_AREA_CODE, BLK_BLOCK_ID, PLOT_ID, DOCUMENT_NO, AREA_NAME, OWNER_NAME, PLOT_AREA_SQ_F, PLOT_AREA_SQ_M, PLAN_NUMBER, PLAN_DATE, OLD_BLOCK_ID, OLD_PLOT_ID, LAND_USE, PLOT_DESC, LAND_TYPE, REMARKS, IMAGE_FILE_NAME, PLOT_SIZE_S, PLOT_SIZE_N, PLOT_SIZE_E, PLOT_SIZE_W, BUILDING_HEIGHT, GROUND_LEVEL, NO_OF_FLOORS, REFERENCE_NO, OLD_DRAWING_NO, PERMIT_NO, CUR_CUSTOMER_COD, QC) VALUES(RAK_ISP_SEQ.nextval,1,0,7,71,'','الرمس - ضايه','وقف على مساجد راس الخيمه',10936,1016,'33/2000',TO_DATE('8/5/2000','mm/dd/yyyy'),'','161','سكني','خالية','ملك','','','','','','',0,0,0,'','2000/32','',0,1);

  • Executing *.sql files from jdbc

    Hi, does anyone know how can I execute an sql file using jdbc?
    Please make me know, tnx.
    Regards

    Check this out.
    http://asktom.oracle.com/pls/ask/f?p=4950:8:14961192831279021580::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:952229840241,

  • EXECUTE sql file in an procedure,just like sql prompt.

    Hi,
    I am using ORACLE 11g on an AIX box.
    Just to explain first :- Assume we have an .sql file in which i have 20 DML statements. Like 10 inserts,5 updates and 5 deletes. Now if i want to run this file in any particular DB , the best thing for one file i can do is .. simply go to the prompt i.e. SQL> on that DB and run that file :-
    SQL>@/oracle/scripts/metadata_update.sql
    just this will execute the whole file. Also here i can spool and keep the log of execution.
    Now i want the same functionality but this time their are many files and and i have to run them on different DB's.
    Can anyone suggest me some code in which if i pass the filename and the DB's name .. it should execute in that DB and create a log file in the same directory as the sql file.
    Something like procedure, which will take file name and DB name as parameter
    and then we will read file using UTL_FILE
    and then go to the destination DB with the help of TNSENTRIES we have.
    execute it and store the log for the same.
    Please suggest some sample code or ideas.
    thanks in advance.

    VIRU wrote:
    Our team gets those scripts on regular basis. We need to apply them on different DB's around 4 of them.
    So i wanted a utility by which i can apply it from one procedure.PL/SQL is wrong tool for this job.
    When your only tool is a hammer, all problems are viewed as nails.
    While a hammer is a GREAT tool, it is suboptimal to divide 1 board into 2 pieces
    sqlplus user/pass@remote1 @new_script.sql
    sqlplus user/pass@remote2 @new_script.sql
    sqlplus user/pass@remote3 @new_script.sql
    sqlplus user/pass@remote4 @new_script.sql

  • Executing .sql file, path problem,help!

    Hi, could anyone tell me that how to change the default .sql file running path in Oracle 8?
    I am running Oracle 8 resides on IBM AIX server. i found that under SQL prompt, the default .sql file running path is my home directory,e.g./home/user01,so i have to save all .sql files under that directory....could anyone tell me how to modify the default path to other directories.e.g,/home/user01/sql, so i could collect all .sql files under a specified directory?
    Many thanks

    Set the environment variable SQLPATH
    For more information see
    SQLPATH on 9iRel2 on Win XP

Maybe you are looking for

  • HP Color LaserJet 2600n installation guide lines

    Hi I am using HP color laser Jet 2600n- this one is my first printer-  I have not much knowledge about this product, but I searched a lot from Google, I am using windows 7 32bit. I got driver and install. And also update windows, but still it's not w

  • Standalone lookup - How to join in ODI - SQL Server

    Hi All, My Sql server query is joining as follows Select ................... From A.DBO.MAIN Inner Join A.DBO.LOOKUP_STANDALONE on 1=1 How will I convert this in ODI? Thank you for the time and help.

  • BAPI Error -  Condition FS00 is missing in pricing procedure A V

    ORDER_CONDITIONS_IN-ITM_NUMBER = '000010'. ORDER_CONDITIONS_IN-COND_ST_NO = '10'. ORDER_CONDITIONS_IN-COND_COUNT = '10'. ORDER_CONDITIONS_IN-COND_TYPE = 'FS00'. ORDER_CONDITIONS_IN-COND_VALUE = '20000'. ORDER_CONDITIONS_IN-CURRENCY = 'KRW'. ORDER_CON

  • Loud Superdrive, CD Recordings Fuzzy

    My SuperDrive is at TIMES, very loud when I put in a CD or DVD; and, at other times is quiet. There have been no problems READING disks, but when burning CDs (audio from itunes), some of the songs are fuzzy and skip. One DVD recording errored as well

  • Setting LM3S8962 as I2C slave

    Hi, Im using the LabVIEW embedded module for ARM microcontrollers upon the LM3S8962 in order to create I2C communication between two devices, the other being a MCF51JM128 Coldfire microprocessor. I've been able to set the LM3S8962 as the master devic