12 c call Webservice JDeveloper get "SQL string is not a DML statement" as a SQLException exception

Hi guys,.

I developed a java class to access the database using the OracleDataSource class and run a SQL query with a select statement. It works very well. I have built a wrapper class and as a Web service. I get "SQL string is not a DML statement" as a SQLException exception when I run as a Web service, but it works very well as an application.

No idea why I get this error? Not sure why WebSercie is having a problem while this works as an application.

Thank you and best regards,

Srini Mel

Solved the problem by myself.

The first release "SQL string is not a DML statement" is due to an additional line (pstmt2.executeUpdate ()) in the code.

Second question, receives not the query response is due to bad user input. I walked into 13.21651 instead of 31.21651.

Thank you!

Srini

Tags: Java

Similar Questions

  • How to get SQL that do not use bind variables

    Hello

    I am trying to identify the SQL code which should benefit from the use of bind variables.
    First of all, I tried to get the common signature of all the sql calls, using:
    select * from (
    select  force_matching_signature, count(1) from v$sql where force_matching_signature<>0 group by force_matching_signature order by 2 desc
    ) where rownum < 50;
    Then I copied these values to the Clipboard and run:
    select sql_text from v$sql where force_matching_signature=<<<copied_signature_value>>>;
    Now, I want to make it automatically and get only 1 occurrence of each SQL that resembles others by using a query.

    I tried this:
    select sql_text from
    (
    select sql_text, force_matching_signature, row_number() over (partition by force_matching_signature order by sql_text desc)rn from v$sql where force_matching_signature <>0
    )where rn <2 and rownum < 10 order by force_matching_signature desc
    But it is not returning results by showing up at the count (1) from the first query, I've used. How can I change this if I get the results in order of "importance"?




    Thank you

    And I said. First use the command by then use rownum. I did not mention row_number. Also, there should be no need to add more columns.
    Have you tried it? Why it did not work?

    example not tested

    select * from (
       select sql_text from (select sql_text, force_matching_signature, row_number() over (partition by force_matching_signature order by sql_text desc) rn from v$sql where force_matching_signature != 0)
       where rn = 1
       order by force_matching_signature desc /* add any ordering you like here */
       )
    where rownum < 10  /* then filter on the first 10 results */
    

    If you want to order that the statement that found most of the time comes first, say so. However, I don't see how to group in your case.
    Maybe like this

    example of tested

    select * from (
       select cnt, sql_text
       from (select sql_text, force_matching_signature, row_number() over (partition by force_matching_signature order by sql_text desc) rn , count(*) over (partition by force_matching_signature) cnt
             from v$sql
             where force_matching_signature != 0)
       where rn = 1
       order by cnt desc, force_matching_signature desc /* add any ordering you like here */
       )
    where rownum < 10  /* then filter on the first 10 results */
    ;
    

    Published by: Sven w. October 11, 2012 14:49

    Published by: Sven w. October 11, 2012 14:51

    Published by: Sven w. on October 11, 2012 14:56 - number column added to the output

  • AWR SQL Report does not report the stats

    AWR report only stats beyond a certain level? I have a statement select simple I know is running (executions of v$ sql increases), but when I run a report AWR SQL (awrsqrpt), it says "no data exists for this section of the report.

    Snap Id Snap time Sessions Curs/Sess

    --------- ------------------- -------- ---------

    BEGIN Snap: 370936 10 June 15 07:00:24 856 36.1

    End Snap: 370937 10 June 15 07:20:26 881 38.9

    Elapsed time: 20.02 (mins)

    DB time: 754.82 (min.)

    Summary of SQL DB/Inst: CAMPRD/camprd snaps: 370936-370937

    There is no data for this section of the report.

    -------------------------------------------------------------

    SQL ID: 84kfv4p500pgh DB/Inst: CAMPRD/camprd Snaps: 370936-370937

    There is no data for this section of the report.

    -------------------------------------------------------------

    Full text of SQL

    There is no data for this section of the report.

    I ran the report on the last 4 days and reports

    ORA-20025: SQL 84kfv4p500pgh ID does not exist for this database instance.

    and yet, the executions of V$ SQL continues to increase

    Thank you

    Ian

    CWA only captures statements considered to be Top N (DBA_HIST_WR_CONTROL. TOPNSQL)

    You can use DBMS_WORKLOAD_REPOSITORY. ADD_COLORED_SQL sort AWR it will include

  • How to call the package from a SQL string function

    I create a SQL string in my c# application. Within the selection, I have a function call to a package in my diagram.

    ex.

    "Select id, package1.fncFormat (text) of tblText".

    If I run this within Oracle it works fine but when I run my application and the SQL runs the use of OracleDataReader I get


    «ORA-00904: "PACKAGE1".» ' FNCFORMAT': invalid identifier.

    Is this possible to do?

    It is a dynamic sql string that is built using many different options.

    Thanks for any help

    Do you run this application and directly on DB package by the same user?
    Check the privileges of the user on the application.

    Kind regards
    Bobin

  • How do 3 similar fun generate different sql string in the call of 1 db

    Hi all
    In my sql package I use 3 different functions to create two different sql strings and the 3rd function does some calculations of percentage. My Db architect on the revision of the code suggest to me that these two functions are almost the same except the sql string, it generates. Then she asked me to write a function that does everything in a db call.

    "_Function 1_ '.

    FUNCTION get_class_select_text
    (
    in_report_parameter_id in NUMBERS
    )
    RETURN VARCHAR2
    IS

    my_class_select_text VARCHAR2 (10000);
    my_class_select_value VARCHAR2 (10000);

    CURSOR class_select_text IS
    SELECT ' SUM (DECODE (bin_id, ' | report_parameters.report_parameter_value))
    || bin_value, 0)) ' Class' | report_parameters.report_parameter_value | '" '
    OF report_parameters
    WHERE report_parameters.report_parameter_id = in_report_parameter_id
    AND report_parameters.report_parameter_group = 'CLASS '.
    AND report_parameters.report_parameter_name = 'CLASS '.
    GROUP BY
    report_parameters.report_parameter_value
    ORDER BY
    CAST (report_parameters.report_parameter_value AS NUMBER);

    BEGIN

    my_class_select_text: = ";

    OPEN class_select_text.

    LOOP

    SEEK class_select_text INTO my_class_select_value;

    EXIT WHEN class_select_text % NOTFOUND;

    my_class_select_text: = my_class_select_text | ', ' || my_class_select_value;

    END LOOP;

    CLOSE Class_select_text;

    RETURN my_class_select_text;

    END get_class_select_text;

    FUNCTION 2:


    FUNCTION get_class_sum_text
    (
    in_report_parameter_id in NUMBERS
    )
    RETURN VARCHAR2
    IS

    my_class_sum_text VARCHAR2 (10000);
    my_class_sum_value VARCHAR2 (10000);

    CURSOR class_sum_text IS
    SELECT ' SUM (NVL ("Class' |")) report_parameters.report_parameter_value | ""(, 0)) ' class' | "" report_parameters.report_parameter_value | '" '
    OF report_parameters
    WHERE report_parameters.report_parameter_id = in_report_parameter_id
    AND report_parameters.report_parameter_group = 'CLASS '.
    AND report_parameters.report_parameter_name = 'CLASS '.
    GROUP BY
    report_parameters.report_parameter_value
    ORDER BY
    CAST (report_parameters.report_parameter_value AS NUMBER);

    BEGIN

    my_class_sum_text: = ";

    OPEN class_sum_text.

    LOOP

    SEEK class_sum_text INTO my_class_sum_value;

    EXIT WHEN class_sum_text % NOTFOUND;

    my_class_sum_text: = my_class_sum_text | ', ' || my_class_sum_value;

    END LOOP;

    CLOSE Class_sum_text;

    RETURN my_class_sum_text;

    END get_class_sum_text;

    FEATURE 3:


    FUNCTION get_class_perc_text
    (
    in_report_parameter_id in NUMBERS
    )
    RETURN VARCHAR2
    IS

    my_class_perc_text VARCHAR2 (10000);
    my_class_perc_value VARCHAR2 (10000);

    CURSOR class_perc_text IS
    SELECT ' ROUND ((("Class' ||)) report_parameters.report_parameter_value | "' / 'Total') (* 100)(, 2) ' class |" " report_parameters.report_parameter_value | '" '
    OF report_parameters
    WHERE report_parameters.report_parameter_id = in_report_parameter_id
    AND report_parameters.report_parameter_group = 'CLASS '.
    AND report_parameters.report_parameter_name = 'CLASS '.
    GROUP BY
    report_parameters.report_parameter_value
    ORDER BY
    CAST (report_parameters.report_parameter_value AS NUMBER);

    BEGIN

    my_class_perc_text: = ";

    OPEN class_perc_text.

    LOOP

    SEEK class_perc_text INTO my_class_perc_value;

    EXIT WHEN class_perc_text % NOTFOUND;

    my_class_perc_text: = my_class_perc_text | ', ' || my_class_perc_value;

    END LOOP;

    CLOSE Class_perc_text;

    my_class_perc_text: = my_class_perc_text | ', ' || ' DECODE 'Total' ('Total', -1, 0, 100) ';

    RETURN my_class_perc_text;

    END get_class_perc_text;


    Could someone help me?

    Thanks in advance.

    Hello
    Never write, not to mention NPA, not formatted.
    Use the spaces so that how the code appears on the screen reflects what it does.
    In particular, to align the bunk directly following each other.
    (a) IS, BEGIN, EXCEPTION and END statements
    (2) the instructions of LOOP and END LOOP
    (3) provisions (SELECT, FROM, WHERE,...) in SQL statements
    (4) number of arguments for the same function (unless they are very simple)
    When displaying a kind of formatting text on this site, type the 6 characters:
    {code}
    (small letters only, inside curly braces) before and after the formatted text, to maintain spacing.

    user10641405 wrote:
    Hi all
    In my sql package I use 3 different functions to create two different sql strings and the 3rd function does some calculations of percentage. My Db architect on the revision of the code suggest to me that these two functions are almost the same except the sql string, it generates. Then she asked me to write a function that does everything in a db call.

    Looks like you are using 3 different functions to create 3 different channels.
    All 3 functions return the results of a query that has a column, a string that is made by concatenating strings under 5.
    It looks like the only differences between the 3 functions are:
    (a) the chains under 1st and 3rd in the concatenation are different in each case
    (b) of the function, we add additional text at the end of the query results

    Here's a way to combine these functions, so that you call
    get_class_text (x, "SELECT") instead of get_class_select_text (x),
    get_class_text (x, "SUM") instead of get_class_sum_text (x), and
    get_class_text (x, "PERC") instead of get_class_perc_text (x).

    FUNCTION get_class_text
    (
         in_report_parameter_id IN NUMBER
         in_which            IN VARCHAR2 DEFAULT 'SELECT'
    )
    RETURN VARCHAR2
    IS
         end_text        VARCHAR2 (50)   := '';
    
         my_class_perc_text VARCHAR2(10000) := '';
    
         CURSOR class_perc_text ( c_1_text     VARCHAR2 (50)
                                 , c_2_text     VARCHAR2 (50)
                          )
         IS     SELECT  c_1_text || report_parameters.report_parameter_value
                               || c_3_text
                               || report_parameters.report_parameter_value
                               || '" '
         FROM    report_parameters
         WHERE     report_parameters.report_parameter_id     = in_report_parameter_id
         AND     report_parameters.report_parameter_group  = 'CLASS'
         AND     report_parameters.report_parameter_name   = 'CLASS'
         GROUP BY
                 report_parameters.report_parameter_value
         ORDER BY
                 CAST(report_parameters.report_parameter_value AS NUMBER);
    BEGIN
         IF  UPPER (in_which) = 'SUM'
         THEN
              OPEN class_perc_text ( 'SUM(NVL("Class '
                                  , '", 0)) "Class '
                             );
         ELSIF  UPPER (in_which) = 'PERC'
              OPEN class_perc_text ( 'ROUND((("Class '
                                  , '" / "Total") * 100), 2) "Class '
                             );
              end_text := ', DECODE("Total", -1, 0, 100) "Total" ';
         ELSE
              OPEN class_perc_text ( 'SUM(DECODE(bin_id, '
                                  , ', bin_value, 0)) "Class '
                             );
         END IF;
    
         LOOP
              FETCH class_perc_text INTO my_class_perc_value;
              EXIT WHEN class_perc_text%NOTFOUND;
    
              my_class_perc_text := my_class_perc_text || ', ' || my_class_perc_value;
         END LOOP;
    
         CLOSE class_perc_text;
         my_class_perc_text := my_class_perc_text || end_text;
    
         RETURN my_class_perc_text;
    END get_class_text;
    

    Note how you can have settings for a cursor, so that certain expressions used in the cursor must not be known when the cursor is declared: they can be given when the cursor is opened.

  • dynamic SQL for OPEN will not take the SQL string in the form of a string variable

    Hello

    I use "OPEN-for", not "EXECUTE IMMEDIATE" because I want to do multi lines request. However, 'OPEN-for' won't take a variable "strSQL' in the clause, it only took fixed ropes?

    create or replace function fnEnumSystemUser
    (
    LogonFilter nvarchar2,
    ...
    AdditionalWhereClause nvarchar2,
    OrderByClause nvarchar2
    )
    RETURN xxxxx.cursorType
    AS
    strSQL nvarchar2 (2000);

    FormatAdditionalWhereClause nvarchar2 (2000);
    FormatOrderByClause nvarchar2 (2000);

    SystemUserCursor xxxxx.cursorType;
    BEGIN

    If AdditionalWhereClause IS NULL THEN
    FormatAdditionalWhereClause: = ' ';
    ON THE OTHER
    FormatAdditionalWhereClause: = TRIM (AdditionalWhereClause);
    END IF;

    If OrderByClause IS NULL THEN
    FormatOrderByClause: = ' ';
    ON THE OTHER
    FormatOrderByClause: = TRIM (OrderByClause);
    END IF;

    strSQL: = 'select Id, FirstName, MiddleName, LastName, PrimaryEmail, PersonType, CreateDate, CreatedBy, LastUpdate, LastUpdateBy, connection, PasswdHash, IsSuspended, had left join SystemUser person on SystemUser.PersonId = Person.Id';
    -It won't work, just says "WARNING: compiled, but with compilation errors" when I tried to create the function
    Open SystemUserCursor for strSQL;

    -This is to call "ORA-01006: bind variable does not exist.
    Open SystemUserCursor
    ' select Id, FirstName, MiddleName, LastName, PrimaryEmail, PersonType, CreateDate, CreatedBy, LastUpdate, LastUpdateBy, connection, PasswdHash, IsSuspended, had left join SystemUser person on SystemUser.PersonId = Person.Id WHERE SystemUser.Logon like: x: y ' using LogonFilter, OrderByClause;

    -This failed also (on call, "ORA-00900: invalid SQL statement")
    Open SystemUserCursor
    ' select Id, FirstName, MiddleName, LastName, PrimaryEmail, PersonType, CreateDate, CreatedBy, LastUpdate, LastUpdateBy, connection, PasswdHash, IsSuspended, had left join SystemUser person on SystemUser.PersonId = Person.Id WHERE SystemUser.Logon like: x' | OrderByClause using LogonFilter;

    RETURN SystemUserCursor;
    END;

    That's how I invoked:
    declare
    Int NumItemsSelected;
    lstResult xxxxx.cursorType;

    TYPE SystemUserRecordType IS RECORD
    (
    ID numeric (19.0),.
    FirstName nvarchar2 (50).
    MiddleName nvarchar2 (50).
    LastName nvarchar2 (50).
    PrimaryEmail nvarchar2 (190),
    PersonType int,
    CreateDate timestamp,
    CreatedBy numeric (19.0),.
    LastUpdate timestamp,
    LastUpdateBy numeric (19.0),.

    Logon nvarchar2 (75).
    PasswdHash int,
    IsSuspended tank,
    Display timestamp
    );
    SystemUserRecordType oUser;
    Start

    lstResult: = fnEnumSystemUser (...) '%',... Person.PrimaryEmail like '% a %', "order by ASC Logon", 0, 10, NumItemsSelected);
    LOOP
    extract lstResult in oUser;
    When the output lstResult % notfound;
    dbms_output.put_line ('Id: ' | oUser.Id);
    END LOOP;
    end;

    I need the ability to add to the SQL string because ultimately say I need to join:
    1. ORDER BY section
    2 call a FUNCTION in WHERE Clause
    3 pagination and ROW_NUMBER() clause

    What can I do? Thank you!

    1. why you use NVARCHAR2 to the SQL string. Use VARCHAR2 or LONG.

    2. use

     tags to preserve formatting of your code.
    
    3. In the bind variable does not exist example it looks like you have one bind, :y, but are trying to bind two variables logonfilter and orderbyclause.
    
    4. In the third example, try logging the sql string in a table or dbms_output and running it in sql - you should get the same error and it might then be easier to diagnose.
    
    Cheers,
    Dominic                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
    
  • How to get SQL * more to connect to my database of Apex?

    How can I get SQL * more to connect to my database of Apex? By using the username and password I use to connect to Apex does not (ORA-01017). What should I do to connect to my db Apex?

    Thank you
    Kim

    Connection string is "connect username/password@database".

    The analysis schema is a database account, that's why you can log on to SQL * more like that.

    This allows to get the database name

    select instance_name from v$instance;
    

    And if you forgot the password for the PT

    alter user PT identified by 'your_new_password';
    

    Scott

  • build the sql string

    I build my sql in java string and then pass it to Hibernate query

    I add several conditions based on user research

    This is a simple condition 'and' I create and add
              if(StringUtils.isNotBlank(stgAuditGeneral.getAuditeename())){
                   filter=" and lower(AUDITEE_NAME) like '%?%' ";
                   sqlqQuery=sqlqQuery+StringUtils.replace(filter, param, StringUtils.lowerCase(stgAuditGeneral.getAuditeename()));
              }
    Assume that the user has entered
     lourt's 
    generated SQL will be
    and lower(AUDITEE_NAME) like '%lourt's%'  and   ......
    If the user enters the quotes for stgAuditGeneral.getAuditeename () my String sql will be curreprted and I get sql exception

    Please suggest me how to avoid this problem

    user11138293 wrote:
    I'm using hibernate,
    I pass the query parameter is the request that I create, please tell me in this case can I use preparedstatement way settings?

    Hibernate provides similar functionality. Review the class SQLQuery (createSQLQuery returns). It has methods like setString(), setInteger() that allow you to replace the two positional parameters (as? 1? 2) or of named parameters (as: param1,: param2) in the query.
    There is absolutely no reason why this day and age everyone should be concatenating queries SQL and parameters set as strings.

  • How to get a string changed to be reassessed

    Hello, I am very new to TS and do not know if I express the problem clearly. However the question below:

    Trying to change a numeric variable before it is evaluated at execution, and what I have is:

    Val (searchandreplace ("FileGlobals.I_LB_bin [FileGlobals.loop_BINi]", "lb", FileGlobals.mode [locals. ModeI])) / 2

    but after that the replacement seems that the val function can get the value with the new string.

    How can I get a string to represent a value and be evaluated after edit?

    Thank you very much!

    Hello

    I'm assuming you are trying to get a variable expression that is evaluated during the execution. I would like to make the following

    Locals.Num = Val (Evaluate (SearchAndReplace ("Locals.Var_X", "X", Locals.Control_Num)))

    All variables are String, and the output is a number on which you can perform more arithmetic.

    Dodnt you need the Locals.Var_X variable at all. I just created during my tests.

    Rognard

  • How to get the string (specified by row and column) of txt file with labview

    Hello world

    How to get the string (specified by row and column) of txt file with labview

    THX

    As far as I know, a text file has no column.  Be more specific.  Do you mean something like the 5th word on line 4, where the words are separated by a space, and lines are separated by a newline character?  You can read from the spreadsheet String function and set the delimiter to a space.  This will produce a 2D channels table.  Then use the table to index and give the line number and column number.

  • When executing "Difficulty It Center Microsoft" I get a message "input string was not in a correct format." What does that mean?

    When executing "Difficulty It Center Microsoft" I get a message "input string was not in a correct format." What does that mean?

    Hello

    The question you have posted is related to Microsoft fix and would be better suited in the Microsoft Support Tools Forums. Please visit the link below to find a community that will provide the support you want. http://social.Microsoft.com/forums/en-HK/fixitcenter/threads

  • Why are there people tecsavy call me to get money for my microsoft programs I already bought with my computers and they crashed my good computer

    Why are there people tecsavy call me to get money for my microsoft programs I already have bought with my computers and they crashed my good computer, I am a stay home Grandma take care my 3 grandchildren, they wanted 300. for my computer with windows vista and now they want 190. for this computer, why microsoft would let people do such things

    s7cwa7

    Hi Julie,.

    Microsoft has none of the unsolicited telephone calls to help you fix your computer. You can consult the following documentation to learn more about the same.

    Avoid phone scams | A cybercriminal Tech Support Scam | Security threats

    Fraudulent emails and credit scam advice cards | Microsoft Security

  • got this trogen called tdss cannot get rid of it

    Backdoor

    got this trogen called tdss cannot get rid of it any help?

    Hi read the information below

    http://www.bleepingcomputer.com/virus-removal/remove-TDSS-tdl3-Alureon-rootkit-using-TDSSKiller

  • Getting a string of an agent customized by groovy

    I have a number of custom scripts agent and I can retrieve values using the query function:

    def qryService = server.get ("QueryService")

    qryStatement = qryService.createStatement ("metrics from table where monitoredHost.name = servername spanning from date time time_span")

    metricValue = avg (qryService.executeStatement (qryStatement))

    I can get the digital values appearing as ObservedValues in the script if editor I come down on the Forum, but I was not able to get the string values that are listed without comment by "ObservedValue".  The avg() statement above won't work of course for a string, but take it from me either Gets an empty container ([{} {}] or something that I have not been able to analyze (I'm a sysadmin, my JAVA and groovy is limited).)  I tried to use topologyobject instead of QueryService but I did not have what I wanted.

    I would like suggestions.

    Right you are, that works.

  • Adobe LiveCycle webservice does not call webservice

    Hi all

    I use Adobe Livecycle ES2. I tried to call a Web service in my company for purposes of development. I imported the wsdl file into the layout as a new connection. I dragged and dropped the button and the fields of application for the layout. But in the preview and in the saved pdf file I am not able to invoke the Web service when I click the button. I tried the different Web services both to the wsdl file and also the location of some online Web services http. It used to work fine for me in version 8 of adobe livecycle. Now, I'm unable to call Web services at all the .the Please tell me if all the settings must be enabled in the new version so this button will call a webservice call.

    1.jpg

    2.jpg

    Thank you and best regards,

    JF Meyer

    Hi JF, you use Acrobat to display a preview of the form?  If you use Reader then it won't work.  I have not hurt to call webservices otherwise.  Bruce

Maybe you are looking for