SQL query error

I have a complicated SQL query which looks like the following:
UPDATE SeqPick
SET SeqPick.AceTopAge = SEQS.TopAge, SeqPick.AceBaseAge = SEQS.BaseAge
FROM T_Well_SeqPick SeqPick INNER JOIN (SELECT TOPS.Sequence_Name, TOPS.Sequence_ID, TOPS.TopAge, BASES.BaseAge FROM (SELECT dd.Sequence_Name, dd.Sequence_ID, Age_Top+(Age_Base-Age_Top)*Top_Ratio As TopAge FROM T_Sequences dd, T_Stages WHERE(dd.SeqScheme_ID
= 3) And T_Stages.Stage_Name_ID=Top_Stage_ID And T_Stages.Timescale_ID=1) TOPS INNER JOIN (SELECT BaseSeq.Sequence_Name, BaseSeq.Sequence_ID, Age_Top+(T_Stages.Age_Base-T_Stages.Age_Top)*Base_Ratio As BaseAge FROM T_Sequences BaseSeq, T_Stages Where SeqScheme_ID=3
AND Stage_Name_ID=Base_Stage_ID AND Timescale_ID=1) BASES ON TOPS.Sequence_ID=BASES.Sequence_ID ORDER BY TopAge, BaseAge) SEQS ON SeqPick.Seq_ID = SEQS.Sequence_ID
When I run it on a SQL Server 2008, I get the following error message:
SQL Server Exception Error:
System.Data.SqlClient.SqlException: The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP, OFFSET or FOR XML is also specified.
Are there any other ways of re-writing the above query to resolve the issue?

As Erland said, query should be readable. You can easily format it by using
http://poorsql.com/
It formats your query like below:
UPDATE SeqPick
SET SeqPick.AceTopAge = SEQS.TopAge
, SeqPick.AceBaseAge = SEQS.BaseAge
FROM T_Well_SeqPick SeqPick
INNER JOIN (
SELECT TOPS.Sequence_Name
, TOPS.Sequence_ID
, TOPS.TopAge
, BASES.BaseAge
FROM (
SELECT dd.Sequence_Name
, dd.Sequence_ID
, Age_Top + (Age_Base - Age_Top) * Top_Ratio AS TopAge
FROM T_Sequences dd
, T_Stages
WHERE (dd.SeqScheme_ID = 3)
AND T_Stages.Stage_Name_ID = Top_Stage_ID
AND T_Stages.Timescale_ID = 1
) TOPS
INNER JOIN (
SELECT BaseSeq.Sequence_Name
, BaseSeq.Sequence_ID
, Age_Top + (T_Stages.Age_Base - T_Stages.Age_Top) * Base_Ratio AS BaseAge
FROM T_Sequences BaseSeq
, T_Stages
WHERE SeqScheme_ID = 3
AND Stage_Name_ID = Base_Stage_ID
AND Timescale_ID = 1
) BASES ON TOPS.Sequence_ID = BASES.Sequence_ID
--ORDER BY TopAge
-- , BaseAge
) SEQS ON SeqPick.Seq_ID = SEQS.Sequence_ID
-Vaibhav Chaudhari

