SQL*Loader with Stored Procedure slow

I have a situation where if SQL*Loader is running then stored procedures returning cursors are excruciatingly slow (about 3 minutes) if the same stored procedure is run via SQL statements it runs fine. The stored procedures also run fine if SQL*Loader is not running. Has anyone seen this before, any thoughts?
Thanks,
ed

My query was:
SELECT *
FROM scheme.table@as400 a
WHERE a.vlvalr = to_char(p_vlvalr)
and a.vlvals = to_char(p_vlvals);
Without the to_char! When I add the to_char, the problem is solved!

Similar Messages

  • Calling SQL * LOADER  in stored procedure

    Hi Experts,
    Can we call sql*loader in stored procedures? . If yes , please let me know the syntax.
    Any help will be highly appreciated.
    Thanks.

    You can also use dbms_schedular to execute any shell or batch file - i guess ->
    BEGIN
      -- UNIX
      DBMS_SCHEDULER.create_job(
        job_name             => 'unix_command_job',
        job_type             => 'EXECUTABLE',
        number_of_arguments  => 1,
        job_action           => '/bin/ls',
        auto_drop            => FALSE,
        enabled              => FALSE);
      DBMS_SCHEDULER.set_job_argument_value('unix_command_job',1,'/tmp');
      DBMS_SCHEDULER.set_attribute('unix_command_job', 'credential_name', 'TIM_HALL_CREDENTIAL');
      DBMS_SCHEDULER.set_attribute('unix_command_job', 'destination', 'marge.localdomain:65001');
      DBMS_SCHEDULER.enable('unix_command_job');
    END;For details ->
    http://www.oracle-base.com/articles/11g/SchedulerEnhancements_11gR1.php
    http://www.oradev.com/dbms_scheduler.jsp
    http://www.psoug.org/reference/dbms_scheduler.html
    Regards.
    Satyaki De.

  • Launch the SQL*Loader From Stored Procedure???

    Is it possible to aaunch the SQL*Loader from a stored procedure? Please help!

    Try the documentation on external procedures

  • 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.

  • Requirements of SQL Server 2005 Stored Procedures to Develop Crystal Report

    Hi All,
       I want to learn how to create crystal report off of SQL Server 2005 Stored Procedure. So anybody please let me know from where I can download the documentation on "Requirements of SQL Server 2005 Stored Procedures for crystal report.
      I am using Crystal Report XI. Any help is greatly appreciated.
    Thank You.

    Hello,
    When CR uses Stored Porcedures we only look at the last SELECT statement. We can't use TMP tables because they are owned by the system and not the user. Even though you created them under your logon credentials you are not the actual owner. Or so I have found so far.... CR does not have permissions to get to those temp tables. If you can find out dynamically what the table names are called then it may work. I don't have a sample but it has the usual table info with a random GUID or temp name, really long, and changes every time.
    What should work is create a real table, not one of MS's tempTables and then push all your data to that table and then the last select statement returns all of your data from that temp table:
    SELECT * FROM MYTEMPTABLE.DBO.TABLE.
    Then CR should ahve no issues.
    It may be that the JDBC driver has problems. Test it using OLE DB or ODBC.
    Thanks again
    Don

  • Problem With Stored Procedure

    Post Author: Ranjith.403
    CA Forum: General
    Hi,
    Am new to crystal reports with stored procedures
    am created a report using a stored procedure in oracle. In that Stored Procedure am Using a temporary table.
    After inserting values into the table am assigning to ref cursor.
    Refcursor having fields like item,onhandstock,purchase rate
    This report working fine in oracle version 9.2.0.1.0 where comes to oracle version 9.2.0.8.0 it's giving the varchar values correctly.
    The Number values are showing as 0.
    Help me to solve it.
    Thanks in Advance,
    Ranjith

    Try modularising this large procedure into smaller procedures and functions, and determine which part is causing you trouble.

  • MS SQL Server system stored procedures can't be migrated into Oracle 11g

    During database migration from MS SQL Server 2008 to Oracle 11g R2, if the application stored procedure invokes the MS SQL Server system stored procedures (for example: sp_getapplock, sp_releaseapplock ....), these SQL server system stored procedures can't be transferred. See following migrated Oracle application stored procedure for example:
    create or replace
    PROCEDURE spPwSysID_GetNextID
    v_ID OUT NUMBER,
    iv_SysType IN NVARCHAR2 DEFAULT NULL ,
    iv_Cnt IN NUMBER DEFAULT NULL
    AS
    v_SysType NVARCHAR2(50) := iv_SysType;
    v_Cnt NUMBER(10,0) := iv_Cnt;
    v_result NUMBER(10,0);
    BEGIN
    --SQL Server BEGIN TRANSACTION;
    utils.incrementTrancount;
    v_Systype := UPPER(v_Systype) ;
    IF v_Cnt < 1 THEN
    v_Cnt := 1 ;
    END IF;
    v_result :=sp_getapplock(v_Resource => v_Systype,
    v_LockMode => 'Exclusive') ;
    IF v_result >= 0 THEN
    BEGIN
    SELECT ID
    INTO v_ID
    FROM PWSYSID
    WHERE SysType = v_SysType;
    IF SQL%ROWCOUNT = 1 THEN
    UPDATE PwSysID
    SET ID = ID + v_cnt
    WHERE SysType = v_SysType;
    ELSE
    BEGIN
    INSERT INTO PwSysID
    ( ID, SysType )
    VALUES ( v_cnt + 1, v_SysType );
    v_ID := 1 ;
    END;
    END IF;
    v_result :=sp_releaseapplock(v_Resource => v_Systype) ;
    END;
    ELSE
    BEGIN
    raise_application_error( -20002, 'Lock failed to acquire to generate Cityworks Id.' );
    END;
    END IF;
    utils.commit_transaction;
    END;

    During database migration from MS SQL Server 2008 to Oracle 11g R2, if the application stored procedure invokes the MS SQL Server system stored procedures (for example: sp_getapplock, sp_releaseapplock ....), these SQL server system stored procedures can't be transferred. See following migrated Oracle application stored procedure for example:
    create or replace
    PROCEDURE spPwSysID_GetNextID
    v_ID OUT NUMBER,
    iv_SysType IN NVARCHAR2 DEFAULT NULL ,
    iv_Cnt IN NUMBER DEFAULT NULL
    AS
    v_SysType NVARCHAR2(50) := iv_SysType;
    v_Cnt NUMBER(10,0) := iv_Cnt;
    v_result NUMBER(10,0);
    BEGIN
    --SQL Server BEGIN TRANSACTION;
    utils.incrementTrancount;
    v_Systype := UPPER(v_Systype) ;
    IF v_Cnt < 1 THEN
    v_Cnt := 1 ;
    END IF;
    v_result :=sp_getapplock(v_Resource => v_Systype,
    v_LockMode => 'Exclusive') ;
    IF v_result >= 0 THEN
    BEGIN
    SELECT ID
    INTO v_ID
    FROM PWSYSID
    WHERE SysType = v_SysType;
    IF SQL%ROWCOUNT = 1 THEN
    UPDATE PwSysID
    SET ID = ID + v_cnt
    WHERE SysType = v_SysType;
    ELSE
    BEGIN
    INSERT INTO PwSysID
    ( ID, SysType )
    VALUES ( v_cnt + 1, v_SysType );
    v_ID := 1 ;
    END;
    END IF;
    v_result :=sp_releaseapplock(v_Resource => v_Systype) ;
    END;
    ELSE
    BEGIN
    raise_application_error( -20002, 'Lock failed to acquire to generate Cityworks Id.' );
    END;
    END IF;
    utils.commit_transaction;
    END;

  • BI Publisher 11g - calling SQL Server 2005 stored procedure error

    Hi experts
    I have been calling succesfully an SQL server 2005 stored procedure for the data model of a BI publisher report in 10g, passing it a customerNo parameter.
    EXEC     [dbo].[usp_WelcomeLettersConsumerNo]
              @CustomerNo = :sCustomerNo
    However it does not work in 11g I get the error:
    [Hyperion][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'is'.
    which is frustrating as there is no 'is' in the statement (perhaps it is picking up :s?) - I wonder does anyone know if there has been a change in 11g that may be causing this?
    cheers
    Tim

    Hi experts
    I have been calling succesfully an SQL server 2005 stored procedure for the data model of a BI publisher report in 10g, passing it a customerNo parameter.
    EXEC     [dbo].[usp_WelcomeLettersConsumerNo]
              @CustomerNo = :sCustomerNo
    However it does not work in 11g I get the error:
    [Hyperion][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'is'.
    which is frustrating as there is no 'is' in the statement (perhaps it is picking up :s?) - I wonder does anyone know if there has been a change in 11g that may be causing this?
    cheers
    Tim

  • Problem using SQL Loader with ODI

    Hi,
    I am having problems using SQL Loader with ODI. I am trying to fill an oracle table with data from a txt file. At first I had used "File to SQL" LKM, but due to the size of the source txt file (700MB), I decided to use "File to Oracle (SQLLDR)" LKM.
    The error that appears in myFile.txt.log is: "SQL*Loader-101: Invalid argument for username/password"
    I think that the problem could be in the definition of the data server (Physical architecutre in topology), because I have left blank Host, user and password.
    Is this the problem? What host and user should I use? With "File to SQL" works fine living this blank, but takes to much time.
    Thanks in advance

    I tried to use your code, but I couldn´t make it work (I don´t know Jython). I think the problem could be with the use of quotes
    Here is what I wrote:
    import os
    retVal = os.system(r'sqlldr control=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.ctl log=E:\Public\TXTODI\PROFITA2/Profita2Final.txt.log userid=MYUSER/myPassword @ mySID')
    if retVal == 1 or retVal > 2:
    raise 'SQLLDR failed. Please check the for details '
    And the error message is:
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 5, in ?
    SQLLDR failed. Please check the for details
         at org.apache.bsf.engines.jython.JythonEngine.exec(JythonEngine.java:146)
         at com.sunopsis.dwg.codeinterpretor.k.a(k.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.scripting(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execScriptingOrders(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSqlC.treatTaskTrt(SnpSessTaskSqlC.java)
         at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
         at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
         at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
         at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
         at com.sunopsis.dwg.cmd.e.i(e.java)
         at com.sunopsis.dwg.cmd.h.y(h.java)
         at com.sunopsis.dwg.cmd.e.run(e.java)
         at java.lang.Thread.run(Unknown Source)

  • Sql Loader with TSN environment variable.

    Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
    What are the different ways I can use sql ldr ???

    952189 wrote:
    Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
    What are the different ways I can use sql ldr ???
    >Sql loader command works fine if I have TSN entry in my system,Can I use SQL Loader with in any other way ie by use of some environment variable???
    What are the different ways I can use sql ldr ???
    if sqlldr is run on DB Server system, then no tnsnames.ora file is required.

  • What is the data dictionary that stores the SQL text of stored procedures?

    I am handling both Oracle 8i on IBM AIX 5L and Oracle9i on SUN Soliars 8 /9.
    What is/are the data dictionary tables, or v$ views that store the SQL text of stored procedured and triggers?
    Thank you in advance!

    If the procedures are not wrapped, you can view them in the dba/all/user_source view. Trigger bodies can be seen in dba/all/user_triggers view.
    Message was edited by:
    Daniel Fink

  • Returning SQL cursor from Stored Procedure

    Hi,
    I have a query regarding returning sql cursor from stored procedure to java in oracle 11g.
    I want to query some data ex: my query returns A, B, C. Also, now I want to query some other data ex: D, E, F. Now I want to return this data as an sql cursor as a single row . Example: A,B,C,D,E,F. Is it possible to return/create a cursor in stored procedure?
    assume both query returns equal number of rows.. however both are not related to each other..

    RP wrote:
    Hi,
    I have a query regarding returning sql cursor from stored procedure to java in oracle 11g.
    I want to query some data ex: my query returns A, B, C. Also, now I want to query some other data ex: D, E, F. Now I want to return this data as an sql cursor as a single row . Example: A,B,C,D,E,F. Is it possible to return/create a cursor in stored procedure?
    assume both query returns equal number of rows.. however both are not related to each other..It sounds like what you need is a ref cursor.
    First thing to remember though is that cursors do not hold any data (see: {thread:id=886365})
    In it's simplest form you would be creating a procedure along these lines...
    SQL> create or replace procedure get_data(p_sql in varchar2, p_rc out sys_refcursor) is
      2  begin
      3    open p_rc for p_sql;
      4  end;
      5  /
    Procedure created.
    SQL> var rc refcursor;
    SQL> exec get_data('select empno, ename, deptno from emp', :rc);
    PL/SQL procedure successfully completed.
    SQL> print rc;
         EMPNO ENAME          DEPTNO
          7369 SMITH              20
          7499 ALLEN              30
          7521 WARD               30
          7566 JONES              20
          7654 MARTIN             30
          7698 BLAKE              30
          7782 CLARK              10
          7788 SCOTT              20
          7839 KING               10
          7844 TURNER             30
          7876 ADAMS              20
          7900 JAMES              30
          7902 FORD               20
          7934 MILLER             10
    14 rows selected.
    SQL> exec get_data('select deptno, dname from dept', :rc);
    PL/SQL procedure successfully completed.
    SQL> print rc
        DEPTNO DNAME
            10 ACCOUNTING
            20 RESEARCH
            30 SALES
            40 OPERATIONS
            50 IT SUPPORTWhich takes an SQL statement (as you said that both your queries were unrelated), and returns a ref cursor, and then your Java code would fetch the data using that cursor.
    Now, as for getting your rows to columns and combining two queries that do that... something along these lines...
    SQL> select * from x;
    C
    A
    B
    C
    SQL> select * from y;
    C
    D
    E
    F
    SQL> ed
    Wrote file afiedt.buf
      1  select x.col1, x.col2, x.col3
      2        ,y.col1 as col4
      3        ,y.col2 as col5
      4        ,y.col3 as col6
      5  from (
      6        select max(decode(rn,1,col1)) as col1
      7              ,max(decode(rn,2,col1)) as col2
      8              ,max(decode(rn,3,col1)) as col3
      9        from (select col1, rownum rn from (select * from x order by col1))
    10       ) x
    11  cross join
    12       (
    13        select max(decode(rn,1,col1)) as col1
    14              ,max(decode(rn,2,col1)) as col2
    15              ,max(decode(rn,3,col1)) as col3
    16        from (select col1, rownum rn from (select * from y order by col1))
    17*      ) y
    SQL> /
    C C C C C C
    A B C D E F... will do what you ask. For further information about turning rows to columns read the FAQ: {message:id=9360005}

  • How to use SQL loader with DBF fixed format record

    Hi everybody!
    My situation is that: I want to use SQL loader with Foxpro DBF format, it similar to case 2 study (Fixed format record) but DBF file has header, how can I tell SQL loader skip header.
    Thank you in advance

    Another option is to apply SQL operators to fields
    LOAD DATA
       INFILE *
       APPEND
    INTO TABLE emp
    FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' (
       empno,
       ename,
       job,
       mgr,
       hiredate DATE(20) "DD-Month-YYYY",
       sal,
       comm,
       deptno CHAR TERMINATED BY ':',
       projno,
    loadseq "my_seq.nextval")This is a modified control file of Case Study 3 which originally demonstrated the use of the Sequence parameter

  • Using SQL Loader in a procedure

    Can we use SQL Loader in a stored procedure to load data in an Excel file into the database? If so, how. Also, how can it create a log file to save records that have not been loaded.

    You can..Try this out..
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "Host" AS
    import java.io.*;
    public class Host {
    public static void executeCommand(String command) {
    try {
    String[] finalCommand;
    finalCommand = new String[4];
    finalCommand[0] = "C:\\windows\\system32\\cmd.exe";
    finalCommand[1] = "/y";
    finalCommand[2] = "/c";
    finalCommand[3] = command;
    final Process pr = Runtime.getRuntime().exec(finalCommand);
    new Thread(new Runnable() {
    public void run() {
    try {
    BufferedReader br_in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
    String buff = null;
    while ((buff = br_in.readLine()) != null) {
    System.out.println("Process out :" + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    catch (IOException ioe) {
    System.out.println("Exception caught printing process output.");
    ioe.printStackTrace();
    }).start();
    new Thread(new Runnable() {
    public void run() {
    try {
    BufferedReader br_err = new BufferedReader(new InputStreamReader(pr.getErrorStream()));
    String buff = null;
    while ((buff = br_err.readLine()) != null) {
    System.out.println("Process err :" + buff);
    try {Thread.sleep(100); } catch(Exception e) {}
    catch (IOException ioe) {
    System.out.println("Exception caught printing process error.");
    ioe.printStackTrace();
    }).start();
    catch (Exception ex) {
    System.out.println(ex.getLocalizedMessage());
    public static boolean isWindows() {
    if (System.getProperty("os.name").toLowerCase().indexOf("windows") != -1)
    return true;
    else
    return false;
    show errors java source "Host"
    And now create an Oracle wrapper
    SQL>
    CREATE OR REPLACE PROCEDURE Host_Command (p_command IN VARCHAR2)
    AS LANGUAGE JAVA
    NAME 'Host.executeCommand (java.lang.String)';
    Procedure created.
    Now invoke the procedure with an operating system command
    BEGIN
    Host_Command (p_command => 'sqlldr system/tiburon@"(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=ICCW3053)(Port\=1521)))(CONNECT_DATA\=(SERVICE_NAME\=orcl)))" control=C:\anupama\emp_join.ctl log=C:\anupama\emp_join.log');
    END;
    /Let me know if it works\encounter any troubles.
    Good luck!!!
    Bhagat

  • Dynamic SQL and Oracle stored procedures

    Does anybody has any experience with invoking an Oracle stored procedures
    with output parameters, using dynamic SQL from Forte?
    Thanks,
    Dimitar

    I would be interested. We are currently using a homegrown DataMapper architecture with the Microsoft OracleClient. I would like to move to ODP.Net once a production version supporting ADO.Net 2.0 is available. After that, I would then like to look at using an off the shelf persistence framework such as EntitySpaces, NHibernate or IdeaBlade's DevForce.

Maybe you are looking for

  • Using iPhoto with Bibble RAW converter

    Hi all! I would like to use Bibble and iPhoto combination to edit and manage my photos. What could be the ideal workflow for this? Should I import RAW pics from card reader to iPhoto and then open them in Bibble for RAW conversion or how to do this?

  • Photoshop Creative Cloud = license for Photoshop CS6 ?

    Hello, Can I get a free license number for Photoshop CS6 when I am a Photoshop Creative Cloud subscriber ? Because I need CS6 to work under OSX 10.6.8 Thank you, Philippe

  • Passing filter to LUMIRA

    Hi guys, after building an own xs app, where I´m analyzing SAP HANA Calculation Views, I want to consume those views with LUMIRA 1.19. I´m pre-filtering the View within my app before I open the view within Lumira. So the problem is to pass these filt

  • Double Clicking does not work

    Hello, I am trying to help a friend out here with her mac, for some reason when she double clicks on a file or anything including the hard drive icon it will not open. I have never seen this before. What could it possibly be? any help would be much a

  • WCF-Custom oracleBinding problem

    Hello to all,  I have a problem with WCF-Custom. I created two receive ports and two receive locations but both have the same endpoint (oracle db) and I get the following error:  Adress 'oracledb :/ / / test' is Already present for Receive Location '