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

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.

  • How to execute SQL Script using windows powershell(using invoke-sqlcmd or any if)

    OS : Windows server 2008
    SQL Server : SQL Server 2012
    Script: Test.sql (T-SQL)  example : "select name from sys.databases"
    Batch script: windows  MyBatchscript.bat ( here connects to sql server using sqlcmd  and output c:\Testput.txt) 
     (sqlcmd.exe -S DBserverName -U username -P p@ssword -i C:\test.sql -o "c:\Testoutput.txt)  ---it working without any issues.....
    This can execute if i double click MyBatchscript.bat file and can see the output in c:\testput.txt.
    Powershell: Similarly, How can i do in powershell 2.0 or higher versions?  can any one give full details with each step?
    I found some of them online, but nowhere seen clear details or examples and it not executing through cmd line (or batch script).
    example: invoke-sqlcmd -Servernameinstance Servername -inputfile "c:\test.sql" | out-File -filepath "c:\psOutput.txt"  --(call this file name MyTest.ps1)
    (The above script working if i run manually. I want to run automatic like double click (or schedule with 3rd party tool/scheduler ) in Batch file and see the output in C drive(c:\psOutput.txt))
    Can anyone Powershell experts give/suggest full details/steps for this. How to proceed? Is there any configurations required to run automatic?
    Thanks in advance.

    Testeted the following code and it's working.....thanks all.
    Execute sql script using invoke-sqlcmd with batch script and without batch script.
    Option1: using Import sqlps
    1.Save sql script as "C:\scripts\Test.sql"  script in side Test.sql: select name from sys.databases
    2.Save Batch script as "C:\scripts\MyTest.bat" Script inside Batch script:
    powershell.exe C:\scripts\mypowershell.ps1
    3.Save powershell script as "C:\scripts\mypowershell.ps1"
    import-module "sqlps" -DisableNameChecking
    invoke-sqlcmd -Servername ServerName -inputFile "C:\scripts\Test.sql" | out-File -filepath "C:\scripts\TestOutput.txt"
    4.Run the Batch script commandline or double click then can able to see the output "C:\scripts\TestOutput.txt" file.
    5.Connect to current scripts location  cd C:\scripts (enter)
    C:\scripts\dir (enter )
    C:\scripts\MyTest.bat (enter)
    Note: can able to see the output in "C:\scripts" location as file name "TestOutput.txt".
    Option2: Otherway, import sqlps and execution
    1.Save sql script as "C:\scripts\Test.sql"  script in side Test.sql: select name from sys.databases
    2.Save powershell script as "C:\scripts\mypowershell.ps1"
    # import-module "sqlps" -DisableNameChecking #...Here it not required.
    invoke-sqlcmd -Servername ServerName -inputFile "C:\scripts\Test.sql" | out-File -filepath "C:\scripts\TestOutput.txt"
    3.Connect to current scripts location
    cd C:\scripts (enter)
    C:\scripts\dir (enter )
    C:\scripts\powershell.exe sqlps C:\scripts\mypowershell.ps1 (enter)
    Note: can able to see the output in "C:\scripts" location as file name "TestOutput.txt".

  • 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

  • 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 a file using jsp or java

    hi..
    i had a jsp file as front end with start and stop button,
    if i click the start button a file on my pc should execute.
    if stop button is clicked the file should stop execution.
    Any one know how to do this..especially how to run a file in ur system using java..
    Thanks in advance

    thanks for u r quick replies...
    Actually i want to run a file on a client machine
    only...
    Okay.
    for example, a client should execute a file which is
    in another client...
    This is not the same thing as what you just said.
    can u tell me the method to execute the file......java.lang.Runtime.exec

  • 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);

  • How to execute ".exe" files using java

    Hi,
      This is guruvulu,
         I have a problem in executing ".exe" files.For Example InternetExplorer.

    Hi,
    You can execute .exe files in JAVA using the following code.
    Runtime rt1 = Runtime.getRuntime();
    Process pc = rt1.exec("someexe.exe");
    you can get the output of the executed exe file in
    in = pc.getInputStream(); //this returns a InputStream
    hope this solves your problem.
    regards,
    P.Venkat

  • How to execute SQL scripts using OWB Process flows ?

    Hi,
    I have some SQL Scripts. I have to execute them using OWB Process flows.
    Can i get any document or link which helps me in achieving this?
    Thanks in Advance,
    SriGP

    Sutirtha,
    Thank you very much. I really appreciate all of your responses.
    I have one more question ( Sorry for flooding you with lot of questions :) )
    How to capture the errors which occured inside the SQL Scripts.
    My scenario is like this. I have two sql scripts Script_1.sql and Script2.sql namely. I would like to put dependency on the execution of the scripts.
    If Script_1.sql executes succesfully without any errors, then EXECUTE Script_2.sql
    else if Script_1.sql execution contains errors then DON'T EXECUTE Script_2.sql
    As of now, i observed that the Process flow shows Success State even if there is an error in the sql script execution. Because of which i was not able to put dependency on the execution of the scripts.
    I think i can do it by tweaking(changing) the code inside the SQL Scripts, like logging the errors in some log table and reading it before the next script execution.
    But the restriction is, I Should not touch/change the existing SQL Scripts.
    Do we have any mechanism in the ProcessFlows to identify the SQL Errors that occurred during execution of SQL Scripts ?
    Please suggest any idea on this. It will be great if you can help in this.
    Thanks in advance,
    SriGP.

  • How to execute Bat Files using Jobs?

    Hello, can anyone help me?
    I have created a job like this, but it's not working:
    begin
    dbms_scheduler.create_job(
    job_name => 'job_test'
    ,job_type => 'EXECUTABLE'
    ,job_action => 'C:/temp/test.bat'
    ,start_date => '01/DEC/2006 08:30 AM'
    ,repeat_interval => 'FREQ=DAILY'
    ,enabled => TRUE
    ,comments => 'Demo for job schedule.');
    end;
    begin
    DBMS_SCHEDULER.run_job (job_name => 'job_test',use_current_session => false);
    end;
    Thx!

    Hi,
    This will not work because a batch file is not directly executable. It is executed using cmd.exe .
    So what you need to do is to set c:\windows\...\cmd.exe as the job_action and then as your arguments set
    /q
    /c
    c:\test.bat
    then enable the job. This should work.
    Also make sure the job scheduler service is setup and started (it needs to be started for external jobs to run).
    There is an example given by scotttig in this thread
    Re: dbms_scheduler
    Hope this helps,
    Ravi.

  • Please Suggest...How to execute SQL quiries in JDeveloper using BPEL????

    Hi All,
    I am very new user of Oracle JDeveloper and BPEL. I am trying to develop a process flow in JDeveloper using BPEL and get stuck when I was trying to execute a SQL quiry in the flow.
    How to execute SQL quiries using JDeveloper and BPEL?????????????
    Possibilities might be..
    1.Configring Database Adapter
    2.Using Java Embedded activities of BPEL
    However, any of the above mentioned way is not clear with me how to implement it to get the query run in the process flow.
    It will be great if anyone could help me with this concept....
    Thanks in advance
    -Prabha
    Edited by: user10259700 on Sep 15, 2008 3:48 AM

    Hi,
    though BPEL has its development environment in JDeveloper, it has its own forum
    BPEL
    Frank

  • How to execute SQL Quiries in BPEL using JDeveloper

    Hi All,
    I am very new user of Oracle JDeveloper and BPEL. I am trying to develop a process flow in JDeveloper using BPEL and get stuck when I was trying to execute a SQL quiry in the flow.
    How to execute SQL quiries using JDeveloper and BPEL?????????????
    Possibilities might be..
    1.Configring Database Adapter
    2.Using Java Embedded activities of BPEL
    However, any of the above mentioned way is not clear with me how to implement it to get the query run in the process flow.
    It will be great if anyone could hepl me with this concept....
    Thanks in advance
    -Prabha

    ... or perhaps just scan the last 5 posts before you post a new thread, in which case, you'd discover that someone else already asked Help needed in executing SQL query... and got the same answer

  • How to write a file using mod pl/sql

    hi,
    i am having a submit button in my procedure. which should inturn create .sql file in a file path.
    is there any way to create a fileusing htp and htf methods.
    Thanks in advance
    Hari

    >
    i am having a submit button in my procedure. which should in turn create .sql file in a file path.
    is there any way to create a file using htp and htf methods.
    >
    Why are you wasting your time coding from scratch using the PL/SQL Web Toolkit instead of the APEX framework?
    From Re: how to write a file using mod pl/sql it appears that you are not using APEX, so a number of the approaches APEX offers are not relevant. You appear to be looking for a file download solution using the <tt>wpg_docload.download_file</tt> method, such as:
    create or replace procedure download_file (
        p_filename  in     varchar2
      , p_mimetype  in     varchar2
      , p_content   in out nocopy blob)
    is
    begin
      -- Set up HTTP header.
      -- Use "application/octet" as default MIME type.
      owa_util.mime_header(nvl(p_mimetype, 'application/octet'), false);
      -- Set the size so the browser knows how much to download.
      htp.p('Content-length: ' || dbms_lob.getlength(p_content));
      -- Filename will be used as default by the browser in "Save as..."
      htp.p('Content-Disposition: attachment; filename="' || p_filename || '"');
      -- Close header.
      owa_util.http_header_close();
      -- Stream the file content to the browser.
      wpg_docload.download_file(p_content);
    end download_file;

Maybe you are looking for