Similar Messages

  • HOW TO FIND AND CORRECT THE SQL QUERY ERRORS ????

    Sometimes I get the errors while executing the sql queries.
    I just wanted to know about the various ways by which I can find the sql query errors .
    Any suggestions will be deeply appreciated.

    If you get the an error from SSMS and you can't comprehend it, you can google the error message and google would always lead you to the correction. Or you can post the error in this forum, people
    here are always kind and ready to help :).
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • SQL Query (PL/SQL function body returning SQL query) Error

    I'm an ApEx newbie, not a PL/SQL developer (more of a Web application developer) and I'm getting an error that prevents me from saving some PL/SQL code. I've looked over it all afternoon, but can't tell what's wrong. I may even be trying to do something inappropriately, or really stupid.
    The code is below. The error I get is - "Function returning SQL query: Query cannot be parsed within the Builder". Any help is appreciated, and thanks in advance. If you need more details of what I'm trying to do let me know.
    = = = = = = =
    DECLARE
    v_ID NUMBER;
    v_SITE_ID NUMBER;
    v_SITE_CODE VARCHAR2(15);
    v_ADDR1 VARCHAR2(240);
    v_CITY VARCHAR2(25);
    v_STATE VARCHAR2(150);
    v_ZIP VARCHAR2(20);
    v_ORG_ID VARCHAR2(10);
    BEGIN
    IF :G_ORG_ID = '' THEN
    SELECT "VENDOR_ID", "VENDOR_SITE_ID", "VENDOR_SITE_CODE", "ADDRESS_LINE1", "CITY", "STATE", "ZIP", "ORG_ID"
    INTO v_ID, v_SITE_ID, v_SITE_CODE, v_ADDR1, v_CITY, v_STATE, v_ZIP, v_ORG_ID
    FROM "PO_VENDOR_SITES_ALL_V"
    WHERE ("VENDOR_ID" = :P4_VENDOR_ID);
    ELSE
    SELECT "VENDOR_ID", "VENDOR_SITE_ID", "VENDOR_SITE_CODE", "ADDRESS_LINE1", "CITY", "STATE", "ZIP", "ORG_ID"
    INTO v_ID, v_SITE_ID, v_SITE_CODE, v_ADDR1, v_CITY, v_STATE, v_ZIP, v_ORG_ID
    FROM "PO_VENDOR_SITES_ALL_V"
    WHERE (("VENDOR_ID" = :P4_VENDOR_ID) AND ("ORG_ID" = :G_ORG_ID));
    END IF;
    END;

    Denes,
    Good question.
    Before I answer that question I'll give some detail on the application. That may help too. The application is a supplier search which searches the Oracle vendor tables (po.vendors, po_vendor_sites_all, po_vendor_contacts). The vendor/vendor site relationship is one to many. The site is based on the Org_ID. The supplier search is built to work solo, or to be called by another application. If it is called by another application one of the values passed is the Org_ID, so that only the sites that pertain to the user's org_id are shown. If the appl is called solo the Org_ID is not known, so the SQL should return all sites.
    I figured the easiest way to check if the program was running solo or was called was to check the G_ORG_ID value in my PL/SQL that builds the site report. You helped me with that code. (I am hiding buttons by checking if the G_ORG_ID field is null and they display/hide properly.)
    So, how is G_ORG_ID populated? It is on Page Zero, and is populated via the URL when the appl is called. (That aspect works great.) If it is called by another application G_ORG_ID is populated and my PL/SQL works. But, if the appl is called solo the field is not populated. When the PL/SQL runs I cannot get it to run the code for when G_ORG_ID is not populated.
    I am at the point that I don't know if I need to populate G_ORG_ID in some way when the appl is running solo (kinda tricky, because I need to use that field to determine if it is running solo), or if I need to check it differently in the PL/SQL IF.
    I have experimented with both the default value, and have checked for different values in the PL/SQL IF, but nothing works.
    Thanks for your help, and let me know if you have any other questions on this matter.
    Thanks, Tony

  • JSTL, MySQL, Tomcat sql:query error

    Hi to everyone...
    This is my first post, but since im employed now as a java developer ill be here regulary.
    Right now im trying to use the JSTL to make some simple sql selects in my JSPs....
    Here�s the JSP code:
    <%@ page language="java" import="java.lang.*,java.util.*" %>
    <%@ taglib uri="/jstl-core" prefix="c" %>
    <%@ taglib uri="/jstl-sql" prefix="sql" %>
    <html>
    <head>
    <title> A first JSP database </title>
    </head>
    <body>
    <sql:setDataSource scope="session" var="dataSource"
    url="jdbc:mysql://127.0.0.1/zolltek" driver="com.mysql.jdbc.Driver"
    user="root" password="root"/>
    <!-- The following UPDATE works fine.. -->
    <sql:update var="users" dataSource="${dataSource}" scope="session">
    INSERT INTO test VALUES (7,'Paul Oakenfold')
    </sql:update>
    <!-- But the select screws up.... -->
    <sql:query var="users" dataSource="${dataSource}" scope="session">
    SELECT * FROM test WHERE 1
    </sql:query>
    </body>
    </html>
    ...and the error message:
    exception :
    org.apache.jasper.JasperException:
    SELECT * FROM test WHERE 1
    : null
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    root cause
    javax.servlet.ServletException:
    SELECT * FROM test WHERE 1
    : null
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:531)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:84)
    ...and just for completion the importent part of my web.xml:
    <taglib>
    <taglib-uri>/jstl-core</taglib-uri>
    <taglib-location>/WEB-INF/c-1_0.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/jstl-sql</taglib-uri>
    <taglib-location>/WEB-INF/sql-1_0.tld</taglib-location>
    </taglib>
    i am using the jboss 3.2.3 tomcat bundle (tomcat 4.1.29)
    and mysql 4.0.18 on W32 System....
    the JSTL is installed and working - i can make <sql:update>Inserts without any problems, but any <sql:query>selects result in that error... so i guess the setDataSource is okay...
    Any idea would be appreciated....
    Thx
    J�rg

    Those URIs you've got in your JSPs aren't correct. They should be:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    These are the URIs defined in the standard.jar.
    You'd be better off setting up a Tomcat JNDI data source for your application. That will externalize the connection parameters and make it unnecessary to refer to a data source in your JSPs.
    You'd be even better off not putting SQL code in your JSPs. They're for presentation. Better to write a Java object that will communicate with the database on the JSP's behalf.
    If you just want to select all the rows in the table, the query should be "SELECT * FROM test". You don't need a WHERE clause in that case.
    If you change the URIs in your JSPs you should remove the <taglib> from your web.xml. It's not necessary. Tomcat will find the TLD by looking in the JARs in the CLASSPATH and matching the URIs.

  • ReportViewer using SQL Query error states: Incorrect syntax near ','.

    Hello Community
        Using Visual Studio 2008 and SQL Server 2008 I created a Windows Application
    that uses SQL Server Reporting Services.  The application uses ReportViewer and
    calls a method written using SQL query.
                1-First I created the form.
                2-Next I dragged the ReportViewer (Toolbox) and Table (from DataSource) onto the form.
    The problem is that when it reaches the last line of the SQL query (ie, da.Fill(ds, "TableOne");)
    the code fails stating the error message:
                "Incorrect syntax near ','."
         The following is the code behind the form containing the query:
            private void ReportPgm1_Load(object sender, EventArgs e)
                // TODO: This line of code loads data into the 'ReportDBDataSet.TableOne' table. You can move, or remove it, as needed.
                this.TableOneTableAdapter.Fill(this.ReportDBDataSet.TableOne);  
                reportViewer1.ProcessingMode = ProcessingMode.Local;
                LocalReport ReportOneLocalReport = reportViewer1.LocalReport;
                DataSet ds = new DataSet("ReportDBDataSet.TableOne");
                pgmReportOne(FromDate, ToDate,   ds);
                ReportDataSource ds = new ReportDataSource("ReportDBDataSet.TableOne");
                ds.Value = dataset.Tables["TableOne"];
                ReportOneLocalReport.DataSources.Clear();
                ReportOneLocalReport.DataSources.Add(ds);
                this.reportViewer1.RefreshReport();
            private void pgmReportOne(DateTime FromDate, DateTime ToDate, DataSet ds)
                SqlConnection connection = new SqlConnection("Data Source=ReportDBServer;Initial Catalog=ReportDB;Uid=sa;pwd=Password");
                string sqlReportOne = "Select ([InDate], [FirstName], [LastName], [AGe]" +
                                   "from TableOne";
                SqlCommand command = new SqlCommand(sqlReportONe, connection);
                command.Parameters.Add(new SqlParameter("paramFDate", FromDate));
                command.Parameters.Add(new SqlParameter("paramTDate", ToDate));
                SqlDataAdapter da = new SqlDataAdapter(command);
                da.Fill(ds, "TableOne");
        Why does the last line throw an error?
        Thank you
        Shabeaut

    --NOTE: The statement below cannot be run on SQL Server 2012
    --If you have an earlier version and can set the compatibility
    --level to 80, it can be run.
    SELECT sso.SpecialOfferID, Description, DiscountPct, ProductID
    FROM Sales.SpecialOffer sso,
    Sales.SpecialOfferProduct ssop
    WHERE sso.SpecialOfferID *= ssop.SpecialOfferID
    AND sso.SpecialOfferID != 1
    Hi Scott
    The *= is old syntax and not compatible with SQL Server 2012 (as stated in the comments). 
    You could do something like this instead
    SELECT sso.SpecialOfferID
    ,Description
    ,DiscountPct
    ,ProductID
    FROM Sales.SpecialOffer sso
    left outer join Sales.SpecialOfferProduct ssop on sso.SpecialOfferID = ssop.SpecialOfferID
    WHERE sso.SpecialOfferID != 1

  • Validate and Edit SQL Query Errors

    I am trying to "Validate or Edit SQL Query" in APEX 3.0. When I open up the SQL Query its highlighted in red and when I click on the Validate or Edit button it gives me an error.
    I modified my marvel.conf file to include:
    AddType text/xml xbl
    AddType text/x-component htc
    and this still didnt take care of it. Any ideas and thank you in advance.
    PS: OPS - Windows Server 2003
    Upgraded from 1.6 to 3.0

    I've gotten so used to command line editing, that I rarely us "ed". back in the days of DOS, the default editor was EDLIN - one of those goofy editors that only showed one line at a time, so it wasn't much of an improvement. you could switch to the old dos editor, but that wasn't much better (just checked, it's still there)
    some nice things with command line editing
    to change everthing between the first two single quotes
    c/'...'/'new criteria'to remove everything after a specific string
    c/from.../fromto change a string that contains (or will contain) slashes
    c.1/2.1/4.

  • Unable to run Direct SQL Query - Error Odbc driver returned an error (SQLEx

    Hi,
    I have created some answers/reports and dashboards which are working fine.
    However when I try to run an SQL statement on "Create Direct Request" under "Direct Database Request" I get the following error:
    error : State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 27022] Unresolved Connection Pool object: "rnd1.Connection Pool". (HY000)
    error : SQL Issued: {call NQSGetQueryColumnInfo('EXECUTE PHYSICAL CONNECTION POOL "rnd1.Connection Pool" select count(*) from dim_issue')}
    I am working as an admin user who has the rights to create direct sql query.
    Any help here will be highly appreciated.
    Thanks, Rohit

    hi,
    27022 Unresolved Connection Pool object: "rnd1.Connection Pool". (HY000
    have you declared correctly your Connention Pool?Or the query you write is it correct?
    check again you connection pool

  • Native SQL Query Error: DBIF_DSQL2_SQL_ERROR -- ORA-00936: missing express

    Hi,
    I tried to read data using the following SQL Query,
    fp_work = 'ABCD'.
      EXEC SQL PERFORMING WRITE_TO_ITAB .
      SELECT fp_code, bank_acc_code, bank_acc_num,
      INTO :gs_cds_data-FP_CODE,
               :gs_cds_data-BANK_ACC_CODE,
               :gs_cds_data-BANK_ACC_NUM,
       FROM  BANK_TABLE
      WHERE fp_code = :fp_wrk
      ENDEXEC.
    *&      Form  WRITE_to_itab
    FORM write_to_itab.
    To move the data into the Internal Table.
      APPEND gs_cds_data TO gt_cds_data.
      CLEAR  gs_cds_data.
    ENDFORM.                    "WRITE_to_itab
    and im getting the run time error..
    What happened?                                                                               
    The error occurred in the current database connection "SAPABC".                                                                               
    How to correct the error                                                                               
    Database error text........: "ORA-00936: missing expression"             
    Triggering SQL statement...: "FETCH NEXT "                               
    Internal call code.........: "[DBDS/NEW DSQL]"                           
    Please check the entries in the system log (Transaction SM21).                                                                               
    You may able to find an interim solution to the problem                  
    in the SAP note system. If you have access to the note system yourself,  
    use the following search criteria:                                                                               
    "DBIF_DSQL2_SQL_ERROR" C                                                                               
    If you cannot solve the problem yourself, please send the                
    following documents to SAP:
    Can anyone give me a solution to correct this error?
    In addition, Can i omit the WHERE clause, as i need to get all the data in the oracle database?

    BUT,
          EXEC SQL.
            connect to :LV_DB_NAME as :sy-uname
          ENDEXEC.
          EXEC SQL.
            SET CONNECTION :sy-uname
          ENDEXEC.
         check sy-subrc..
    connection is happening.. with sy-subrc value as ZERO

  • SQL Query error in java swing Application

    hi,
    I'm getting the following error when i try to manipulate the date in query.I have set of tuples and would like to retrieve with respect to the date given.Please do help me to get rid of this error.This is the error.
    MY QUERY:
    ResultSet rsdate=st1.executeQuery("select * from phy_stock where date = "+d1+"");
    Where d1 is given like this:
    String startdate[2]="11/31/2008";
    DateFormat df = new SimpleDateFormat ("MM/dd/yyyy"); //converting a string to DATE format.
    Date d1 = df.parse(startdate[2]);
    ERROR:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'date = Mon Sep 01 00:00:00 IST 2008'
    thanks,
    kumar.

    Dates do not have formats. When referencing a Date in String concatenation, which is what you are doing here,
    ResultSet rsdate=st1.executeQuery("select * from phy_stock where date = " + d1 + "");you will get what Date's toString method produces, which will not work for that (or any) query. For one, it wouldn't be surrounded by single quotes ('), and for two, the String format of the Date would not be acceptable by the DB (unless you had changed the DBs defaults).
    Use a PreparedStatement, as suggessted above, and this problem goes away.
    Edit: And make sure to use the setDate method, of course.

  • SQL Query Error Help !!

    Here is the Query:
    <cfquery name="get_facilities" dbtype="query">
    SELECT
    shopid, name, address, city, zip, phone, keyword
    FROM get_shops
    WHERE(
    <cfloop index="i" list="#form.keywords#" delimiters="
    ">
    UPPER(keywords_#request.language#) LIKE UPPER('%#i#%') AND
    </cfloop>
    UPPER(keywords_#request.language#) LIKE '%%')
    ORDER BYzip
    </cfquery>
    Here is the error:
    "The Pattern of the LIKE conditional is malformed"
    Here is what was entered in the keyword field in the form,
    the person was searching for "star auto[obile".
    automobile was misspelled with a [.
    How do I fix this? Can I fix it in the query?

    Joe Science wrote:
    >
    > How do I fix this? Can I fix it in the query?
    >
    Most likely this can be fixed with the recommended used of
    the
    <cfqueryparam...> tag for all user variables input into
    a SQL statement.
    It will protect you from SQL injection as well.
    UPPER(keyword_#request.languate#_ LIKE
    UPPPER(<cfqueryparam
    value="%#i#%" cfsqltype="cf_sql_varchar">) AND

  • How to get logging sql query error

    Hi,
    I want to create some constraints and indexes on tables on a particular schema and I have the script to build the indexes and constraints.
    But I want to get the errors that should be logged on some file during indexes and constraints creation.
    Pls help me...
    Thanks in advance..

    If you are running the script via SQLPlus then just add a "spool filename" to the beginning of the script and a "spool off" at the end so that query results are written to the file. Also you probably want to "set echo on" at the beginning so that the SQL statements are written to the file also.
    See the SQLPLus Users Guide for the set command and spool.
    HTH -- Mark D Powell --

  • Difficult sql:query error

    Hello everybody,
    I've been stuck on an error for quite some time now, so I figured I may as well share it with you. I am trying to run the following mysql statement within the jstl query tag:
    SELECT subselect.*,count(transactionoffer.id)as count, IF((DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 30 MINUTE) <= user.active AND user.logged_in=1),'1','0') as active, user.first, user.last,cities.lon, cities.lat, categories.title as cat FROM ((SELECT
    products.*,transaction.accepted,transaction.removed
    FROM
    products
    LEFT Join transaction ON products.transactionId = transaction.id
    WHERE
    products.transactionId = '0' AND ownerId = 1
    UNION
    SELECT * FROM (SELECT products.*, transaction.accepted,transaction.removed FROM
    products
    Inner Join transactionoffer ON transactionoffer.productId = products.id
    Inner Join transaction ON transactionoffer.transactionId =transaction.id
    WHERE ownerId = 1
    ORDER BY
    transaction.accepted DESC
    ) as p
    GROUP BY p.id
    ORDER BY accepted DESC
    ) AS subselect
    LEFT JOIN transactionoffer ON subselect.id = transactionoffer.productId
    LEFT JOIN user ON user.id = subselect.ownerId
    LEFT JOIN cities ON user.plz = cities.plz
    LEFT JOIN categories ON categories.id = subselect.category
    GROUP BY id
    HAVING (accepted = '0' OR accepted is null) AND transactionId = '0'
    There are no results, though when run on the mysql console directly, everything seems to work fine. Can anybody spot the error or does anybody here have a solution to the problem?

    Thx for the reply, Balus! :)
    This didn't quite answer my question, but it's helpful none the less. It is not really an option for me to move everything into a seperate class right now (though i did that with parts of some other code already). So in this case I'd need a differend solution. Besides I got a feeling, that this bug is related to the ODBC driver itself (on which the tag library is based upon), so it may be that the error still remains even if i go through the entire hassle of recoding the darn thang...
    Perhaps I should use a mysql function or procedure instead to get around this bug?

  • SQL query error using Union

    Hello!
    I need some correction in the following query. I am trying to make a 2 page QPLD so I am joining 2 queries and then printing the report into 2 pages.
    SELECT T0.[U_OANumber], T0.[custmrName], T0.[U_Inspection], T0.[U_Cust_PO_Num],
    T0.[U_ModelType], T0.[U_Duty], T0.[U_NamePlate],
    T0.[U_Indicator_Obs], T0.[U_Fastners], T0.[U_Mounting_Type], T0.[U_Casing_Orientation], T0.[U_Impeller_Dia],
    T0.[U_Bearing_Style], T0.[U_Motor_HP_Size], T0.[U_InsulationWedges], T0.[U_Varnish], T0.[U_Paint_Shade],
    T0.[U_PlugsSeal], T0.[U_Remarks], T0.[U_Despatch]
    FROM OINS T0 WHERE T0.[U_OANumber] = '[%0]' or  T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
    Union all
    SELECT T0.[U_ModelType], T0.[U_Size], T0.[U_Discharge], T0.[U_Head], T0.[U_RPM], T0.[U_YOM], T0.[U_HP],
    T0.[U_Amps], T0.[U_Insulation_Class], T0.[U_Winding_Connection]
    FROM OINS T0 WHERE
    T0.[U_OANumber] = '[%0]' or  T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
    Do I have to use the where clause just once since it is identical to both statements?
    I get the error stating that all queries using Union, Intersect or Except must have an equal number of expressions. what does this mean?
    scorp
    Edited by: scorpion 666 on Feb 12, 2009 1:30 PM

    Union has to have exact same numbers of fields to combine two results.  Your query shows no need of union because your where clauses are identical.
    Right syntax would be like this:
    SELECT T0.[U_OANumber], T0.[custmrName], T0.[U_Inspection], T0.[U_Cust_PO_Num],
    T0.[U_ModelType], T0.[U_Duty], T0.[U_NamePlate],
    T0.[U_Indicator_Obs], T0.[U_Fastners], T0.[U_Mounting_Type], T0.[U_Casing_Orientation], T0.[U_Impeller_Dia],
    T0.[U_Bearing_Style], T0.[U_Motor_HP_Size], T0.[U_InsulationWedges], T0.[U_Varnish], T0.[U_Paint_Shade],
    T0.[U_PlugsSeal], T0.[U_Remarks], T0.[U_Despatch], T0.[U_Size], T0.[U_Discharge], T0.[U_Head], T0.[U_RPM], T0.[U_YOM], T0.[U_HP],
    T0.[U_Amps], T0.[U_Insulation_Class], T0.[U_Winding_Connection]
    FROM DBO.OINS T0 WHERE T0.[U_OANumber] = '[%0]' or  T0.[customer] = '[%1]' or T0.[manufSN] = '[%2]'
    Thanks,
    Gordon

  • UTL_HTTP working in SQL Query, error when used in procedure

    Hi,
    We are trying to call web service from stored procedure .
    When we run the utl_http.request independently in a query its working fine but when we put that in a stored procedure we are unable to connect. Getting HTTP request failed error.
    select utl_http.request("SSL_URL",
                            null,
                            "Wallet Details",
                            'password')
    from dual;
    But the same query if we put into procedure getting the error as below,
    ORA-29273: HTTP request failed
    ORA-06512: at "SYS.UTL_HTTP", line 1722
    ORA-28860: Fatal SSL error
    All the parameters are set properly w.r.t ACL and Oracle Wallet for SSL .
    grant execute on UTL_HTTP to &&SCHEMA_NAME;
    --Step1 grant on UTL_HTTP package to schema
    grant execute on UTL_HTTP to &&SCHEMA_NAME;
    Created ACL using the below scripts.
    begin
    dbms_network_acl_admin.create_acl (
    acl => 'utlpkg.xml',
    description => 'Normal Access',
    principal => 'CONNECT',
    is_grant => TRUE,
    privilege => 'connect',
    start_date => null,
    end_date => null
    end;
    begin
    dbms_network_acl_admin.assign_acl (
    acl => 'utlpkg.xml',
    host => '*',
    lower_port => 1,
    upper_port => 35000);
    end;
    begin
    dbms_network_acl_admin.add_privilege (
    acl => 'utlpkg.xml',
    principal => '&&SCHEMA_NAME',
    is_grant => TRUE,
    privilege => 'connect',
    start_date => null,
    end_date => null);
    end;
    Thanks in advance for the help!!!!!!!

    Any responses? Thanks.

  • SQL query error - Literal does not match format string

    Hi All,
    When I am removing these code form query then it is running fine else it is giving error of "Literal does not match format string."
    AND trunc((SYSDATE)) > DECODE(fifs.id_flex_structure_name, 'XXX Service Agreement', trunc(TO_DATE
    (pac.segment3, 'YYYY/MM/DD HH24:MI:SS')),trunc(SYSDATE) )
    Regards,
    Ajay

    Ajay Sharma wrote:
    It is flexfield segment so it can contain anything. For my query it is returning date.....Oh dear. Two really bad design decisions in one, there - storing dates as varchar2 and storing more than one type of data in one column. I suggest you read this: http://www.simple-talk.com/opinion/opinion-pieces/bad-carma/ in order to see just why that might be a bad design.
    If you have any influence at all over the way your tables/app is designed, then I would highly recommend changing the design, as it will save you countless headaches like the one you've currently got.
    If you are absolutely stuck with that design, then a) poor you and b) you'll have to add in some filters onto your queryto make sure you're only selecting rows with dates in that column.

Maybe you are looking for

  • Camera Raw vs Photoshop

    To what degree should I edit photos using the Camera Raw Editor first before editing in Photoshop, given that all the features in Camera Raw Editor can be duplicated in Photoshop? Are there any MUST features that should always be done first in Raw ed

  • Signing In To Read Emails

    When I Sign In, I get message, "We are unable to process your request at this time." To get to my emails I have to go to My Verizon Services - Services Overview- then select Inbox. Do I need to chnage my settings?

  • Change the fonts in Crystal XI R2 report?

    Is there a way to globally change the fonts used in an Crystal IX R2 report, including those imbedded in the charts?

  • Linking problems with Intermedia

    While trying to execute the following sql statement: create index sws_ctx_index on site_wide_index (datastore) indextype is ctxsys.context parameters ('datastore sws_user_datastore memory 250 M'); I'm getting the following error: ERROR at line 1: ORA

  • Installing Creative Cloud causes Error 207

    Hi all, I try to install CC on an new clean Win7 PC. The Setup takes long and end's with the Error 207. Retrying doesn't help it ends with a new 207 Error a few minutes later... Here are some log enties: 07/26/14 17:04:22:467 | [WARN] |  | ASU | PIM