SQL String Not a Query Trouble

Just upgraded my JDeveloper and Oracle Application Server to 10.1.2 and some code that was working before no longer works. I suspect JDBC driver issues but I've been swapping jar files like a crazed loon and still no joy. Perhaps some here can give me a clue.. the exception I get is:
nested exception is: org.exolab.castor.jdo.PersistenceException: Nested error: java.sql.SQLException: SQL string is not Query while executing UPDATE PER_USERS SET ACCTNM='paul',FIRSTNM='Paula',LASTNM='Sanders',MI='M',EMAIL='[email protected]',PHONEEXT='9362',ROLE_ID=1,DIVISION_ID=null,ERRTYPE_ID=null,ACTIVE='T' WHERE USER_ID=1 at ourcustomdbaccess.Query.execute(Query.java:112) at ...
Query is a subclass of Castor's OQLQuery.
Interestingly, before the upgrades this code would not work in JDev (9.0.4) but would work on the application server.
Any suggestions appreciated!
Paul

Oooops ...
Has the dang documentation writer (that's me) simply believed what the dang developer (that's the buddy sitting directly in front of me, nice guy by the way) has told him instead of testing it thoroughly enough.
Unfortunately, only CHAR, CLNT, LANG, CUKY, UNIT and c are supported with operator && up to now.
I adjust the documentation in SP09  (that's the current version, I'm working on). But maybe, that's also the SP, where the restriction will be abolished anyway (the problem as always in Open SQL - and meanwhile also in ABAP CDS - is, that each database must deliver the same result for all possible combinations and a lot of testing has to be done before the functionality can be released).
Sorry for that and thanks for notifying me!
Horst

