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

Similar Messages

  • 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 use presentaion variable in the SQL statement

    Is there any special syntax to use a presentation variable in the SQL Statement?
    I am setting a presentation variable (Fscl_Qtr_Var)in the dashboard prompt.
    If i set the filter as ADD->VARIABLE->PRESENTATION, it shows the statement as 'Contract Request Fiscal Quarter is equal to / is in @{Fscl_Qtr_Var} '.
    And this works fine but when i convert this to SQL, it returns
    "Contract Request Date"."Contract Request Fiscal Quarter" = 'Fscl_Qtr_Var'
    And this does not work.It is not being set to the value in the prompt.
    I need to combine this condition with other conditions in the SQL Statement. Any help is appreciated. Thanks

    Try this: '@{Fscl_Qtr_Var}'

  • Want to use presentation date variable in Advance SQL filter option

    Hi,
    I want to use presentation date variable in Advance SQL filter option.....I am getting the below error.
    SQL in Advance SQL filter ----
    "Fact Status Details"."Load Date" =
    (select min(Cast("D Time"."Business Date" as char))-1
    from "D Time" where "D Time"."Operational Month Sk" =
    (select "D Time"."Operational Month Sk" from "D Time" where date '@{Date1}'=cast("D Time"."Business Date" As char)))
    Error ---
    Error getting drill information: SELECT "Fact Status Details"."Load Date" saw_0 FROM "Pre RFAI Sales" WHERE "Fact Status Details"."Load Date" = (select min(Cast("D Time"."Business Date" as char))-1 from "D Time" where "D Time"."Operational Month Sk" = (select "D Time"."Operational Month Sk" from "D Time" where date '@{Date1}'=cast("D Time"."Business Date" As char)))
    Error Details
    Error Codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
    Odbc driver returned an error (SQLExecDirectW).
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27002] Near <select>: Syntax error [nQSError: 26012] . (HY000)
    SQL Issued: {call NQSGetLevelDrillability('SELECT "Fact Status Details"."Load Date" saw_0 FROM "Pre RFAI Sales" WHERE "Fact Status Details"."Load Date" = (select min(Cast("D Time"."Business Date" as char))-1 from "D Time" where "D Time"."Operational Month Sk" = (select "D Time"."Operational Month Sk" from "D Time" where date ''@{Date1}''=cast("D Time"."Business Date" As char)))')}
    Load Date format ---YYYYMMDD
    Please advise...i need to fix this issue urgently.

    Thanks for your reply.
    Could you please help me with the correct code...i tried to correct it....
    "Fact Status Details"."Load Date" =
    (select Cast(min("D Time"."Business Date" )-1 as char)
    from "D Time" where "D Time"."Operational Month Sk" =
    (select "D Time"."Operational Month Sk" from "D Time" where Date'@{Date1}'=cast("D Time"."Business Date" As char)))
    Please let me know if i am wrong..this code is also not working.

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

  • How to enter bind variables in Calender SQL statement

    Hi,
    Anyone know how to include bind variables in Calender SQL statement. Let's say in sql statement below:
    select
    EMP.HIREDATE the_date,
    EMP.ENAME the_name,
    null the_name_link,
    null the_date_link,
    null the_target
    from SCOTT.EMP
    order by EMP.HIREDATE
    thanks.

    Hi,
    Here is the sql statement
    select
    EMP.HIREDATE the_date,
    EMP.ENAME the_name,
    null the_name_link,
    null the_date_link,
    null the_target
    from SCOTT.EMP
    where deptno = :dept
    order by EMP.HIREDATE
    Thanks,
    Sharmila

  • Can i use a environment variable inside a *.sql file?

    Hello,
    I want to create a external table.
    So i am using the command
    create or replace directory abc as 'C:\folder'.... inside a sql file.
    Now i want the path "C:\folder" to be dynamic as i am using this path in many other places also inside the sql file.So i thought to create a environment variable and put this value there.I tried using as %PATH% but it gives error..... where %PATH%=C:\folder.
    Can i use a environment variable inside a *.sql file?
    But how to do that or is there any other way.
    Thanks
    Swapna
    Edited by: user11018268 on Feb 19, 2010 1:03 AM

    user11018268 wrote:
    Actually what i want is the path "C:\folder" is not fixed it can be anything which i may not know the user may decide it later. Not supported. A directory object refers to a specific physical location (directory/folder) on a file system. Not a path.
    You can work around it by (creating and) using a function (running under a super user schema with authid definer privs). The caller (e.g. schema scott ) calls it with a physical path. E.g. GetDirectoryObject( 'C:\folder\2010\feb\week4' ).
    This function determines if there is an existing directory object for the path. If not, it uses a wildcard search to determine if there are any directory objects for parents in the path (e.g. for C:\folder\2010\feb or C:\folder\2010 or C:\folder ).
    If it finds a directory object, it interrogates the data dictionary to determine if the caller, schema scott for example, has read/write access on that directory object. If it has, it creates a new directory object and grants the caller read/write access to it. The function then returns the name of the directory object to the caller.
    The caller thus do not deal directly with directory objects. The function returns the object name given a physical path as input. Also, only a single base directory needs to be created (e.g. for C:\folder ) and access granted to the schema on it. Any sub-directory in that base directory can now be dynamically accessed by the schema.

  • How do I use a variable within a sql statement

    I am trying to use a local variable within an open SQL step but I keep getting an error.
    My sql command looks like this "SELECT BoardDetailID FROM BoardDetails WHERE SerialNumber = " +  locals.CurrentSerialNo
    If I replace the locals.CurrentSerialNo with an actual value such as below the statement works fine.
    "SELECT BoardDetailID FROM BoardDetails WHERE SerialNumber = " +  " 'ABC001' " 
    Can someone tell me how to correctly format the statement to use a variable?

    Hi,
    Thanks for the reply. I have changed the required variable to a string, but with no success. I have reattached my updated sequence file and an image of the error.
    When looking at the Data operation step I see that the sql statement is missing everything after the last quotation mark.
    Thanks again,
    Stuart
    Attachments:
    Database Test Sequence.seq ‏10 KB
    TestStand error.JPG ‏37 KB

  • Using Variables in a SQL Statement

    I know, I know, this is written in VB..I'm doing a VB Project right now for my Instructor (While in an Intermediate Java Class)
    But VB (I feel) doesnt have very good support Forums.
    Anyway, this is the problem:
    I want to use String Variables to hold the place of field names in
    a SQL Statement and the change the ORDER according to intCount's Loop:
    The key word(s) here is "ORDER BY"
    Private Sub DataGrid1_Click()
    Dim intCount As Integer
    Dim strColHead(11) As String
    strColHead(0) = "RES__PUR_DT"
    strColHead(1) = "VENDOR"
    strColHead(2) = "VEN_LOC"
    strColHead(3) = "RES_TYPE"
    strColHead(4) = "RES_FROM_DT"
    strColHead(5) = "RES_TO_DT"
    strColHead(6) = "MISC_ADJ"
    strColHead(7) = "STATE_TAX"
    strColHead(8) = "LOC_CHARGE"
    strColHead(9) = "RES_ID"
    strColHead(10) = "RES_OP"
    For intCount = 0 To 10
    If DataGrid1.SelStartCol = intCount Then
    Adodc1.RecordSource = "Select * from tblReservation order by 'strColHead(intCount)'"
    End If
    Adodc1.Refresh
    Next intCount
    End Sub

    I'm just wondering if anyone knows a work around so that I might be able to store a Table's FIELD name in a variable or an array[] so that I can do a query based on the decision of a loop without having to code 10 IF/ELSE statements.For instance, although the above code will not work, this code, although quite lengthy, does:
    If DataGrid1.SelStartCol = 0 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES__PUR_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 1 Then
    Adodc1.RecordSource = "Select * from tblReservation order by VENDOR"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 2 Then
    Adodc1.RecordSource = "Select * from tblReservation order by VEN_LOC"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 3 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_TYPE"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 4 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_FROM_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 5 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_TO_DT"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 6 Then
    Adodc1.RecordSource = "Select * from tblReservation order by MISC_ADJ"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 7 Then
    Adodc1.RecordSource = "Select * from tblReservation order by STATE_TAX"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 8 Then
    Adodc1.RecordSource = "Select * from tblReservation order by LOC_CHARGE"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 9 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_ID"
    Adodc1.Refresh
    ElseIf DataGrid1.SelStartCol = 10 Then
    Adodc1.RecordSource = "Select * from tblReservation order by RES_OP"
    Adodc1.Refresh
    End If
    Do you see where i'm going with this?
    I simple want to use a variable in the "select * from <Table> Order by <Field>"

  • How can i put the value of a variable in an SQL statement?

    Hi,
    Can someone please tell me how i can use a variable as part of an sql statement.
    So instead of "SELECT * FROM tablename WHERE username='john'"
    I can put in "SELECT * FROM tablename WHERE username.text"

    What would happen if someone entered "(delete *
    from tablename)" into the username field?The SELECT would fail and the DELETE
    would never run.
    Or am I missing something?Ok, that wasn't valid SQL, so lets change it into valid SQL. What would this do
    "SELECT * FROM tablename WHERE username=" + user
    where user is "blah;DROP TABLE tablename;"
    The SQL would become
    SELECT * FROM tablename WHERE username=blah;DROP TABLE tablename;
    And that would select, and then drop the table
    Kaj
    Message was edited by:
    kajbj

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

  • How do I use bind variables for the SQL statements having IN clause

    SELECT id, name FROM t
    WHERE id in (10,20,30)
    As the IN list will have 'n' number of values, I am not able to specify fixed number of bind
    variables like
    SELECT id, name FROM t
    WHERE id in (?,?,?....)

    452051 wrote:
    I am not able to specify fixed number of bind variablesYou could use collection:
    SQL> create or replace force
      2    type NumList
      3      as
      4        table of number
      5  /
    SQL> select ename from emp where deptno member of NumList(10)
      2  /
    ENAME
    CLARK
    KING
    MILLER
    SQL> select ename from emp where deptno member of NumList(10,20,30)
      2  /
    ENAME
    SMITH
    ALLEN
    WARD
    JONES
    MARTIN
    BLAKE
    CLARK
    SCOTT
    KING
    TURNER
    ADAMS
    ENAME
    JAMES
    FORD
    MILLER
    14 rows selected.
    SQL> This way you have one bind variable - collection.
    SY.

  • Use of boolean variables in BPEL switch statements

    I have a workflow with a single boolean input parameter:
    <element name="input" type="boolean"/>
    I wish to use a switch statement within the workflow, based on the value of that boolean parameter.
    When I use the following XPath expression:
    bpws:getVariableData("input","payload","/tns:BooleanRequest/tns:input")
    I get the correct functionality, although I get the following BPEL compiler warning:
    " [bpelc] [Warning ORABPEL-10078]: return value of this expression may not be a boolean
    [bpelc] [Description]: in line 35 of "C:\eclipse\workspace\Boolean\Boolean.bpel", xpath expression "bpws:getVariableData("input","payload","/tns:BooleanRequest/tns:input")" used in <switch> may not return boolean type value, the xpath engine would automatically try to convert the return value to boolean..
    [bpelc] [Potential fix]: Please use one of the built-in boolean functions from xpath http://www.w3.org/TR/xpath#section-Boolean-Functions to convert the return value to boolean.."
    However, the boolean functions referenced do not appear to be relevant to a variable which is already of a boolean type. If I attempt to use the boolean() function in my XPath expression, I get rid of the compiler error, but the workflow now does not work as required.
    How can I get rid of the compiler warning and still get the required functionality, and/or am I doing the wrong thing?
    I am currently running on JBoss, with BPEL release 2.1.2 [build #1226].
    Thanks for any help or ideas.

    Hi Marlon,
    Thanks for that - I guess we have to accept the vagaries of XPath and the absence of type-checking for variables.
    I hadn't fully understood until I started investigating that I can assign ANY string to variable of type xsd:boolean, which has been the cause of some of the confusion for me - whether that value is then considered true or false depends on how you write your test condition.
    I tried with your condition, and it didn't seem to work (evaluated to true if the variable data was the string "true()", but otherwise it seemed to always evaluate to false.
    I also tried the following:
    condition="bpws:getVariableData('booleanVariable')=true()"
    but that evaluates to true for any string of length > 0.
    The only one I can get to consistently work is:
    condition="bpws:getVariableData('booleanVariable')=string(true())"
    although that means that variable data of "TRUE" will evaluate to false (may well be the correct behaviour, depending on how you're setting the boolean variable in the first place).

  • Using EXECUTE IMMEDIATE with Create Table SQL Statement not working

    Hi ,
    I am all the privileges given from the SYSTEM user , but still i am not able to create a table under procedure . Please see these and advice.
    create or replace procedure sp_dummy as
    begin
    Execute Immediate 'Create table Dummy99_99 (Dummy_Field number)';
    end;
    even i tried this way also
    create or replace PROCEDURE clearing_Practise(p_file_id in varchar2, p_country in VARCHAR2,p_mapId in VARCHAR2)
    AUTHID CURRENT_USER AS
    strStatusCode VARCHAR2(6);
    BEGIN
    EXECUTE IMMEDIATE 'create table bonus(name varchar2(50))';
    commit;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('ERROR Creating Table');
    END ;

    William Robertson wrote:
    Since the syntax is correct, my guess is you do not have CREATE TABLE system privilege granted directly to your account. A common scenario is that you have this privilege granted indirectly via a role, allowing you to create tables on the command line, but stored PL/SQL is stricter and requires a direct grant and therefore the procedure fails with 'insufficient privileges'.A bit like he's already been told on his first thread...
    Using of Execute Immediate in Oracle PLSQL
    Generally you would not create tables from stored PL/SQL. Also as you have found out, it's best not to hide exceptions with 'WHEN OTHERS THEN [some message which gives less detail than the one generated by Oracle]'.Again like he was told on the other thread.
    There's just no telling some people eh! :)

  • 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

  • PR account assignment category.

    HI Gurus. Use of Account Assignment Category in Purchase Requisition. right now we are not using Account assignment category. if we will use the account assignment category , then what will be the use of that. our objective is to just it for Internal

  • Using AQ in Generic Exchange

    Need help in resolving transport error when using AQ's in transport (Generic Exchange) looks like its getting everything , not sure what the actual error is 2008.04.26 at 14:33:01:379: Thread-26: B2B - (DEBUG) Endpoint: aq://AQB2BTEST@orar09d:3117:R0

  • What Modules are bundled with Oracle 11.03 Financials?

    I have a client that has 11.0.3 financials installed. They are only using GL, and AP. My question is, what modules were bundled with Oracle Financials in 1999. Do they license to the PO module? I know it was part of the FastForward Financials product

  • 16:9 Templates

    Are there really no 16:9 templates or assets in DVD studio Pro (4.2.0)? And related that, it can't import iDVD projects from the last two versions of iDVD? This seems like a very strange limitation.

  • Imac still has mobileme, i don't get icloud, can't sync calendar with ipad

    Help! I can't sync my ipad calendar with my imac...imac just says it can't connect...i thought i had set everything up in the beginning...