Re: What is wrong with this????



On Jan 30, 5:41 pm, Boogha <boo...@xxxxxxxxx> wrote:
I am trying to write a simple script to drop triggers for a user on a
10g database

declare
    v_trgname   varchar2(30);
    v_dropstmt  varchar2(60);
    cursor c_triggers is
        select trigger_name from user_triggers
        where trigger_name not like 'TRG_%';
begin
    open c_triggers;
    loop
    fetch c_triggers into v_trgname;
    exit when c_triggers%notfound;
        v_dropstmt := 'DROP TRIGGER ' || v_trgname;
        execute immediate v_dropstmt;
    end loop;
    close c_triggers;
end;

As you can see there is no rocket science in the script. When I run
the script I get the following error:

Error at line 4
ORA-00933: SQL command not properly ended
ORA-06512: at line 13

Can anyone help, also the user has the permission to drop indexes

Cheers,
Adam

I tested your script and it worked as expected. Could you be using a
reserved word as a trigger name? Try adding an exception handler to
display v_dropstmt.
.



Relevant Pages

  • Re: "Sorting" assignment
    ...     If clause-1 is a declaration, the scope of any variables it declares ... in that direction lies COBOL. ... >I don't declare anything inside of a loop is why. ...
    (comp.programming)
  • Re: division of two 4-bit vectors
    ... help, i am suposed to program a simple calculator in vhdl, and program ...   process ... the last 13 iterations. ... The number of iterations in a loop must be a constant for synthesis ...
    (comp.lang.vhdl)
  • Re: Efficiency questions: combined ifs and looping 4 times
    ...   // This function augments $aRes by adding zero,one,two,three, ... $strBoxes is an ordered list of integers starting with 1 ... using sizeof within a loop there's nothing that obviously jumps ... And PHP is quite simply the wrong language for this job. ...
    (comp.lang.php)
  • Re: Progress Bar
    ... Progress Bar to let the user know that how long to expect (and that the macro ...     Dim i As Long, ... If you only had one loop, ... The idea behind the code that I posted is that 'Target' is the total ...
    (microsoft.public.excel.programming)
  • Re: comparing and extracting of elements of two vectors
    ... %En: Normal elevation ... Script which i have written is: ...     end; ... second, when I try to plot En vs Dn, only the last element of "for" loop is plotted. ...
    (comp.soft-sys.matlab)