Similar Messages

  • SQL*plus not executing query

    Hello,
    I am new to sqlplus and I am trying to get some queries running off of an ARCH linux box that I have.
    The install went ok and I can get sqlplus running and connect to my oracle DB. However when I enter something as easy as "select * from REASON" hit enter, all i get is a "2" on the next line
    (screenshot http://imgur.com/KvTyD.jpg)
    Is this a config issue on my sqlplus or am i Just not qualified. Any help is appreciated. thanks

    >
    I am new to sqlplus and I am trying to get some queries running off of an ARCH linux box that I have.
    The install went ok and I can get sqlplus running and connect to my oracle DB. However when I enter something as easy as "select * from REASON" hit enter, all i get is a "2" on the next line
    (screenshot http://imgur.com/KvTyD.jpg)
    Is this a config issue on my sqlplus or am i Just not qualified. Any help is appreciated. thanks
    >
    SQL*Plus is expecting input from you; you terminate the statement by putting a forward slash or semi-colon just after your statement.
    select * from REASON
    /OR
    select * from REASON;Regards,
    Phiri

  • TOPLINK-4002 SQL string is not Query Error Code: 17128

    I got following exception when trying to execute native SQL query via session EJB. The query is defined in orm.xml file using JDev 11g Preview:
    javax.ejb.EJBException: Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 070502)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: SQL string is not QueryError Code: 17128
    Call:findProfilesByLastName
    I have following native query defined:
    select o.last_name,
    o.first_name,
    o.middle_name,
    o.birth_date,
    o.sex_code,
    a.height_cm,
    a.weight_kg,
    o.PERSON_ID
    from persons o,
    person_bookings b,
    person_physical_attributes a
    where o.PERSON_ID = b.PERSON_ID
    and b.PERSON_BOOK_ID = a.PERSON_BOOK_ID
    and o.last_name like '%?1%'
    I also tried these versions of the same query but got the same exception:
    select o.last_name,
    o.first_name,
    o.middle_name,
    o.birth_date,
    o.sex_code,
    a.height_cm,
    a.weight_kg,
    o.PERSON_ID
    from persons o,
    person_bookings b,
    person_physical_attributes a
    where o.PERSON_ID = b.PERSON_ID
    and b.PERSON_BOOK_ID = a.PERSON_BOOK_ID
    and o.last_name like '%:1%'
    select o.last_name,
    o.first_name,
    o.middle_name,
    o.birth_date,
    o.sex_code,
    a.height_cm,
    a.weight_kg,
    o.PERSON_ID
    from persons o,
    person_bookings b,
    person_physical_attributes a
    where o.PERSON_ID = b.PERSON_ID
    and b.PERSON_BOOK_ID = a.PERSON_BOOK_ID
    and o.last_name like '%#partialName%'
    select o.last_name,
    o.first_name,
    o.middle_name,
    o.birth_date,
    o.sex_code,
    a.height_cm,
    a.weight_kg,
    o.PERSON_ID
    from persons o,
    person_bookings b,
    person_physical_attributes a
    where o.PERSON_ID = b.PERSON_ID
    and b.PERSON_BOOK_ID = a.PERSON_BOOK_ID
    and o.last_name like '%#partialName#%'
    Log trace:
    Query:DataReadQuery(); nested exception is:
    Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 070502)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: SQL string is not QueryError Code: 17128
    Call:findProfilesByLastName
    Query:DataReadQuery(); nested exception is: oracle.oc4j.rmi.OracleRemoteException: Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 070502)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: SQL string is not QueryError Code: 17128
    Call:findProfilesByLastName
    Query:DataReadQuery(); nested exception is:
    Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 070502)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: SQL string is not QueryError Code: 17128
    oracle.oc4j.rmi.OracleRemoteException: Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 070502)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: SQL string is not QueryError Code: 17128
    Call:findProfilesByLastName
    Query:DataReadQuery()
    at com.evermind.server.ejb.EJBUtils.getUserException(EJBUtils.java:127)
    at com.evermind.server.ejb.interceptor.system.AbstractTxInterceptor.convertAndHandleMethodException(AbstractTxInterceptor.java:91)
    at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:52)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    at oracle.oc4j.security.SecurityServices.doAsPrivileged(SecurityServices.java:150)
    at oracle.oc4j.security.SecurityServices.doAsPrivileged(SecurityServices.java:420)
    at oracle.oc4j.security.JaasModeImpl$DoAsPrivilegedExecutor.execute(JaasModeImpl.java:280)
    at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:57)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:58)
    at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:104)
    at SearchFacade_RemoteProxy_43jlpm9.queryProfilesByLastName(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.evermind.server.rmi.RmiMethodCall.invokeMethod(RmiMethodCall.java:104)
    at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:59)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
    Nested exception is:
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 070502)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: SQL string is not QueryError Code: 17128
    at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:283)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:583)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:443)
    at oracle.toplink.internal.sessions.AbstractSession.executeCall(AbstractSession.java:749)
    at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
    at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:179)
    at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:250)
    at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:232)
    at oracle.toplink.queryframework.DataReadQuery.executeNonCursor(DataReadQuery.java:122)
    at oracle.toplink.queryframework.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:114)
    at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:671)
    at oracle.toplink.queryframework.DataReadQuery.execute(DataReadQuery.java:100)
    at oracle.toplink.queryframework.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:594)
    at oracle.toplink.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2632)
    at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1014)
    at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:986)
    at oracle.toplink.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:395)
    at oracle.toplink.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:502)
    at ejbmodel.SearchFacadeBean.queryProfilesByLastName(SearchFacadeBean.java:107)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.evermind.server.ejb.interceptor.joinpoint.EJBJoinPointImpl.invoke(EJBJoinPointImpl.java:27)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.interceptor.system.SetContextActionInterceptor.invoke(SetContextActionInterceptor.java:44)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.interceptor.system.TxRequiredInterceptor.invoke(TxRequiredInterceptor.java:50)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.interceptor.system.JAASInterceptor$1.run(JAASInterceptor.java:52)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    at oracle.oc4j.security.SecurityServices.doAsPrivileged(SecurityServices.java:150)
    at oracle.oc4j.security.SecurityServices.doAsPrivileged(SecurityServices.java:420)
    at oracle.oc4j.security.JaasModeImpl$DoAsPrivilegedExecutor.execute(JaasModeImpl.java:280)
    at com.evermind.server.ejb.interceptor.system.JAASInterceptor.invoke(JAASInterceptor.java:57)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.interceptor.system.DMSInterceptor.invoke(DMSInterceptor.java:52)
    at com.evermind.server.ejb.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:101)
    at com.evermind.server.ejb.InvocationContextPool.invoke(InvocationContextPool.java:58)
    at com.evermind.server.ejb.StatelessSessionEJBObject.OC4J_invokeMethod(StatelessSessionEJBObject.java:104)
    at SearchFacade_RemoteProxy_43jlpm9.queryProfilesByLastName(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.evermind.server.rmi.RmiMethodCall.invokeMethod(RmiMethodCall.java:104)
    at com.evermind.server.rmi.RmiMethodCall.run(RmiMethodCall.java:59)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: java.sql.SQLException: SQL string is not Query
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:72)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:105)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:168)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:224)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:439)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1302)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3522)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3574)
    at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:267)
    at oracle_jdbc_driver_OraclePreparedStatementWrapper_Proxy.executeQuery(Unknown Source)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:754)
    at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:518)
    ... 51 more

    Does this error only occur when the SQL is defined in orm.xml ? Have attempted to run this query in code only?
    --Gordon                                                                                                                                                                                                                                                   

  • Java.sql.SQLException: SQL string is not Query

    Hi I'm Very much new to Jdeveloper
    I create a an application Which uses Jakarta Struct. that Aplication works fine on tomcat. But when I tried to run that application(using embeded OC4J) It gave me the following error
    java.sql.SQLException: SQL string is not Query
    it will throw on the following statement
    rs = statement.executeQuery(strSqlQuery);
    I print the sql Statement and run it manully. then it work perfectly
    pl help me
    Thanks
    Charith
    the Method is as follows
    public static boolean add(String pstrName, String pstrAge)
    boolean boolResult= false;
    Connection con = null;
    Statement statement = null;
    ResultSet rs=null;
    String strSqlQuery= "insert into a_upul(age, name11) values('"+pstrAge+"','"+pstrName+"')";
    //PreparedStatement stmt = null;
    con =dbmanager.newCon();
    try {
    statement = con.createStatement();
    System.out.println("strSqlQuery "+strSqlQuery);
    rs = statement.executeQuery(strSqlQuery);
    boolResult=true;
    }catch (SQLException e){
    e.printStackTrace();
    boolResult=false;
    finally {
    try{
    if (rs != null)
    rs.close();
    if (statement != null)
    statement.close();
    if (con != null)
    con.close();
    }catch (SQLException e) {
    e.printStackTrace();
    System.out.println("ProjectManager->getDistinctConSeqNoFromTMPSHL_2 method : " + e.toString());
    return boolResult;
    }

    Hi,
    I am using OC4J 10g (9.0.4) - J2EE 1.3 Compatible server to run my ejb, while executing I am getting the following error.
    java.lang.NullPointerException
    at oracle.jdbc.driver.ScrollableResultSet.close(ScrollableResultSet.java:149)
    at com.evermind.sql.FilterResultSet.close(FilterResultSet.java:338)
    The same ejb is working fine with weblogic server.
    Thanks,
    Santo

  • Error in SQl Query - SQl Command not properly ended

    Hi All
    I have this SQL query that returns the following error when I run it in TOAD:
    SELECT
    VC.CAMPAIGN_NUMBER,VC.CAMPAIGN_TITLE,VC.CAMPAIGN_DESC,
    VCV.START_DATE, VCV.END_DATE,VC.CAMPAIGN_TYPE,VC.APPLICABILITY,
    VC.CAMPAIGN_PRIORITY
         FROM
         VM_CAMPAIGN_VIN VCV ,VM_CAMPAIGN VC
         WHERE
              VCV.VIN = 'US'
              AND
    VCV.CAMPAIGN_NUMBER = VC.CAMPAIGN_NUMBER AND VC.COUNTRY_CODE = 'E'
              AND VC.LANGUAGE_CODE = 'L' AND VC.CAMPAIGN_TYPE = null
    AND SYSDATE BETWEEN VCV.START_DATE AND VCV.END_DATE
    AND SYSDATE BETWEEN VC.START_DATE AND VC.END_DATE)
    A ORDER BY A.CAMPAIGN_PRIORITY DESC, A.END_DATE
    The error is:
    SQl Command not properly ended
    Any help is highly appreciated. Thanks

    Thanks a lot to everyone. It helped me run the query without any problem. Now I have another issue. This may not be the right place to post this question, I think.My apologies for that. The problem is, Weblogic posts an error as follows:
    java.sql.SQLException: ORA-00923: FROM keyword not found where expected
    I am wondering if this is an Java related error or an SQL related error.
    Well, I am using the SQL Statement which you helped debug, and it is inside something called "XXSQLConstants.java consisting of the following SQL statement:
    public static final String XX_ALL_CAMPS_SELECT = "SELECT * FROM" +
         "(SELECT vc.campaign_number, vc.campaign_title, vc.campaign_desc, vc.start_date," +
         "vc.end_date, vc.campaign_type, vc.applicability, vc.campaign_priority" +
    "FROM vm_campaign vc" +
    "WHERE vc.applicability = 'Y'" +
    "AND vc.country_code = ? " +
    "AND vc.language_code = ? " +
    "AND vc.campaign_type = ? "+
    "AND SYSDATE BETWEEN vc.start_date AND vc.end_date" +
    "AND NOT EXISTS (" +
    "SELECT 'X'" +
    "FROM vm_campaign_vin vcv" +
    "WHERE (vcv.vin = ? " +
    "AND vcv.campaign_number = vc.campaign_number" +
    "))" +
         "UNION" +
         "SELECT vc.campaign_number, vc.campaign_title, vc.campaign_desc," +
         "vcv.start_date, vcv.end_date, vc.campaign_type, vc.applicability," +
    "vc.campaign_priority" +
    "FROM vm_campaign_vin vcv, vm_campaign vc" +
    "WHERE vcv.vin = ? " +
    "AND vcv.campaign_number = vc.campaign_number" +
    "AND vc.country_code = ? " +
    "AND vc.language_code = ? " +
    "AND vc.campaign_type IS NULL" +
    "AND SYSDATE BETWEEN vcv.start_date AND vcv.end_date" +
    "AND SYSDATE BETWEEN vc.start_date AND vc.end_date)";
    The SQl runs fine when tested (well, it does not return any data for the rows returned, but there are no errors), but in my application server I get the following error (pointing out the same SQL code pasted above:
    java.sql.SQLException: ORA-00923: FROM keyword not found where expected
    Any suggestions? Thanks in advance. I appreciate all replies

  • Abnormal, Same query get data in sql but not working on Fron-end

    Dear,
    Version :Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    We have created packed in oracle database befor two months ago & was working fine, but since morning select statment in package is not working while running via application which mentioned below and raise not data found but surprising thing is that same query is getting data when we execut on sql plus return one record.
    i don't know either it's abnormal behaviour or sth else becuase the same query run without changing any singl column in where_clause work in sql but not getting data while submition request through oracle application and raising not data found.
    --thankse
    Edited by: oracle0282 on Dec 29, 2011 2:20 AM

    Actully when i run this query in sql it return one record on the same parameter, while when we exeucte this select in pl/sql on the same parameter oracle raise no data found error.
    so i got confused the same query with same parameter retur record in sql but when we call it fron-end through packege raise 'no data found error'.
    hope you understand now.
    --thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • I want Query from QueryDataSet by SQL string, Is it possible ??

    if the sql string is :
    "select * from QueryDataset1 " and store the results in another QueryDataSetRR
    is it possible or not ?
    What ara the alternatves of store the retrived data from database and store it in (??) instead querdataset1 and use these data again using SQL string ??
    Regards,

    Well, most SQL servers allow some kind of temporary table to be generated, and you can always load a table from the results of a select
    INSERT results(f1, f2) SELECT f1, f2 FROM maindata WHERE .....
    But most database systems also allow a subquery which allows you, amongst other things, to further refine a SELECT by taking FROM from a subquery rather than a table.

  • HTTP Connection to ABAP System - Query String Not Allowed message

    Hi All,
    We are trying to create HTTP Connection to ABAP System on a SAP ECC system.
    Following entries are added
    1 Connection Type: H
    2 Target Host: Host name
    3 Service Number: HTTP Port name
    4 Path Prefix: /sap/XI/engine/?type=entry
    It is not allowing me to enter Path prefix as "/sap/XI/engine/?type=entry". It is throwing a warning message as "Query String Not Allowed message".
    As per the documentation it is mentioned that -<b> If the system displays the Query String Not Allowed message, you can ignore it.</b>
    It is not allowing me to save the entries succesfully . I need to remove the path refix entry then only i am able to save other wise it is not allowing me to proceed at all.
    Please let me know what entry i can put for the same or let me know how can i ignore and proceed by saving the path prefix as "/sap/XI/engine/?type=entry".
    Please provide your valuable help on this.
    Regards,
    Nanda

    Hi Aamir ,
    Thanks for the response.
    Tried both but still same issue .
    Any more inputs .
    Cheers,
    Nanda

  • Xml query error. ORA-00933: SQL command not properly ended

    Hi all,
    My Database Version: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0.
    CREATE table test (Name varchar2(3), Id number);
    insert into test values ('abc', 61);
    insert into test values ('def', 46);
    select table_name,
    column_name,
    'abc' search_string,
    result
    from cols,xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| 'abc' || '%") > 0]')
    columns result varchar2(10) path '.'
    where table_name in ('TEST');
    and i get: ORA-00933: SQL command not properly ended it points over '*xmltable*'

    ok, its possible to get output from a xml like this.
    i need output like this,
    customerid CustomerName Country
    1 xxxx 4
    2 yyyy 5
    xml:
    <Customer>
    <CustomerInformation>
              <Customerid>1</Customerid>
              <CustomerName>xxxx</CustomerName>
              <Country>4</Country>
         </CustomerInformation>
    <CustomerInformation>
              <Customerid>2</Customerid>
              <CustomerName>yyyy</CustomerName>
              <Country>5</Country>
         </CustomerInformation>
    </Customer>
    This xml is input to my stored procedure, i need to insert the xml tag values into customner_table.
    For this i insert the xml inro a xml_document_table having a xmltype column.
    after , by using the below mentioned query to select xml_tag values from that column.
    when i execute this query
    INSERT into customer_table(customer_id)
    SELECT X.XML_DOCUMENT.extract('/Customer/commodityInfo/CustomerInformation/Customerid/text()').getStringVal() "Customerid" from XML_DOCUMENT_TABLE X;
    i got output in a single row.
    customerid_
    1 <next line> 2
    But i need output like this,
    Customerid_
    1
    2
    im struggling with this simple insert. pls share ur idea.....
    Edited by: 887268 on Apr 4, 2012 10:04 PM
    Edited by: 887268 on Apr 4, 2012 10:17 PM

  • Nested query in FROM clause causes 'SQL Command not properly ended' error

    SELECT sj.job_id AS job_id, 'STATUS_AWAITING_PREPARATION' AS job_status, sjr.email_sys_attach_filename AS attach_filename, sje.emailaddr as emailaddr_lastsentto
                        FROM arsnd_jobs sj, (SELECT emailaddr from ARSND_JOB_EMAILS where job_id=sj.job_id AND ROW_NUM=1) as SJE, ARSND_JOB_QUEUE sjq,ARSND_JOB_RECIPIENTS sjr
                        WHERE sj.job_id=sjq.job_id and sj.job_id=sjr.job_id
                        AND sjq.PROCESSING_STATE=0
                        ORDER BY sj.created
    I don't see anything wrong with the above query, it fails with 'SQL Command not properly ended'.
    If I remove the usage of the nested query in the FROM clause, then it doesn't give that error. Please advice what I'm doing wrong.

    Pls try
    SELECT sj.job_id AS job_id, 'STATUS_AWAITING_PREPARATION' AS job_status, sjr.email_sys_attach_filename AS attach_filename, sje.emailaddr as emailaddr_lastsentto
    FROM arsnd_jobs sj, (SELECT emailaddr from ARSND_JOB_EMAILS where job_id=sj.job_id AND ROW_NUM=1) SJE, ARSND_JOB_QUEUE sjq,ARSND_JOB_RECIPIENTS sjr
    WHERE sj.job_id=sjq.job_id and sj.job_id=sjr.job_id
    AND sjq.PROCESSING_STATE=0
    ORDER BY sj.created
    I have removed the 'as' clause you used for alias of the subquery. It should work fine now.....

  • SQL Developer 1.1 Query Builder does not display connection tree

    I have installed SQL Developer 1.1 on a PC running Windows XP SP2. I am connecting to Oracle 9.2.0.7.0.
    After connecting to the database, I right click in the SQL Worksheet and select Query Builder and when the new window is displayed, there are no tables to select from.
    What is causing this?

    Hi Antony,
    Upgrading from SP7 to SP9 fixed a lot of problems for me! It's worth trying.
    Problems solved for me:
    Page requests take about 2 minutes to display page (now within a few seconds)
    KM SQL logging (30-50Mb per minute) problem fixed.
    There are some problems upgrading to SP9, but searching this forum will help you in finding some solutions for this
    Regards,
    Noel

  • To generate sql string of desired row  using function.

    Hi l,
    I return the below query to get sum of vehicles which falls between the specific weight ranges.
    It returns 20 rows( As I selected 4 classification vehicles).I was expect only 4 rows .One row for each classification of vehicles.
    Is there a way if do some loop or decode in my function logic?
    will tht work?
    "(This is only smple. In my real appilication, if I use 15 classification vehicles it returns 320 rows. But i expect only 16 rows - 0 to 15 one row for each classification .Duirng runtime I'm getting an error as buffer string too small)"
    How could I solve this?
    I use this query inside a function and I call that function in a dynamic sql.
    SELECT 'SUM('
        || 'CASE '
        || 'WHEN weight_report_data.weight >=  '|| repo_range_param.min_value ||' 
            AND weight_report_data.weight   <       repo_range_param.max_value
            THEN weight_report_data.weight_count '   
        || 'ELSE 0 '
        || 'END '
        || ') "Class ' || repo_param.r_value || '" '   
          FROM repo_param
          JOIN repo_range_param
            ON repo_param.r_id = repo_range_param.r_id
         WHERE repo_param.r_id    = 1
           AND repo_param.r_group = 'class'
           AND repo_param.r_name  = 'class'
           AND repo_range_param.r_group = 'gvw'
           AND repo_range_param.r_name  = 'gvw'
         ORDER BY CAST(repo_param.r_value AS NUMBER) ASC;
    "sample sql string output when I run the above query "
    SUM(CASE WHEN weight_report_data.weight >=10
             AND weight_report_data.weight  <15
            THEN weight_report_data.weight_count ELSE 0 END ) "Class 0"
    SUM(CASE WHEN weight_report_data.weight >=15
             AND weight_report_data.weight  <20
            THEN weight_report_data.weight_count ELSE 0 END ) "Class 1"
    SUM(CASE WHEN weight_report_data.weight >=5
             AND weight_report_data.weight  <10
            THEN weight_report_data.weight_count ELSE 0 END ) "Class 2"
    SUM(CASE WHEN weight_report_data.weight >=20
             AND weight_report_data.weight  <25
            THEN weight_report_data.weight_count ELSE 0 END ) "Class 3"
    "sample data for the tables involved"
    CREATE  TABLE weight_report_data
    start_date_time       TIMESTAMP      NOT NULL,
    end_date_time         TIMESTAMP      NOT NULL,
    weight                NUMBER(12,0)   NOT NULL,
    weight_count          NUMBER(12,0)   NOT NULL
    INSERT INTO weight_report_data(start_date_time, end_date_time, weight, weight_count)
           VALUES('01-JUL-08 12:00:00','03-JUL-08 12:00:00',4,5);
    INSERT INTO weight_report_data(start_date_time, end_date_time, weight, weight_count)
           VALUES('01-JUL-08 12:00:00','03-JUL-08 12:00:00',3,1);
    INSERT INTO weight_report_data(start_date_time, end_date_time, weight, weight_count)
           VALUES('01-JUL-08 12:00:00','03-JUL-08 12:00:00',8,6);
    INSERT INTO weight_report_data(start_date_time, end_date_time, weight, weight_count)
           VALUES('01-JUL-08 12:00:00','03-JUL-08 12:00:00',25,9);
    CREATE  TABLE repo_param
    R_ID       NUMBER(12,0),
    R_GROUP     VARCHAR2(10),
    R_NAME     VARCHAR2(10),
    R_VALUE     VARCHAR2(10)
    INSERT INTO repo_param(r_id, r_group, r_name, r_value)
           VALUES(1,'class','class',0);
    INSERT INTO repo_param(r_id, r_group, r_name, r_value)
           VALUES(1,'class','class',1);
    INSERT INTO repo_param(r_id, r_group, r_name, r_value)
           VALUES(1,'class','class',2);
    INSERT INTO repo_param(r_id, r_group, r_name, r_value)
           VALUES(1,'class','class',3);
    CREATE  TABLE repo_range_param
    R_ID       NUMBER(12,0),
    R_GROUP     VARCHAR2(10),
    R_NAME     VARCHAR2(10),
    MIN_VALUE NUMBER(3,0),
    MAX_VALUE     NUMBER(3,0)
    INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',0,5);
    INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',5,10);
    INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',10,15);
    INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',15,20);
           INSERT INTO repo_range_param(r_id, r_group, r_name, min_value, max_value)
           VALUES(1,'gvw','gvw',20,25);
    Thanks in advance
    Edited by: user10641405 on Jun 18, 2009 4:10 PM
    Edited by: user10641405 on Jun 18, 2009 4:15 PM
    Edited by: user10641405 on Jun 18, 2009 4:15 PM
    Edited by: user10641405 on Jun 18, 2009 4:16 PM
    Edited by: user10641405 on Jun 18, 2009 4:17 PM
    Edited by: user10641405 on Jun 18, 2009 7:47 PM
    Edited by: user10641405 on Jun 19, 2009 4:15 PM

    Say you have a 3 tables
    Table name Description rowcount()
    ============================================================================
    weight_report_data report table having weights and counts 4
    repo_param having id column gives different classes 4
    repo_range_param is detail table of repo_param with id 4
              as foreign key and defines weight
              min max ranges.
    Now you need to report
    per class how many weights weights are there ?
    --not understood report id clearly in relation to weight_report_data
    step1:
    need to map each row of weight_report_data againist its class.
    select wrd.weight,wrd.weight_count,(select rp.class||rp.value
    from repo_range_param rrp,
              repo_param rp
    where rrp.id= rp.id
    and rp.id=1 -- add your other join condition
    and wrd.weight between rrp.min and rrp.max ) class_nm
    from weight_report_data wrd ;
    This will give 4 rows , i.e for each row in wrd it tells which class it falls.
    now you want to group by class_nm to get sum or count of weights.
    step2:
    select class_nm,sum(weight), count(weight), sum(weight_count)
    from (
    select wrd.weight,wrd.weight_count,(select rp.class||rp.value
    from repo_range_param rrp,
              repo_param rp
    where rrp.id= rp.id
    and rp.id=1 -- add your other join condition
    and wrd.weight between rrp.min and rrp.max ) class_nm
    from weight_report_data wrd ) wrd_classnm
    group by class_nm;
    I hope this helps .
    suggestion: first analyse and breakdown into stpes how you r going to do if you do by hand and then translate into sql and then optimise

  • SQL Strings in Where Clause - single quotes issue

    All,
    I’m having issues related to SQL String literals when trying to deploy to flash. The complication works fine but I then get a message (see below) stating that a ; is missing. The SQL query and the iview runs fine when we use numeric values or do not apply a where clause on the table.
    I am using Visual Composer that has been packaged with NW2004sSP7_Preview
    VC & Flex Version: 645.7.0.3
    The Error message is get is;
    Error in executing a process for Flex compilation, Error 1033: ';' expected
          (C:usrsapJ2EJC01j2eeclusterserver0GUIMachine_Business_Packagestest_48731FLEX_COMPILATION_FOLEDRAADCN.mxml:269)
    Error 1205: The statement 'Test' is incomplete.
          (C:usrsapJ2EJC01j2eeclusterserver0GUIMachine_Business_Packagestest_48731FLEX_COMPILATION_FOLEDRAADCN.mxml:269)
    Failed to compile AADCN.mxml
    When I goto the deployment file – it has the below line;
    <i>'<Request type="EXECUTE_RELATIONAL" system="BI_JDBC" system_type="SAP_BI_JDBC" maxrows="500" templateid="BIR_SQL"><Objects type="INPUT" shape="OBJ" role="INPUT"><Object type="INPUT_FIELD" id="SQL_STATEMENT" appName="SQL" mapped="0" value=""/></Objects><Objects type="OUTPUT" shape="SET" role="OUTPUT"><Object type="OUTPUT_FIELD" id="name" appName="name"/></Objects><Objects id="1" type="TEMPLATE_PARAMETER"><Object id="2" type="SQL" value="select name from pub.srcompany where name ='Test Company'"/></Objects></Request>';</i>
    It seems that the parser for the flash deployment is prematurely finishing the parse when it hits the single quotation in the SQL string!
    We had a similar error where if we had a carriage return in the SQL (e.g. between the from & the where clause) then the deployment parser was stating that the line finished prematurely. In the deployment file the carriage return forced a new line thus making the message incomplete. Removing the carriage return resolve that issue
    The SQL Preview in the SQL Editor within VC works fine with the string literals in the where clause.
    The functionality compiles & deploys in web dynpro however it does not return the results to the table
    Questions
    1:> Has anyone successfully used flash with string literals in the SQL where clause or had seen this issue in the past?
    2:> Is there a setting to get the SQL working on Web dynpro for the information to be returned that I may have missed?
    Any assistance would be greatly appreciated.
    Best Regards,
    Ian.

    Hey,
    I have worked with SQL Editor a lot. Here's a how to guide I put together on it:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6339e7d4-0a01-0010-1c98-db00e52e989a
    Let me know if that helps...
    Prakash

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

    Hello Friends,
    I have a page with type SQL Query ( PL/SQL function body returning query ).
    I have written a pl/sql block that returns a sql query - select statment.
    Some times i am getting no data found error - does it got to do with the variable that stores the query .
    =======================
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    Error ERR-1101 Unable to process function body returning query.
    OK
    =====================
    When the query is returned with records where exactly the records are stored is it in the variable declared in pl/sql block or with the Oracle Apex implicit cursor.
    Here's the pl/sql block ..
    The query is generated while the user is navigating through pages ..
    ====================
    declare
    l_return_stmt varchar2(32767);
    l_select varchar2(32000);
    l_from varchar2(32000);
    l_where varchar2(32000);
    l_order_by varchar2(32000);
    l_stmt_recordcount varchar2(32000);
    l_recordcount number ;
    begin
    l_select := 'select '||:P10_VARLIST1||:P10_VARLIST2||:P10_VARLIST3
    ||:P10_VARLIST4||:P10_VARLIST5;
    l_from := ' from '||:P10_RELATION;
    if length(:P10_WHERE) > 0 then
    l_where := ' where '||:P10_WHERE;
    else
    l_where := '';
    end if;
    if length(:P10_ORDER_BY) > 0 then
    l_order_by := ' order by '||:P10_ORDER_BY;
    else
    l_order_by := '';
    end if;
    l_return_stmt := l_select||l_from||l_where||l_order_by;
    :P10_STMT := l_return_stmt;
    return l_return_stmt;
    end;
    =============================
    Appreciate your help in this regard.
    thanks/kumar
    Edited by: kumar73 on Apr 22, 2010 6:38 AM

    It looks like the query string you are trying to pass back exceeds the 32K limit for a varchar. Where this is happening is kind of difficult to tell as it could be any number of points, and also depends on what you are passing into the process via page items.
    I would first try to establish what combination of page items causes this error to occur. Then, starting from the bottom and working your way backwards, I would start 'switching off' some of the items you use to build your query until it breaks again, thus establishing which part is leading to the error.
    Also, I'm not sure what :P10_STMT is doing (are you maybe using this for visiblity of the query created)?
    It looks like the query string you are trying to pass back exceeds the 32K limit for a varchar. Where this is happening is kind of difficult to tell as it could be any number of points, and also depends on what you are passing into the process via page items.
    I would first try to establish what combination of page items causes this error to occur. then, starting from the bottom and working your way backwards, I would start 'switching off' some of the items you use to build your query until it breaks again, thus establishing which part is leading to the error.
    Also, I'm not sure what :P10_STMT is doing (are you maybe using this for visiblity of the query created)?

  • How can i pass sql string in proc as in parameter and use in cursor forloop

    Dear Experts ,
    Please help me in below code.
    create or replace PROCEDURE Sample_Spool_Data (SQLSTRING IN VARCHAR2, FILENAME in VARCHAR2) IS
    v_spool_file UTL_FILE.FILE_TYPE ;
    SQLSTRING VARCHAR2(1000);
    BEGIN
    v_spool_file := UTL_FILE.FOPEN('MPLD_DQMT',FILENAME,'w');
    UTL_FILE.PUT_LINE(v_spool_file,'Start: '||to_char(sysdate,'dd/mm/yyyy hh:mi s'));
    FOR c1_rec in SQLSTRING
    LOOP
    UTL_FILE.PUT_LINE(v_spool_file,c1_rec.rec);
    end loop;
    UTL_FILE.PUT_LINE(v_spool_file,'End: '||to_char(sysdate,'dd/mm/yyyy hh:mi s'));
    SQL String is having like select col1, col2, col3 from table_name;

    Looks like you're tring to write a generic way of outputting the results of a query to a file.
    You won't do it the way you're trying to, because your dynamic SQL means that you don't know the resultant columns of the query so that you can output them. To do that you need to use the DBMS_SQL package to describe the query and fetch the returned columns by position e.g.
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /As myuser:
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    PL/SQL procedure successfully completed.Output.txt file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
    Adapt to output different datatypes and styles are required.

Maybe you are looking for

  • Hi everybody! Let's share the experience of using the Gaming PC !

    hi everybody ,I'm spear. Luckily,I spent all the money from Scratch tickets jackpot to buy Gaming AIO AG240.:cool: Now I want to share my using AG240 experience to you in this forum. First, you can't  be debatable AG240 is really great in game perfor

  • BP Creation and configuration

    Hi      Requirement is that we want to use tcode BP in crm for creation of business partner and the same tcode BP we want to use in ECC too. so what are the settings/configuration to be followed that BP created is replicated... Plz help me out.

  • 9500 will not make calls

    WHEN I TRY TO MAKE A CALL THE PHONE SWITCHES OFF. I GET A MESSAGE SAYING "PROGRAM CLOSED", PROGRAM : TELEPHONE REASON CODE : PHONE APP REASON NUMBER : 45 THIS HAPPENS WHEN I USE MY SIM CARD FOR GHANA (I WORK OVERSEAS) IN EITHER OF MY NOKIA 9500s (I H

  • Playing sound/beep on the handheld device using WebDynpro for Java (NW7.01)

    Does anybody know if we could play sounds or beeps on the handheld device using WebDynpro for Java (NW7.01)? We have a client requirement to have the handheld device beeps/makes different kind of sounds after the goods receipt is posted. We are looki

  • Trying to add an icon to a JPanel!

    After declaring the icon w/ : ImageIcon icon = new ImageIcon("logo2.gif"); and the JPanel is added to the content pane, the error I am recieving is w/ this peice of code: jPanel1.add(icon); The error is: cannot reslove symbol, jPanel1.add(icon); ^ I'