Using Native Query to run a SQL statement, the "getResultList" throws excep

I run the following code and I get an exception, can someone tell me what I'm doing wrong? I tried debugging, but as soon as I try even stepping into the "getResultList" line, it throws the exception.
public void setData(EntityManager emgr) {
System.err.println(m_sqlStatement);
Query q = emgr.createNativeQuery(m_sqlStatement);
@SuppressWarnings("unchecked")
List<List<Object>> c = q.getResultList();
for (List<Object> d : c) {
if (d == null || d.isEmpty()) {
continue;
addRow(d.toArray());
}I took this sql statement and created a test view and ran it against my database and I get the data that I want the way that I want it. So, I feel pretty confident that the problem is not with my sql statement.
m_sqlStatement =
SELECT TimeSubmitted AS "Time Completed", ActivityName AS "Activity", PN AS "Part Number", OpNum AS "Op Num", isConforming AS "Conforming?", SetupHrs AS "Expected Setup Time (Hrs.)", RunHrs AS "Expected Run Time (Hrs.)" FROM CellManager INNER JOIN Routings ON Routings.ID=CellManager.RoutingsRef INNER JOIN PNTable ON PNTable.ID=Routings.PNRef INNER JOIN ActivityType ON ActivityType.ID=CellManager.ActivityTypeRef INNER JOIN Activity ON Activity.CellManagerRef=CellManager.ID WHERE CellManager.OperatorLogRef=15 Order BY TimeSubmitted
Exception thrown:
SEVERE: Application class productionefficiencyviewergui.ProductionEfficiencyViewerGUIApp failed to launch
Local Exception Stack:
Exception [TOPLINK-6132] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.QueryException
Exception Description: Query argument " not found in list of parameters provided during query execution.
Query: DataReadQuery(){code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

I run the following code and I get an exception, can someone tell me what I'm doing wrong? I tried debugging, but as soon as I try even stepping into the "getResultList" line, it throws the exception.
public void setData(EntityManager emgr) {
System.err.println(m_sqlStatement);
Query q = emgr.createNativeQuery(m_sqlStatement);
@SuppressWarnings("unchecked")
List<List<Object>> c = q.getResultList();
for (List<Object> d : c) {
if (d == null || d.isEmpty()) {
continue;
addRow(d.toArray());
}I took this sql statement and created a test view and ran it against my database and I get the data that I want the way that I want it. So, I feel pretty confident that the problem is not with my sql statement.
m_sqlStatement =
SELECT TimeSubmitted AS "Time Completed", ActivityName AS "Activity", PN AS "Part Number", OpNum AS "Op Num", isConforming AS "Conforming?", SetupHrs AS "Expected Setup Time (Hrs.)", RunHrs AS "Expected Run Time (Hrs.)" FROM CellManager INNER JOIN Routings ON Routings.ID=CellManager.RoutingsRef INNER JOIN PNTable ON PNTable.ID=Routings.PNRef INNER JOIN ActivityType ON ActivityType.ID=CellManager.ActivityTypeRef INNER JOIN Activity ON Activity.CellManagerRef=CellManager.ID WHERE CellManager.OperatorLogRef=15 Order BY TimeSubmitted
Exception thrown:
SEVERE: Application class productionefficiencyviewergui.ProductionEfficiencyViewerGUIApp failed to launch
Local Exception Stack:
Exception [TOPLINK-6132] (Oracle TopLink Essentials - 2.0.1 (Build b09d-fcs (12/06/2007))): oracle.toplink.essentials.exceptions.QueryException
Exception Description: Query argument " not found in list of parameters provided during query execution.
Query: DataReadQuery(){code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to use a Sybase table in Oracle SQL statement?

    How to use a Sybase table in Oracle SQL statement?
    Sybase version : 11.9.2.4
    Oracle version : 10.2.05
    Thanks.

    user12088323 wrote:
    How to use a Sybase table in Oracle SQL statement?
    Sybase version : 11.9.2.4
    Oracle version : 10.2.05
    Thanks.Any Oracle client connected to the Oracle database can access Sybase data through the <font style="background-color: #FFFFCC">Database Gateway for Sybase</font> (it requires an additional license) or the <font style="background-color: #FFFFCC">Database gateway for ODBC</font> (it's free).
    The Oracle client and the Oracle database can reside on different machines. The gateway accepts connections only from the Oracle database.
    A connection to the gateway is established through a database link when it is first used in an Oracle session. In this context, a connection refers to the connection between the Oracle database and the gateway. The connection remains established until the Oracle session ends. Another session or user can access the same database link and get a distinct connection to the gateway and Sybase database.
    Database links are active for the duration of a gateway session. If you want to close a database link during a session, you can do so with the ALTER SESSION statement.
    To access the Sybase server, you must create a <font style="background-color: #FFFFCC">database link</font>. A public database link is the most common of database links.
    SQL> CREATE PUBLIC DATABASE LINK dblink CONNECT TO
    2  "user" IDENTIFIED BY "password" USING 'tns_name_entry';
    --dblink is the complete database link name.
    --tns_name_entry specifies the Oracle Net connect descriptor specified in the tnsnames.ora file that identifies the gatewayAfter the database link is created you can verify the connection to the Sybase database, as follows:
    SQL> SELECT * FROM DUAL@dblink;
    Configuring Oracle Database Gateway for Sybase
    <font style="background-color: #FFFFCC">{message:id=10649126}</font>

  • In a SQL statement, the SELECT clause is used to

    In a SQL statement, the SELECT clause is used to select
    (a) columns
    (b) rows
    (c) tables
    (d) none of the above
    can any one help Immediately

    Is used to select rows of specified column...
    SELECT column_name(s) FROM table_name

  • JPA  using native query - distinct

    Hi All,
    Kindly suggest on the following,
    I am facing issues on using the distinct keyword in JPA, Ful details on the following OTN thread.
    JPA  using native query - distinct
    Any help is much appreciated
    VR

    Any ideas ?

  • Query to return all SQL statements ran for a particular user.

    Good Morning,
    Is it possible to find all the SQL statements run for a particular user using the v$ views? I can do it it 10g however I am currently using 9i and the query below does not work.
    select a.username,a.logon_time,b.sql_fulltext
    from v$session a,v$sqlarea b
    where a.sql_id=b.sql_id
    and a.username='USER'
    order by a.logon_time descI assume some columns in these views do not exist in 9i. The release of 9 I am using is 9.2.0.1.0.
    You help is much appreciated.
    Thanks,
    Mark.

    Dear Mark!
    I suggest you to use auditing instead of v$sqlarea. Oracle Onlinedocumentation says the following about v$sqlarea:
    >
    V$SQLAREA lists statistics on shared SQL area and contains one row per SQL string. It provides statistics on SQL statements that are in memory, parsed, and ready for execution.
    >
    That means that you'll get only those SQL-Statements that are currently in memory. Older statements which are already deleted from memory are not visible for your query.
    By the way if you simply want to know what is wrong with your query then please post your errormessage.
    Yours sincerely
    Florian W.
    Edited by: Florian W. on 29.07.2009 12:03

  • Using a number variable in an SQL statement

    Hi,
    I am trying to use a variable in an sql statement and I have run into problems when the variable is a number. The following line of code works if the variable is a string but not if it is a number.
    "SELECT TOP 1 UUT_STATUS FROM UNIT_UUT_RESULT WHERE UnitID =  '" + Locals.LocalUnitID + "' ORDER BY START_DATE_TIME DESC"
    Is there a difference in the use of the single and double quotes and the + sign for number variables?
    Thanks
    Stuart
    Solved!
    Go to Solution.

    Hi Stuart,
    I am assuming that the UnitID is stored as a numeric in the database? If so, the proper SQL syntax for comparing with numerics should not use a single quote (or any quotes for that matter). The quotes are used only for strings.
    So you would want to use:
    "SELECT TOP 1 UUT_STATUS FROM UNIT_UUT_RESULT WHERE UnitID =  " + Locals.LocalUnitID + " ORDER BY START_DATE_TIME DESC"
    This is really more of an SQL question universal to all languages, not just TestStand.
    Here is an excellent resource that you can consult:
    http://www.w3schools.com/sql/sql_where.asp
    Jervin Justin
    NI TestStand Product Manager

  • Run second sql statement only if first sql statement is null.

    Hey guys I seem to have a mental block here. I have two sql statements. I would like the second to run only if the first sql statement is null.I know i can potentially use PLsql but would really like to see if i can do this with straight up sql. Your responses are very very appreciated.
    here is the first sql
      Select     ft.fund_code,
                 ft.orgn_code,
                 ft.acct_code,
                 ft.amount,
                 fb.owner_pidm,
                 ft.prog_code     
          from ftrbremb fb , ftcractg ft
          where fb.doc_code = 'TR000038'
          and fb.ftpbport_id = ft.ftpbport_idsecond sql statement
         Select ft.fund_code,
                 ft.orgn_code,
                 ft.acct_code,
                 ft.amount,
                 fb.owner_pidm,
                 ft.prog_code     
          from ftrbremb fb , ftcractg ft, ftprexps fx
          where fb.doc_code = 'TR000038'
          --and fb.ftpbport_id = ft.ftpbport_id
          and fx.ftrbremb_id = fb.id
          and ft.ftprexps_id = fx.id;How can i combine these two statements together so that when the first one is null the second one runs. As a bonus i like to get just the first row as well.
    Any help would greatly appreciated. I tried to accomplish with case statement but it just dosent seem to be working for me.
    Thanks

    select ft.fund_code, ft.orgn_code, ft.acct_code, ft.amount, fb.owner_pidm, ft.prog_code
      from ftrbremb fb, ftcractg ft
    where fb.doc_code = 'TR000038'
       and fb.ftpbport_id = ft.ftpbport_id
    union all
    select ft.fund_code, ft.orgn_code, ft.acct_code, ft.amount, fb.owner_pidm, ft.prog_code
      from ftrbremb fb, ftcractg ft, ftprexps fx
    where fb.doc_code = 'TR000038'
       --and fb.ftpbport_id = ft.ftpbport_id
       and fx.ftrbremb_id = fb.id
       and ft.ftprexps_id = fx.id
       and not exists
             (select null
                from ftrbremb fb, ftcractg ft
               where fb.doc_code = 'TR000038'
                 and fb.ftpbport_id = ft.ftpbport_id)

  • USING MULTIPLE SELECT VARIABLE IN A SQL STATEMENT

    In HTMLDB, the value of the parameter of a multiple select box is colon delimited(ie P6_Name = Smith:Jones:Burke). Is there an easy way to use this parameter in a SQL statement?
    Example
    Select *
    from names
    where
    Name=P6_Name
    Select *
    from names
    where
    Name IN ('Smith','Jones','Burke')
    Thank you

    Thank you for your response! I'm an idiot. It didn't make sense to me because your talking about a <i>multi-select</i> variable and I was thinking about a <i>select-list</i> variable. My problem is that I need to assign a list of values to one select list item.
    <br>
    For example:
    <br>
    SELECT * FROM EMPLOYEE
    WHERE EMPLOYEE_TYPE IN ( :SELECT_LIST_RETURN_VALUE );
    <br><br>
    With the select list as
    <br><br>
    Display value = All Types, Some Types, One Specific Type<br>
    Return Value = (Type1, type2, type3), (type1, type2), (type3)
    <br><br>
    I've just started in all of this so I'd imagine that I'm probably going about it wrong.

  • How to run a SQL statement which is stored inside an SQL Table

    Hello,
    If anyone please help me with the following problem I would be forever grateful
    I have an SQL statement which is stored inside a certain SQL table, I want to use that SQL statement inside my PL/SQL procedure.
    Was thinking of a simple solution of obtaining the SQL statement into an array and then execute it, yet how could I do so exactly with PL/SQL? I've only started playing around with PL/SQL in the last few days.
    Thanks in advance!
    This is how it looks like more or less:
    Displaying result for:
    SELECT TRIM(OBJ_VALU_TXT)
    FROM   OBJ_VALU_DOC
    WHERE  OBJECT_TYPE  = 'FLD'
      AND  OBJECT_CODE  = 15443
      AND  OBJ_VALU_CD  = 'ACR'
    ORDER BYDOC_SEQ_NO
    00001                                                            
    SELECT
    VALUE(MAX(RECEIPT_NO) + 1, :OUT-COMP-FACTOR)
    FROM RECEIPT
    WHERE (RECEIPT_NO BETWEEN
    :OUT-COMP-FACTOR AND :OUT-TO-NUMBER) OR
    (RECEIPT_NO > :OUT-COMP-FACTOR AND
    :OUT-TO-NUMBER = 0)

    Here's a demo of your requirement.
    create table t ( col1 varchar2(200));
    table created
    insert into t values('select * from dual');
    1 row inserted
    declare
    v_col varchar2(200);
    v_val varchar2(200);
    begin
    select col1 into v_col from t;
    execute immediate v_col into v_val;
    dbms_output.put_line(v_val);
    end;
    X
    Using into clause, you can use as many variables as required. But the basic approach reamins the same.
    But storing SQL in DB is not an efficient design.
    Ishan

  • How to run a sql statement with bind variable in a test environment

    Hello,
    I have a sql statement in prod that I like to run in test. I got the sql statement from statspack, but the statement has bind variables. How do I get this statement to run in test? Thank you.

    Hi,
    If you have the SQL statement and all the referenced objects are available in your test env then what is the problem to run it?
    If I am not wront to get your reqmnt...
    i.e
    SQL> select * from emp
    where emp_no = &empno
    and dept_code = &deptcode;
    Thanks

  • Running multiple SQL statements from DBMS_SCHEDULER

    DB Version : 10.2.0.4
    After refering the following document, i am trying to create a job which will run 2 SQLs ; An INSERT and an UPDATE as shown below.
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/jobtosched.htm#i1018602
    create table xyz (empid  number,empname varchar2(35),cre_dt date);
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB(
       job_name          =>  'job32',
       job_type          =>  'PLSQL_BLOCK',
       job_action        =>  'INSERT INTO XYZ VALUES (7935, ''SALLY'',SYSDATE),'UPDATE MANU.XYZ SET EMPID = 33';
       start_date        =>  SYSDATE,
       repeat_interval   =>  'FREQ = DAILY; INTERVAL = 1');
    END;
    /But i am getting errors like below, when i try to create the above job.
    ORA-01756: quoted string not properly terminated
    PLS-00103: Encountered the symbol ";" when expecting one of the following:

    You need to enclose those statements in an anonymous PL/SQL block
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB(
       job_name          =>  'job32',
       job_type          =>  'PLSQL_BLOCK',
       job_action        =>  'BEGIN INSERT INTO XYZ VALUES (7935, ''SALLY'',SYSDATE); UPDATE MANU.XYZ SET EMPID = 33; END;'
       start_date        =>  SYSDATE,
       repeat_interval   =>  'FREQ = DAILY; INTERVAL = 1');
    END;
    /

  • Query not running in sql developer, neither connecting to database. Following error - java.util.UnknownFormatConversionException: Conversion = '0'. Please reply soon.

    when i try to connect to oracle 11g rdbms, following error occurs -->
    1. sql developer version - 4.0.3.16 (jdk - jdk1.7.0_51 externally installed) -- newly installed, giving following error when try to connect to oracle 11g rdbms.
    2. sql developer version - 3.1.07.42 (jre1.6.0 included) -- used to run earlier.
    java.util.UnknownFormatConversionException: Conversion = '0'
      at java.util.Formatter.checkText(Formatter.java:2547)
      at java.util.Formatter.parse(Formatter.java:2533)
      at java.util.Formatter.format(Formatter.java:2469)
      at java.util.Formatter.format(Formatter.java:2423)
      at java.lang.String.format(String.java:2797)
      at oracle.dbtools.raptor.backgroundTask.internal.SimpleRaptorTaskUI.getFormattedTime(SimpleRaptorTaskUI.java:288)
      at oracle.dbtools.raptor.backgroundTask.internal.RaptorTaskUI.setState(RaptorTaskUI.java:43)
      at oracle.dbtools.raptor.backgroundTask.internal.SimpleRaptorTaskUI.<init>(SimpleRaptorTaskUI.java:63)
      at oracle.dbtools.raptor.backgroundTask.internal.RaptorTaskUI.<init>(RaptorTaskUI.java:36)
      at oracle.dbtools.raptor.backgroundTask.ui.TaskProgressViewer$4.<init>(TaskProgressViewer.java:346)
      at oracle.dbtools.raptor.backgroundTask.ui.TaskProgressViewer.createTaskUI(TaskProgressViewer.java:346)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.initViewers(RaptorTaskManager.java:373)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.access$400(RaptorTaskManager.java:45)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager$4.run(RaptorTaskManager.java:299)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.invokeInDispatchThreadIfNeeded(RaptorTaskManager.java:313)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.addTask(RaptorTaskManager.java:302)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.addTask(RaptorTaskManager.java:200)
      at oracle.dbtools.raptor.backgroundTask.RaptorTaskManager.addTask(RaptorTaskManager.java:161)
      at oracle.dbtools.worksheet.editor.OpenWorksheetWizard.invoke(OpenWorksheetWizard.java:425)
      at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:446)
      at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:390)
      at oracle.dbtools.worksheet.editor.WorksheetOpenController$1.run(WorksheetOpenController.java:84)
      at oracle.dbtools.worksheet.editor.WorksheetOpenController.openWorksheetWizard(WorksheetOpenController.java:90)
      at oracle.dbtools.worksheet.editor.WorksheetOpenController.handleEvent(WorksheetOpenController.java:49)
      at oracle.ide.controller.IdeAction$ControllerDelegatingController.handleEvent(IdeAction.java:1482)
      at oracle.ide.controller.IdeAction.performAction(IdeAction.java:663)
      at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:1153)
      at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:618)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
      at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
      at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
      at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
      at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
      at java.awt.Component.processMouseEvent(Component.java:6505)
      at javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
      at java.awt.Component.processEvent(Component.java:6270)
      at java.awt.Container.processEvent(Container.java:2229)
      at java.awt.Component.dispatchEventImpl(Component.java:4861)
      at java.awt.Container.dispatchEventImpl(Container.java:2287)
      at java.awt.Component.dispatchEvent(Component.java:4687)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
      at java.awt.Container.dispatchEventImpl(Container.java:2273)
      at java.awt.Window.dispatchEventImpl(Window.java:2719)
      at java.awt.Component.dispatchEvent(Component.java:4687)
      at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
      at java.awt.EventQueue.access$200(EventQueue.java:103)
      at java.awt.EventQueue$3.run(EventQueue.java:694)
      at java.awt.EventQueue$3.run(EventQueue.java:692)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
      at java.awt.EventQueue$4.run(EventQueue.java:708)
      at java.awt.EventQueue$4.run(EventQueue.java:706)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
      at oracle.javatools.internal.ui.EventQueueWrapper._dispatchEvent(EventQueueWrapper.java:169)
      at oracle.javatools.internal.ui.EventQueueWrapper.dispatchEvent(EventQueueWrapper.java:151)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

    Around a month ago, a similar question appeared on Jeff's block... look for checkText in http://www.thatjeffsmith.com/ask-a-question/
    There was no resolution there, so (as the SQL Developer code in that area has not changed) I would tend to think it might have something to do with
    1. Your Locale affecting the Formatter class's parsing of that pattern; or
    2. A bug in the jdk version in use, probably also related to the Locale.
    I recommend upgrading to the latest jdk1.7.0_xx update.  If that does not solve the issue, then try changing the Locale.

  • Sqlplus command using a query instead of a sql file

    can any body guide me?..i want to execute the sql query using sqlplus without using a sql file. for example following command is valid:
    sqlplus abc/abc@abc @abc.sql
    but i want
    sqlplus abc/abc@abc @(select * from abc)
    i will be thankful if any body can suggest something
    Message was edited by:
    syed.habib
    Message was edited by:
    syed.habib

    i use the suggested command in a batch file and when i run this command, i get this:
    C:\>(
    echo select count(*) from tab
    More? echo /
    More? echo exit
    ) | sqlplus -s abc/abc@abc
    'More?' is not recognized as an internal or external command,
    operable program or batch file.
    'More?' is not recognized as an internal or external command,
    operable program or batch file.

  • SSIS execute single SQL Task for running multiple SQL statements on TeraData DB connection

    Hi,
    I need to run multiple statements in TeraData connection ("Go" command between the statements is not recognized). how can I execute 1 SQL task referring to those multi statements? I'm using file connection as well. all the statements located in a single
    file.
    I'm working with SSIS 2008, TERADATA 12.0.
     Thanks

    sure.
    create winbatch file (*.bat).
    in batch file set that command:
    bteq < scriptfilePath.txt (or .bteq)> LogsFolderPathOutputfile.out
    scriptfile should contain:
    .logon
    Server/user, pswd
    your script.
    if you want to set error handeling points, set the followings between yor command statements:
    .IF ERRORCODE <> 0 THEN .GOTO SqlError;
    at the end of script, set:
    -- Log successful completion
    .LOGOFF;.QUIT 0;
    .LABEL SqlError.QUIT ERRORLEVEL;
    you can view logs at the outputfile you stated above.
    enjoy.

  • Performance Issue using min() and max() in one SQL statement

    I have a simple query that selects min() and max() from one column in a table in one sql statment.
    The table has about 9 Million rows and the selected column has a non unique index. The query takes 10 secs. When i select min() and max() in separate statements, each takes only 10 msecs:
    This statement takes 10 secs:
    select min(date_key) , max(date_key)
    from CAPS_KPIC_BG_Fact_0_A
    where date_key != TO_DATE(('1900-1-1' ),( 'YYYY-MM-DD'))
    This statement takes 10 msecs:
    select min(date_key)
    from MYTABLE
    where date_key != TO_DATE(('1900-1-1' ),( 'YYYY-MM-DD'))
    union all
    select max(date_key) from MYTABLE
    Because the first statement is part of an autmatic generated SQL of an application, i can't change it and i have to optimize the data model. How can i speed up the first statement?

    I've ran similar query on a table that has 10 milliion rows, with an index on the date column
    This is what I have found:
    SQL> set timing on
      1  SELECT MIN(ID_DATE) MIN_DATE, MAX(ID_DATE) MAX_DATE
      2      FROM MY_DATE
      3*     WHERE ID_DATE != TO_DATE(('1900-1-1' ),( 'YYYY-MM-DD'))
    SQL> /
    MIN_DATE  MAX_DATE
    03-APR-76 06-JAN-02
    real: 43383
    SQL> SELECT MIN(ID_DATE) MIN_DATE FROM MY_DATE
      2   WHERE ID_DATE != TO_DATE(('1900-1-1' ),( 'YYYY-MM-DD'))
      3  UNION ALL
      4  SELECT MAX(ID_DATE) MAX_DATE FROM MY_DATE
      5   WHERE ID_DATE != TO_DATE(('1900-1-1' ),( 'YYYY-MM-DD'))
      6  /
    MIN_DATE
    03-APR-76
    06-JAN-02
    real: 20
    SQL> SELECT MIN_DATE, MAX_DATE FROM
      2  (SELECT MAX(ID_DATE) MAX_DATE FROM MY_DATE
      3  WHERE ID_DATE != TO_DATE(('1900-1-1' ),( 'YYYY-MM-DD')) ) A,
      4  (SELECT MIN(ID_DATE) MIN_DATE FROM MY_DATE
      5  WHERE ID_DATE != TO_DATE(('1900-1-1' ),( 'YYYY-MM-DD')) ) B
      6  /
    MIN_DATE  MAX_DATE
    03-APR-76 06-JAN-02
    real: 10
    SQL> My conculsion, there is nothing you can do to the tables that will improve that particular statement.
    Why can't you modify the application?

Maybe you are looking for

  • ITunes icon and App Store missing from my MacBook Pro

    Hi, I just changed my MacBook Pro hard drive but I now have a problem with iTunes and the App Store. iTunes is opening and working correctly but the icon for it is a notepad with a pen. I tried to download the new version and install it but it is sti

  • How to Apply Databank for 2 or more than 2 fields?

    hi, Suppose on a form we have 2 fields like First name and Last name . So in .csv file I have given like First Name,Last Name (comma separated) and my databank file gets created. But before playing back the application , how can i attach the databank

  • Stopping Telemetry

    I turned on telemetry months ago. I believe simply by adding a directory /var/opt/SUNWmsgsr/telemetry/imap/$USERNAME and bouncing the mail server. I found the issue and fixed it. But forgot about the directory. It is now almost 1gig. I believe that j

  • How many years we can store the data in ODS as well as psa data ?

    Hi guru's how many years we can store the data in ODS? can u give particular years ? how many days we can store the data in psa ? could u tell me step by step procedure ? Thanks Reddy prabha

  • How Redirect browser(client) based on non-negotiable SSL/TLS protocol

    Hi guys, we have a security requirement wherein we required to force the browsers accessing our application to have atleast tsl 1.1 , but we don't want to simply block the request, instead we would like to redirect the request to a unsecured static h