Wht is the wrong in this trigger i want to call a procedure from trigger sp

--trigger
CREATE or replace TRIGGER anotnegetive
AFTER update OF id ON a
REFERENCING NEW AS newRow
FOR EACH ROW
WHEN (newRow.id <= 10)
call bprocedure
BEGIN
IF (:newRow.id < 0) then
RAISE_APPLICATION_ERROR(-20000, 'no negative age allowed');
else
insert into a values(:newRow.id,:newRow.name);
end if;
end;
--procedure
create or replace procedure bprocedure as
a varchar2(20);
begin
select name into a from b where id=10;
dbms_output.put_line(a);
end;

can u reframe the Trigger as follows
--trigger
CREATE or replace TRIGGER anotnegetive
AFTER update OF id ON a
REFERENCING NEW AS newRow
FOR EACH ROW
Begin
if :newRow.id <=10 and >0 then
bprocedure;
end if;
IF (:newRow.id < 0) then
RAISE_APPLICATION_ERROR(-20000, 'no negative age allowed');
else
insert into a values(:newRow.id,:newRow.name);
end if;
end;

Similar Messages

  • What is the wrong in this PL/SQL  block

    Hi a...
    Can you please tell what is the wrong in this pl/sql block.
    declare
    TYPE TYP_NT_NUM IS TABLE OF NUMBER ;
    v_tab TYP_NT_NUM := TYP_NT_NUM();
    TYPE uname is VARRAY(30) of varchar2(100) ;
    usr uname := uname ( 'u1','u2','u3','u4' );
    TYPE pwd is VARRAY(30) of varchar2(100) ;
    psw pwd := pwd('p1','p2','p3','p4');
    x number(10):=0;
    Cursor fcid IS Select distinct FC_ID From FCMASTER ;
    Begin
    Open fcid ;
    --for ii in usr.first .. usr.last loop
         Loop
              Fetch fcid Into x ;
              Exit When fcid%NOTFOUND ;
              v_tab(fcid%ROWCOUNT) := x ;
         End loop ;
         For iii IN v_tab.FIRST .. v_tab.LAST Loop
              dbms_output.put_line(v_tab(iii).FC_ID) ;
              End loop ;
    End loop; End of outer loop
    End;
    The error is
    Error
    [row:28,col:36] ORA-06550: line 28, column 36:
    PLS-00487: Invalid reference to variable 'NUMBER'
    ORA-06550: line 28, column 4:
    PL/SQL: Statement ignored
    Thanks in advance,
    Pal

    v_tab(iii).FC_ID
    declare
      type typ_nt_num is table of number;
      v_tab typ_nt_num;
    begin
      select distinct object_id bulk collect into v_tab from all_objects where rownum <= 10;
      for i in 1 .. v_tab.count loop
        dbms_output.put_line(v_tab(i)) ;
      end loop ;
    end;
    /

  • There is a problem with the phone app. When I want to call somebody the phone screen come too late. This will cause a problem if I call the wrong number

    There is a problem with the phone app. When I want to call somebody the phone screen come too late. This will cause a problem if I call the wrong number.  Apple please please please fix it as soon as possible and also check why the phone is always restart. I prefer to let us use the iOS 7 until you finished from the IOS 8 because Ios 8 still under construction  there is a tones problems in the system.  And this Will cause undirect problem for the iPhone 6

    There is no apple here in this user to user technical forum.
    Do this Use iTunes to restore your iOS device to factory settings

  • The other day I had to reset my phone because i pulled it out from my laptop when it was updating. I then tried to restore it but i clicked the wrong option and it has restored all of my stuff from 2 years ago, is there any way to get back the stuff I had

    The other day I had to reset my phone because i pulled it out from my laptop when it was updating. I then tried to restore it but i clicked the wrong option and it has restored all of my stuff from 2 years ago, is there any way to get back the stuff I had

    maggielou wrote:
    I thought that I had backed up my pictures to icloud, but when I looked online at icloud, I don't see pictures listed.  However, a few of the recent pictures have shown up on my phone.
    IHow could I get these from my MacBook to my phone?
    Thanks again.
    When you log into you icloud account on your computer you are viewing data that you sync to icloud not the backups.  You can't view the backups.
    Look at the two links I provided.
    You still didn't answer any of my two questions I asked.

  • Using the content aware move tool, I want to move an item from one image to another image but it does not seem to work. I think I need two layers on one document so how do I do this

    Using the content aware move tool, I want to move an item from one image to another image but it does not seem to work. I think I need two layers on one document so how do I do this

    Good day!
    A simple Paste does not work for you?
    It should place the clipboard content as a new Layer which you can then move around.
    If there is any chance that the elements need to be scaled, rotated etc. I would prefer to place them as Smart Objects (File > Place …) and do the masking that is specific to the images themselves in those.
    Regards,
    Pfaffenbichler

  • Calling a procedure from an OAF page through a button in the screen

    problem: calling a procedure from an OAF page through a button in the screen

    CREATE OR REPLACE procedure APPS.xx_delete_dept_prc(p_id in number)
    as
    begin
    delete from xx_training_dept_tbl where td_dept_id=p_id;
    commit;
    end;
    2.     create image button for delete
    3.     set the following property to this button:
    action type : fire action
    event :DeleteDept
    parameter :
    name: DEptIdParam value: ${oa.XxTrainingDeptVO1.TdDeptId}
    4.     create Co and writing the following code on process form request
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    String actionInscreen=pageContext.getParameter(EVENT_PARAM);
    if ("deleteDept".equals(actionInscreen))
    String deptidparam=pageContext.getParameter("DeptIdParam");
    Serializable [] s={deptidparam};
    Class [] c={deptidparam.getClass()};
    OAApplicationModule am=pageContext.getApplicationModule(webBean);
    am.invokeMethod("deleteDept",s,c);
    throw new OAException("delete completed",OAException.INFORMATION);
    5.     create AM and writing the following code
    public void deleteDept(String deptid) {
    XxTrainingDeptVOImpl deptview= getXxTrainingDeptVO1();
    deptview.deleteDept(deptid); }
    6.create VO and writing the following code in view object class
    public void deleteDept(String deptid
    System.out.println("Dept ID =" +deptid);
    String s = "call xx_delete_dept_prc(:1)"; // :1 is the number of parameter to pass it to procedure
    CallableStatement cs =trx.createCallableStatement(s,1); // 1 number of record to fetch but delete always delete 1 row
    try
    cs.setString(1,deptid); // the name of the first parameter
    cs.execute();
    cs.close();
    catch (SQLException e)
    e.printStackTrace();
    }

  • Hi,This morning I wanted to call, so I took my phone ( Iphone 4 S) ,but my All contacts list was empty! I checked in my computer ( windows 8) I have them in Iclould. How can I bring back my data?

    Hi,This morning I wanted to call, so I took my phone ( Iphone 4 S) ,but my All contacts list was empty! I checked in my computer ( windows 8) I have them in Iclould. How can I bring back my data?

    Hello Noushin,
    It sounds like you are unable to see your contacts in the phone, but have confirmed they are still at http://www.icloud.com. I would next try these troubleshooting steps from the article named:
    iCloud: Troubleshooting iCloud Contacts
    http://support.apple.com/kb/ts3998
    If you're using iOS 7, quit and restart the Contacts app on your iOS device:
    Press the Home button twice to see preview screens of the apps you have open.
    Find the Contacts preview screen and swipe it up and out of preview to quit the application.
    Tap the Home button to return to your Home screen.
    Wait a minute before reopening the Contacts app.
    Turn iCloud Contacts off and back on:
    Tap Settings > iCloud.
    Turn Contacts off. Choose to delete data only if your data exists at icloud.com/contacts and on one or more of your devices. Otherwise, choose Keep Data.
    Wait a few minutes before turning Contacts back on.
    Restart your iOS device by holding down the Sleep/Wake button and then swiping the screen when prompted to power off. Then turn your device back on. This may sound simple, but it does reinitialize your network and application settings and can frequently resolve issues.
    Thank you for using Apple Support Communities.
    Regards,
    Sterling

  • Can we call a procedure from  a trigger

    Can we call a procedure from a trigger
    thanks

    Why cant you test yourself..?
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace procedure p1
      2  as
      3  begin
      4   null;
      5* end;
    SQL> /
    Procedure created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace trigger t1
      2  after insert on t
      3  begin
      4   p1;
      5* end;
    SQL> /
    Trigger created.
    SQL> insert into t
      2  values(5,'n');
    1 row created.
    Message was edited by:
            jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Can I use two separate computers with the same adobe ID.  I want to update my kobo from either unit

    Can I use two separate computers with the same adobe ID.  I want to update my kobo from either unit

    I doubt it is possible to run two instances of iTunes on the computer at the same time.  To do so would require two users to be signed in and running iTunes under each user.
    The better solution would be to either clean up and merge the two libraries or have iTunes running on a second computer.

  • What's wrong with this trigger?

    hi! i am creating a trigger that calls a procedure, it showed the following message. what's wrong?
    SQL> create or replace trigger phang.t2 after logon on portal30.schema
    2 begin
    3 call phang.dob;
    4 end;
    5 /
    Warning: Trigger created with compilation errors.
    SQL> show error;
    Errors for TRIGGER PHANG.T2:
    LINE/COL ERROR
    2/6 PLS-00103: Encountered the symbol "PHANG" when expecting one of
    the following:
    := . ( @ % ;
    The symbol ":=" was substituted for "PHANG" to continue.
    thx.

    my trigger itself doesn't contain any htp.p statements, it just calls the procedure which has the htp.p statements for generating the page.Which is the same problem as calling HTP within the trigger itself. I'm not saying you CAN'T call HTP from your trigger (directly or indirectly) - I'm saying you SHOULDN'T.
    You should have a sequence of events like this, for a more reliable PL/SQL Gateway experience:
    Pseudocode:
    A procedure (referenced by URL via the gateway).
       This procedure issues DML (which causes the trigger to execute)
       The trigger writes some information to a package variable (or other static container).
       The trigger completes.
       The procedure then accesses the package variable, and then HTP's that information as desired.
    The procedure completes.The difference in the above pseudocode and what you are trying to do is that the act of streaming to the buffer is completely within the procedure being referenced by the gateway. When you put the HTP calls in procedures (unknown) to the procedure that the gateway is executing, you will often get erratic and unpredictable effects.
    I have gone around this concept before, but I have had years of experience working with the gateway - something you aren't going to get in this Forum.

  • What is the problem with this trigger

    please tell me why this trigger is not working , i tried to complile it but its giving the error!
    the format is ...
    create or replace trigger log_off
    BEFORE LOGOFF ON database
    begin
    insert into log_trigg_table
    values(user,sysdate,'LOGED ON');
    END LOG_OFF;
    and the error is
    BEFORE LOGOFF ON database
    ERROR at line 2:
    ORA-04072: invalid trigger type
    can you tell me the rreason
    one this i forgot to tell you that i am using oracle 8.0.6
    umair sattar
    null

    valid trigger types are BEFORE/AFTER
    INSERT/UPDATE/DELETE on TABLE

  • What is the wrong in this utl_file

    declare
         f utl_file.file_type;
         --v_str varchar2(32000);
         TYPE TAB_COL IS TABLE OF VARCHAR2(30);
         V_TAB_COL TAB_COL;
         FILE_NAME VARCHAR2(32000);
         V_LEN NUMBER;
         V_TOT_SIZE VARCHAR2(32000);
         V_TOT_SIZE1 VARCHAR2(32000);
         V_TOT_SIZE2 VARCHAR2(32000);
    SQL_STR VARCHAR2(32000);
         lv_loop_counter NUMBER;
    begin
    select COLUMN_NAME BULK COLLECT INTO V_TAB_COL FROM ALL_TAB_COLUMNS WHERE
         TABLE_NAME='CN_SMSC' AND OWNER='TEST';
         FOR I IN V_TAB_COL.FIRST..V_TAB_COL.LAST
    LOOP
              FILE_NAME:=FILE_NAME||','||V_TAB_COL(I);
    --DBMS_OUTPUT.PUT_LINE(FILE_NAME);
    /*lv_loop_counter := 1;
    WHILE (lv_loop_counter < LENGTH(FILE_NAME ))
    LOOP
    DBMS_OUTPUT.PUT_LINE(SUBSTR(FILE_NAME ,lv_loop_counter,255));
    -- DBMS_OUTPUT.PUT_LINE(FILE_NAME);
    lv_loop_counter:= lv_loop_counter + 255;
    END LOOP; */
    END LOOP;
         SELECT LENGTH(FILE_NAME) INTO V_LEN FROM DUAL;
         SELECT SUBSTR(FILE_NAME,2,V_LEN) INTO V_TOT_SIZE FROM DUAL;
         SELECT REPLACE(V_TOT_SIZE,',',',S.') INTO V_TOT_SIZE1 FROM DUAL;
         V_TOT_SIZE2:='S.'||V_TOT_SIZE1;
    SQL_STR:=' DECLARE      f utl_file.file_type; BEGIN
    f := utl_file.fopen('||'''E:\NETWORK_ELEMENT_ID_KEY'''||','||'''A.txt'''||','||'''W'''||');
    for s in (select '||V_TOT_SIZE ||' from cn_smsc)
    loop
    --V_TOT_SIZE2 holds list of column name like s.col_name1,s.col_name2
    utl_file.put_line(f, '||V_TOT_SIZE2 ||' );
    end loop;
         utl_file.fclose(f);
    END;';
    lv_loop_counter := 1;
    WHILE (lv_loop_counter < LENGTH(SQL_STR ))
    LOOP
    DBMS_OUTPUT.PUT_LINE(SUBSTR(SQL_STR ,lv_loop_counter,255));
    lv_loop_counter:= lv_loop_counter + 255;
    END LOOP;
    -- DBMS_OUTPUT.PUT_LINE(SQL_STR);
    EXECUTE IMMEDIATE SQL_STR;
    end;
    it return :
    ORA-06550: line 6, column 9:
    PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
    ORA-06550: line 6, column 9:
    PL/SQL: Statement ignored
    ORA-06512: at line 57
    n.b: i want to make it dynamic

    You call utl_file.put_line with a list of fields as separate parameters, that is obviously wrong. Consider to have a look on your generated sql (uncomment dbms_output call at the bottom of your block) and compare with utl_file package specification .
    Best regards
    Maxim

  • What is the security on this website? I recently got an email from a man who I never corresponded with ...

    who had applied to a dating website but was waiting for approval and not yet a member. When I asked him how he got my personal email account which was NOT on there, he said that his "detector" told him. When asked for details this was his reply...
    "I don't know how it works but my mozilla fire fox gave me an email address which was the same as your username of the site, So I think it just added the (my email provider) to your username that what I had and decided to message you."
    Since Mozilla (I found this out when it was so difficult to find that contact us, was NO contact and found it difficult to find how to post a question and register) a basically self service site how did he do this? Is there a way one can delete the information from Firefox. I have a google chrome book and thus have not used Mozilla for years.
    I am probably posting this on the wrong place in the forum from the trouble shooting answers i'm getting but don't know where else to post this.

    I have called for more help for you.

  • Calling a procedure from within a trigger

    Hi,
    I have a table (table1) which when a row is inserted into this table I need to populate a number of tables based upon gathering information from multiple tables using three fields passed in from table 1.
    I therefore proposed to create a before insert trigger on table1 calling a procedure which passes in the three new values as follows:
    CREATE OR REPLACE TRIGGER trigger1
    BEFORE INSERT ON table1
    FOR EACH ROW
    BEGIN
    package1.populate_tables(:new.col1, :new.col2, :new.col3) ;
    END;
    This compiles fine, but when I actually insert data in table1 then I receive the following message and do not know how to get round it:
    ORA-04091: table table1 is mutating, trigger/function may not see it.
    I am using other fields in table1 to insert values into other tables (confusing I know).
    If anyone can help me I would appreciate it, or if you require any more information I would be very happy to provide it.
    Thanks in advance.

    Hi,
    You triggered in fired on table and you procedure in acting is on the same table which rasing the exception.
    Go throw this link you will understand
    http://asktom.oracle.com/tkyte/Mutate/
    - Pavan Kumar N

  • Wrong number or types of arguments in call to procedure name

    assuming i have this pl/sql code:
    CREATE OR REPLACE PACKAGE MyPackage AS
    TYPE tab_array IS TABLE OF VARCHAR2(300);
    PROCEDURE my_procedure(in_values IN tab_array);
    END MyPackage;
    CREATE OR REPLACE PACKAGE BODY MyPackage AS
    PROCEDURE my_procedure(in_values IN tab_array) IS
    BEGIN
    DBMS_OUTPUT.PUTLINE('This is only a test');
    END my_procedure;
    END MyPackage;
    when i tried typing this on SQL*Plus
    execute mypackage.my_procedure('value1, value2, value3');
    it gives an error like:
    PLS-00306: wrong number or types of arguments in call to 'MY_PROCEDURE'
    PL/SQL: Statement ignored
    Is my parameters incorrect? What should the parameter be? Please give me a sample code.
    Thanks.

    Hi,
    1. typing error: there should be an underline.
    i.e. DBMS_OUTPUT.PUT_LINE('This is only a test');
    2. Since the tab_array type is user defined (although
    it is VARCHAR2), When the package is called, it cannot
    recognize what you pass in even if you declare it in
    the calling block.
    You should create it as global type, then this type
    can be visible to all other PL/SQL, stored procedure &
    stored package. you can type the following in the SQL/PLUS:
    SQL> CREATE TYPE tab_array AS TABLE OF VARCHAR2(300);
    2 /
    3. Remove the declaration line for the tab_array in the package
    and package body. If you declare it locally in the package,
    it will override the global one and cannot be recognized again.
    So just remove it. it should be compiled and run.
    Hope you succeed.
    Thanks.

Maybe you are looking for

  • ITunes 10.6.1.7 unstable

    After upgrading to iTunes 10.6.1.7, I'm experience 2 new issues: iTunes periodically crashes, generating a Windows error report and has to be restarted.  This appears random as I'm not actually doing anything in iTunes when the crash occurs - it is j

  • My iPhone 3GS is not showing in "devices" on my iTunes. Tried everything that Apple advize but still not working. Any suggestions please? :)

    Hello, hope someone can please help. I've had my iPhone 18 months, not had any problems with using it. Trying to update the software to 4.0 on iTunes but it's just not recognizing it at all. It's not there under devices (infact, even the heading "dev

  • IWeb and MobileMe Gallery

    I am trying to upload pictures from the MobileMe Gallery.  I have albums published but when I move the MobileMe widget to the web page I am creating it reads "No albums or movies". Please help.

  • Multiple LABVIEW GPIB Commanding alternating Write followed by read many times

    Hi, I am trying to convert my labwindows C program over to Labview.  This is a VISA GPIB application.  I have seen how you can send multiple commands in Labview by sending the commands separated by semicolons.  However with my instrument.  I need to

  • USB disk size decrease

    Ok well i do both programming and video editing which means i have to touch the devil OS at times which means using my USB pen between OSX and "windows" quite alot, the other day i noticed it was 1.4mb as the capacity instead of 256mb usual, i decide