PL/SQL: SQL statement ignored

Hi all

10g on solaris 10


Begin
2 Loop
3 delete from calls.incalls
4 partition(apr201001) e
5 where exists (select 1
from calls.incalls
6 7 partition(apr201001)
8 where calltype in ('001','031','050','051','055') and transdate between '01-apr-2010' and '02-apr-2010')
9 )
10 and rownum<=100000;
11 if SQL%ROWCOUNT = 0 then
12 exit;
end if;
13 14 commit;
end loop;
15 16 end;
17 /
)
*
ERROR at line 9:
ORA-06550: line 9, column 24:
PL/SQL: ORA-00933: SQL command not properly ended
ORA-06550: line 3, column 4:
PL/SQL: SQL Statement ignored
requirement is that I need to delete records of 100000 and put a commit...
the code above works this way?

Kai

Hello

you have a ') ' to much, remove the line 9.

Herald tiomela
htendam.WordPress.com

Tags: Database

Similar Questions

  • PL/SQL: Statement ignored SQL error (SELECTing row, expression arithmetic/s)

    Quick question, on the execution of the query of the ff, I do

    Select a.column, sum (decode(a.column,'string',1,'etc...')

    But when I include a func or procedure, it won't allow me too and that he would give a PL/SQL: SQL statement ignored error and it will compile only if I remove the first a.column as follows

    Select sum (decode(a.column,'string',1,'etc...')

    Why is it so? And how should it be rewritten to include the select a.column?

    Start

    Select a.gameid, sum (decode(a.nscores,'Perfect',100,'Excellent',95,'Good',80,'Poor',50) 'scores'

    in x,y

    Of...

    where the...

    return x

    end myFunc;


    Fundamentals of the PL/SQL language


    Concerning

    Etbin

  • "PL/SQL: statement ignored ' from the outset?

    I am brand new to PL/SQL and I just can't understand what is wrong. Any help?
    SQL> 
    SQL> create or replace procedure HW3 (
      2            p_buy number    ) as
      3  
      4            v_pay number;
      5  
      6  begin
      7            v_pay := p_buy(3/4);
      8  
      9            dbms_output.put_line ('You entered: ' || p_buy);
     10            dbms_output.put_line ('You will be charged for: '||trunc(v_pay));
     11  
     12  end;
     13  /
    
    Warning: Procedure created with compilation errors.
    
    SQL> 
    SQL> show errors;
    Errors for PROCEDURE HW3:
    
    LINE/COL ERROR                                                                  
    -------- -----------------------------------------------------------------      
    7/2      PL/SQL: Statement ignored                                              
    7/11     PLS-00222: no function with name 'P_BUY' exists in this scope          
    SQL> 
    SQL> spool off
    I did very simple procedures with several settings, but this code just won't go.

    Have you defined a p_buy function?

    Or finally do you hear that in the first line after begin in your code?

    v_pay := p_buy * (3/4);
    

    When you write p_buy(3/4) the compiler thinks p_buy is a function and you want to call with parameter 3/4.

    Published by: hm on 11.10.2011 23:39

  • Error in Trigger (PL/SQL: SQL statement ignored)

    Here are the trigger:

    CREATE OR REPLACE TRIGGER DRUGREPLACEMENT
    AFTER INSERT ON PHARMACEUTICAL PRODUCTS
    REFERENCING AS NEW newDrugs
    FOR EACH LINE
    WHERE (newDrugs.drugname = newDrugs.genericname)
    BEGIN
    UPDATE of prescription
    SET pharmaceuticalid = newDrugs.drugID
    WHERE pharmaceuticalid IN (SELECT pharmaceuticalid FROM prescription drugs WHERE drugid = pharmaceuticalid AND newDrugs.genericname = pharmaceutical.genericname);
    END;

    Error is:
    Error (2.1): PL/SQL: statement ignored
    Error (3.24): PL/SQL: ORA-00904: "NEWDRUGS. "" DRUGID ": invalid identifier

    pharmaceuticalid is a number in my table of prescription.
    drugid is a number; Genericname and drugname are two varchars in my table of pharmaceuticals. No idea why I get these errors? (I tried to put quotes around newdrugs.drugid, but then he said he just 'newdrugs.drugid' is not valid.) Thanks for your help
    -Brian

    Brian,

    I think that uou you will need to put a colon (:)) in front of the alias "newDrugs" which introduces you to the regular: new alias.)

    Toon

  • error: PL/SQL statement ignored

    In the code below, I get 3 errors:
    a. PL/SQL statement ignored
    b. PLS-00201
    c. PL/SQL: ORA-00904: invalid identifier

    Help, please. Thank you


    =========================================
    Package body:
    =========================================
    create or replace package BODY manage_students
    as
    procedure find_sname
    (i_student_id IN student.student_id%TYPE,
    o_first_name ON student.first_name%TYPE
    o_last_name ON student.last_name%TYPE)
    IS
    v_student_id student.student_id%TYPE;
    BEGIN
    Select first_name, last_name
    in o_first_name, o_last_name
    the student
    where student_id = i_student_id;
    exception
    while others
    then
    DBMS_OUTPUT. Put_line (' error in search of student_id: ' | v_student_id);
    end find_sname;

    function id_is_good
    (i_student_id to student.student_id%TYPE)
    Returns BOOLEAN
    IS
    number of v_id_cnt;
    Start
    Select count (*)
    in v_in_cnt
    the student
    where student_id = i_student_id;
    return 1 = v_id_cnt;
    EXCEPTION
    while others then
    return FALSE;.
    end id_is_good;
    END manage_students;

    /

    =========================
    Package specifications:
    =========================
    Set serveroutput on
    create or replace package manage_students
    as
    procedure find_sname
    (i_student_id IN student.student_id%TYPE,
    o_first_name ON student.first_name%TYPE
    o_last_name ON student.last_name%TYPE
    );
    function id_is_good
    (i_student_id IN student.student_id%TYPE)
    RETURN A BOOLEAN VALUE;
    END manage_students;

    /

    Published by: [email protected] on March 19, 2009 06:03

    Published by: [email protected] on March 19, 2009 06:03

    Perhaps here:

    number of v_id_cnt; ----
    Start
    Select count (*)
    in v_in_cnt-

  • problem when creating a trigger: SQL statement ignored

    Hello people,

    I am trying to create a trigger, but it is not created. Instead, I get the error message that a SQL statement at line 22 was ignored. It's the line indicating IF num2 = 1 THEN. I'd be happy if someone could point me in the right direction or solve my problem.

    CREATE OR REPLACE TRIGGER TriggerLogement BEFORE INSERT OR update ON tenants
    FOR EACH LINE
    DECLARE
    NUM INTEGER;
    num2 INTEGER;
    NUM3 INTEGER;
    paysLocataire VARCHAR2 (255);
    categorieLocataire VARCHAR2 (1);
    BEGIN
    SELECT COUNT (ns) IN the number OF tenants WHERE nomBat =: new.nomBat;

    IF num > 0 THEN
    SELECT paid IN the country OF sports WHERE ns =: new.ns;
    SELECT COUNT (country) IN number OF athletes sp, tenants lo WHERE sp.ns = lo.ns AND paysLocataire AND lo.nomBat = pays =: new.nomBat;
    IF num = 0 THEN
    raise_application_error (-20000, "building already in use for another nationality");
    ON THE OTHER
    SELECT COUNT (ns) IN num2 OF tenants WHERE nLogement =: new. NLogement AND nomBat =: new.nomBat;
    IF num2 = 2 THEN
    raise_application_error (-20000, 'full accommodation');
    ON THE OTHER
    IF num2 = 1 THEN
    CateogrieLocataire INTO SELECT category OF athletes WHERE ns = new.ns;
    SELECT COUNT (ns) IN num3 FROM tenant lo, sportsmen sp WHERE lo.ns = sp.ns
    AND lo.nLogement =: new. NLogement AND lo.nomBat =: new.nomBat AND sp.categorie = categorieLocataire;
    IF num3 = 0 THEN
    raise_application_error ("-20000, ' already in use for the other sex");
    END IF;
    END IF;
    END IF;
    END IF;
    END IF;
    END;

    If you need more information or if you have any questions about my posts please leave your questions or comments. I hope this isn't how completely wrong to enforce some constraints that I can't do with CONSTRAINT and CHECK in the schema definition.

    Thanks for your help and your attention.

    Sebastian

    Hello

    Whenever you have a problem that raises an error, display the full error message; do not paraphrase just part of it.

    In the triggers line numbers from the first statement DECLARE or BEGIN, so line 22 of your trigger is:

    SELECT categorie INTO cateogrieLocataire FROM Sportifs WHERE ns = new.ns;
    

    You are missing a colon before 'new': it should be:

    SELECT categorie INTO cateogrieLocataire FROM Sportifs WHERE ns = :new.ns;
    

    A FOR EACH ROW trigger on tenants cannot ask tenants. It's a shame: there are many useful things, you could do if that were allowed, but it's not.
    I'm not sure of what all queries. At least one of them:

    SELECT  COUNT (ns)
    INTO    num2
    FROM    Locataires
    WHERE   nLogement = :new.NLogement
    AND     nomBat    = :new.nomBat;
    
    IF num2 = 2 THEN
        raise_application_error(-20000,'accomodation full');
    

    can be replaced by a UNIQUE constraint. (Constraints are better than triggers, in any case.)

    If you can't do what you want with constraints, you can leave anyone directly INSERT or update the table: force them to use a procedure stored instead. You can have an INSTEAD OF trigger on a view, which is essentially the same, but allows you to use DML commands.

    If you need help, post some sample data and some examples of DML operations that must be allowed, given the data and some examples of DML operations that should not be allowed.

  • Question of SQL statement

    I have this PreExpression at a stage of SQL statement:

    Locals.SQL_LatestResult = "SELECT UUT_RESULT.ID, UUT_RESULT. UUT_SERIAL_NUMBER, UUT_RESULT. START_DATE_TIME UUT_RESULT WHERE (((UUT_RESULT. UUT_SERIAL_NUMBER) =------"' + Locals.serial + ' \ ') AND ((UUT_RESULT." START_DATE_TIME) = (SELECT MAX (UUT_RESULT2. START_DATE_TIME) OF UUT_RESULT AS UUT_RESULT2 WHERE UUT_RESULT. UUT_SERIAL_NUMBER = UUT_RESULT2. UUT_SERIAL_NUMBER))); »

    Locals.SQL_LatestResult has this value after the PreExpression:

    SELECT UUT_RESULT.ID, UUT_RESULT. UUT_SERIAL_NUMBER, UUT_RESULT. START_DATE_TIME UUT_RESULT WHERE (((UUT_RESULT. UUT_SERIAL_NUMBER) = "15514011") AND ((UUT_RESULT. START_DATE_TIME) = (SELECT MAX (UUT_RESULT2. START_DATE_TIME) OF UUT_RESULT AS UUT_RESULT2 WHERE UUT_RESULT. UUT_SERIAL_NUMBER = UUT_RESULT2. UUT_SERIAL_NUMBER)));

    I get the number of records = 0, if I run the sequence.

    If I copy the exact same SQL query in access I get what I want to know a record.

    If I remove that part of the query:

    ((UUT_RESULT. UUT_SERIAL_NUMBER) =------"" + Locals.serial + "\") "

    I get 388 records which is correct and it run directly in access.

    What's not here?

    I was too fast for this post... it's my fault, the database link was wrong, so data were there...

    Statements are very good!

  • With the help of a number variable in a SQL statement

    Hello

    I am trying to use a variable in a sql statement, and I ran into problems when the variable is a number. The following line of code works if the variable is a string, but not if it is a number.

    "SELECT PAGE 1 UUT_STATUS OF UNIT_UUT_RESULT WHERE UnitID = '" + Locals.LocalUnitID + "' ORDER BY DESC START_DATE_TIME.

    Is there a difference in the use of single and double quotes and the sign for numbers variables +?

    Thank you

    Stuart

    Jervin is almost correct in the post above.

    While it is correct that numbers in SQL are not enclosed in single quotes ('), we still need the entire expression to a string.  If Locals.LocalUnitID is stored as a number to TestStand, you will need to cast to a string so that the string concatination works properly.

    I believe that the correct form is as follows:

    "SELECT PAGE 1 UUT_STATUS OF UNIT_UUT_RESULT WHERE UnitID ="+ Str (Locals.LocalUnitID) + 'ORDER BY DESC START_DATE_TIME'

  • Game of demand does not pick up the good period open to active fixed from the SQL statement

    Hello

    We have a demand that could kick off the simultaneous application of the value: Ixr: list of asset by period and Ixr: reserve book report.


    ON overall demand, we set the parameter: default period based on a SQL = select period_name from FA_DEPRN_PERIODS where book_type_code = 'PER2011' and period_close_date is null


    The query runs with the good period, until we open the new period, the game application will still come closed period.

    When I run this script on the database, it gives the correct name of the open period.


    Why all the demand does not pick up the open period?


    Rock


    Hello

    When planning, the parameter values that you gave when planning will not change.

    For the test, for a simultaneous program, I create a parameter and has given the value 100 tank and default type sql statement and the value as below.

    Select to_char (sysdate, 'dd-mon-yyyy hh24:mi:ss') of double

    If, at the time of the program, it shows a default value such as the date and time with seconds. Then I planned it for every minute.

    When you check in for each race it is seen the first time only, it does not.

    so in your case, you must plan its new after change of period.

    Hope this will help you...

  • What are these SQL statements?

    Hello!

    We are our applications running on Windows Server 2003 where it works fine, using Oracle via OCI 12.1.

    Now, we have the application installed on Windows Server 2012 and it works very slowly.

    When comparing these two environments trace files came a surprise: Oracle generates a lot of SQL statements when run on Windows Server 2012!  By operating on Windows2003 it only executes the SQL from the applicaton instructions.  These additional SQL statements must be the reason for the slowness, but why Oracle it generates them and how could we get arrested?

    An example:

    PARSING IN CURSOR #46985062096816 len = 210 dep = 2 uid = 0 oct = cover 3 = 0 tim = hv 1439277877325893 = ad 864012087 = "4db599f28" sqlid = "96g93hntrzjtr."

    Select / * + rule * / bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp #, sample_size, minimum, maximum, distcnt, lowval, hival, density, col #, spare1, spare2, hist_head avgcln $ where obj #=: 1 and intcol #=: 2

    END OF STMT

    ANALYSIS #46985062096816:c = 1000, e = 456, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 3, plh = 0, tim = 1439277877325890

    EXEC #46985062096816:c = 0, e = 498, p = 0, cr = 0, cu = 0, put = 1, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326455

    FETCH #46985062096816:c = 0, e = 56, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326533

    STAT #46985062096816 id = 1 cnt = 1 pid = 0 obj = op 411 = pos = 1 "TABLE ACCESS BY INDEX ROWID HIST_HEAD$ (cr = 3 pr = 0 pw = time 0 = 55 US)"

    "STAT #46985062096816 id = 2 cnt = 1 pid = 1 pos = 1 obj = op 413 ='INDEX RANGE SCAN I_HH_OBJ #_INTCOL # (cr = 2 pr = 0 pw = time 0 = 32 US)"

    OUTCOME #46985062096816:c = 0, e = 37, dep = 2, type = 3, tim = 1439277877326601

    EXEC #46985062096816:c = 0, e = 23, p = 0, cr = 0, cu = 0, set = 0, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326702

    FETCH #46985062096816:c = 0, e = 18, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326738

    OUTCOME #46985062096816:c = 0, e = 8, dep = 2, type = 3, tim = 1439277877326765

    EXEC #46985062096816:c = 0, e = 19, p = 0, cr = 0, cu = 0, set = 0, r = 0, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326837

    FETCH #46985062096816:c = 0, e = 21, p = 0, cr = 3, cu = 0, set = 0, r = 1, dep = 2, og = 3, plh = 2239883476, tim = 1439277877326923

    OUTCOME #46985062096816:c = 0, e = 10, dep = 2, type = 3, tim = 1439277877326954

    Thank you very much in advance!

    Best regards

    Jaakko Terhonen

    Thank you all for the reply!  This time, the reason was a problem in network traffic (TCP protocol): a lot of retransmissions for a still unknown reason.  If it had nothing to do with Oracle after all.

    I cried for help here because as a common application programmer, I wasn't familiar with the Interior details of SQL analysis and after seeing it in the trace, I assumed that these strange SQL statements - which, for some reason, is appeared only in W2012-trace - were the reason for the slowness.

    Thank you, I'm a little wiser now - and I hope that many others find this thread before asking the same question!

    Best regards

    Jaakko Terhonen

  • How can I pass a condition of the table in the sql statement?

    For example, in the table in the COND Varchar2 column (200) there is the value ' VAR > 10'.

    | COND |

    |' VAR > 10' |

    where VAR is the name of the table column. I would like to make statement CASE WHEN VAR > 10 AND 0... I tried with as subquery

    WHEN BOX (SELECT COND FROM TABLE WHERE...) THEN 0, but it does not work.

    Hello

    You can do this by using dynamic SQL.

    that is to say:

    declare
      v_stm      varchar2(4000);
      v_cond      varchar2(100);
      v_result    integer;
    begin
      select cond
        into v_cond
        from yourtable
      where a=1;
    
      v_stm := 'select case when '||v_cond||' then 0 ...';
    
      -- dynamic sql
      execute immediate v_stm
        into v_result;
    
    end;
    /
    

    Remember that, in general, dynamic SQL has a performance degradation that SQL static and should be avoided when possible.

    Storage condition or the SQL statements in the tables is not a good practice.

    Kind regards.

    Alberto

  • Identify the SQL statements that are executed frequently

    I would like to identify SQL statements that are executed may times (e.g., > 1000 times) during an interval AWR.

    I am aware of coloring a SQL_ID with exec ('...') dbms_workload_repository.add_colored_sql; but then the SQL ID must be known.

    Is it also possible to do the same for the (not yet known) SQL statements that are executed > 1000 times? I think that the SQL statements that run very quickly (for example 1 s <) won't be captured automatically in a CWA even if those statements are frequently performed.

    Version 11.2.0.4 on SLES11

    Try this...

    fixed lines 155

    execs from collar to 999 999 999

    Col min_etime to 999,999.99

    Col max_etime to 999,999.99

    Col avg_etime to 999,999.999

    Col avg_lio to 999,999,999.9

    Col norm_stddev to 999,999.9999

    Col begin_interval_time to a30

    node of col to 99999

    break on plan_hash_value on startup_time skip 1

    Select * from)

    Select sql_id, sum (execs), min (avg_etime) min_etime, max (avg_etime) max_etime stddev_etime/min (avg_etime) norm_stddev

    de)

    Select sql_id, execs, plan_hash_value, avg_etime,

    StdDev (avg_etime) on stddev_etime (sql_id partition)

    de)

    Select sql_id, plan_hash_value,.

    Sum (NVL(executions_delta,0)) execs,

    (sum (elapsed_time_delta) /decode (sum (nvl(executions_delta,0)), 0.1, sum (executions_delta)) / 1000000) avg_etime

    -sum ((buffer_gets_delta/decode (nvl(buffer_gets_delta,0), 0.1, executions_delta))) avg_lio

    DBA_HIST_SQLSTAT s, DBA_HIST_SNAPSHOT SS

    where ss.snap_id = S.snap_id

    and ss.instance_number = S.instance_number

    and executions_delta > 0

    Group of sql_id, plan_hash_value

    )

    )

    Group of sql_id, stddev_etime

    )

    where norm_stddev > nvl (to_number('&min_stddev'), 2)

    and max_etime > nvl (to_number('&min_etime'),.1)

    order of norm_stddev

    /

  • Get the SQL statement error programmatically

    Hello

    error SQL in the FORMS, you can display the erroneous SQL statement pressing (shift) (Ctrl) E on the screen. Is there a way to get the text of the SQL statement in a PL/SQL function for logging purposes?

    I get the error using SQLERRM, it's not a problem. But how can I get the SQL text of the statement?

    Thanks and regards,

    Sascha

    Sascha,

    You should be able to use the: SYSTEM. System LAST_QUERY variable forms.

    Craig...

  • Several SQL statements with zero executions in the region of SQL

    Hello

    one of my databases has a large number of statements in the SQL box with zero executions. Some of them analyzed several times without a single run. Why the database stores these statements and how to avoid or reduce them?

    My problem is that the only time or zero time sql statements take the largest part of the area of sql:

    -sql statement and only once and without executing sql statements

    Select

    Count (1) num_sql_total,.

    sum (decode (executions, 1, 1, 0)) num_one_use_sql,.

    sum (decode (executions, 0, 1, 0)) num_no_use_sql,.

    Sum (RUNTIME_MEM) / 1024/1024 mb_used,.

    sum (decode (executions, sharable_mem, 1, 0)) / 1024/1024 mb_for_one_use_sql,.

    sum (decode (executions, 0, sharable_mem, 0)) / 1024/1024 mb_for_no_use_sql

    Of

    GV$ sqlarea

    where

    RUNTIME_MEM > 0;

    NUM_SQL_TOTAL NUM_ONE_USE_SQL NUM_NO_USE_SQL MB_USED MB_FOR_ONE_USE_SQL MB_FOR_NO_USE_SQL

    23318

    8739

    8027

    1420,95619106293

    381,41183757782

    530,999855041504

    Concerning

    Thomas

    This is not unusual. Another app could analyze for example hard the most often used SQLs in upstairs app - making benefit of further processing (in theory) of sweet analysis when you use these SQLs.

    In fact, I remember reading something to this effect as a performance for some factor or another Oracle document or note?

    So unless you have serious questions of shared pool, why bother with these sliders? What would be the problem?

  • Order of execution of SQL statements

    Hello

    I have two SQL statements where the first statement executes on a table with more than 40 million lines, the second statement is running on a table more 6 million lines.  When they are running their own each take about 0.15 seconds to run, but when combined they take 20 minutes to run, (the second SQL statement is inserted in the WHERE clause of the statement of first).  It would seem that after combining these statements, the first statement goes through all 40 million lines before it performs the SELECT in the WHERE clause.  I think that what is necessary is to ensure the SELECT in the WHERE clause is executed first... or something like that!  Anyone has any ideas on how to combine these statements but not suffer from the performance impact?

    The first statement is:

    Select csi.instance_id,

    OEL.ordered_item

    of apps.csi_item_instances csi,.

    Apps.oe_order_lines_all oel

    where csi.instance_id in

    (1718000,3698000,48740202)

    and csi.last_oe_order_line_id = oel.line_id;

    The second statement is:

    Select / * + INDEX (IEA (attribute_id)) * /.

    IEA.instance_id

    apps.csi_iea_values do

    where iea.attribute_id = 10004

    and iea.attribute_value is not null;

    The joint return is:

    Select csi.instance_id,

    OEL.ordered_item

    of apps.csi_item_instances csi,.

    Apps.oe_order_lines_all oel

    where csi.instance_id in

    (select / * + INDEX (IEA (attribute_id)) * /)

    IEA.instance_id

    apps.csi_iea_values do

    where iea.attribute_id = 10004

    and iea.attribute_value is not null)

    and csi.last_oe_order_line_id = oel.line_id;

    Thanks for any help,

    Mike

    Your subquery returns probably just two values that you did originally as constants - but the optimizer thinks that you're going to get 564 K lines.  This is why the indicator for the simple query has a beneficial effect, it forces the Oracle to use an index when it would otherwise make a search.

    When the subquery is incorporated, however, the optimizer uses its cardinality expected to decide whether to use a nested loop join or the hash join to CSI_ITEM_INSTANCES, since the large enough estimate, he uses the hash with a join analysis complete.  That's why I pointed out that the fact to tell the optimizer to how many lines outside the subquery should make a difference.

    Have you tried the "common table expression" approach, rather than approach no_merge, but it would not help because it does not change the optimizer for cardinality estimate.  If you want to repeat the method CTE adding boards / * + materialize cardinality (2) * / to the query in the WITH clause, you should get the desired result.

    Concerning

    Jonathan Lewis

Maybe you are looking for