Problem with Logon Trigger

The logon trigger written by me is nt returing either program or module from the V$session table. Here is my trigger
create or replace trigger PROGME
after logon on database
declare
v_SCHEMANAME varchar2(30);
t_program varchar2(64);
begin
     v_SCHEMANAME := SYS_CONTEXT('USERENV','SESSION_USER');
sys_context(''userenv'',''SESSIONID'')' into t_program;
logon_proc;
     select MODULE
     into t_program
     from v$session where username = (select
(sys_context('userenv','session_user')) from dual) and
audsid= (select(sys_context('userenv','sessionid')) from dual);
     RAISE_APPLICATION_ERROR (-20000,SQLERRM || T_PROGRAM);
     IF v_SCHEMANAME = 'REPADMIN' AND upper(t_PROGRAM) like '%TO%' THEN
          RAISE_APPLICATION_ERROR (-20000,SQLERRM || T_PROGRAM);     
     END IF;
exception
when others then
     RAISE_APPLICATION_ERROR (-20000,SQLERRM || v_PROGRAM);
end PROGME;
Thanks in advance
Raghu

Even tried rewriting like this
create or replace trigger PROGME
after logon on database
declare
v_SCHEMANAME varchar2(30);
v_USERNAME varchar2(30);
v_PROGRAM varchar2(30);
v_SESSION NUMBER;
v_SERIALNO NUMBER;
V_ssql varchar2(100);
v_count number;
t_program varchar2(64);
begin
     select program
     into t_program
     from v$session where username = (select
(sys_context('userenv','session_user')) from dual) and
audsid= (select(sys_context('userenv','sessionid')) from dual);
     RAISE_APPLICATION_ERROR (-20000,SQLERRM || T_PROGRAM);
     IF v_SCHEMANAME = 'REPADMIN' AND upper(t_PROGRAM) like '%TOAD%' THEN
          RAISE_APPLICATION_ERROR (-20000,SQLERRM || T_PROGRAM);     
     END IF;
exception
when others then
     RAISE_APPLICATION_ERROR (-20000,SQLERRM || v_PROGRAM);
end trg_no_TOAD_logon;

Similar Messages

  • Problem with this trigger

    Hello, I am new to Oracle and I am having problems with this trigger:
    CREATE OR REPLACE TRIGGER myTrigger
    AFTER INSERT OR UPDATE OF aField ON myTable
    DECLARE
    myVariable NUMBER(2);
    BEGIN
    SELECT COUNT(keyColumn) INTO myVariable
    FROM myTable
    WHERE TO_CHAR(myTableDate,'mm') = (SELECT TO_CHAR(SYSDATE,'mm') FROM DUAL);
    IF myVariable > 4 THEN
    RAISE_APPLICATION_ERROR(20605, 'Here is an error.')
    END IF;
    END;
    Every time the trigger is executed, this error happens:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 10
    How do I resolve this problem?
    Thank you.

    Hi,
    user12120979 wrote:
    Hello, I am new to Oracle and I am having problems with this trigger:
    CREATE OR REPLACE TRIGGER myTrigger
    AFTER INSERT OR UPDATE OF aField ON myTable
    DECLARE
    myVariable NUMBER(2);
    BEGIN
    SELECT COUNT(keyColumn) INTO myVariable
    FROM myTable
    WHERE TO_CHAR(myTableDate,'mm') = (SELECT TO_CHAR(SYSDATE,'mm') FROM DUAL);
    IF myVariable > 4 THEN
    RAISE_APPLICATION_ERROR(20605, 'Here is an error.')
    END IF;
    END;
    Every time the trigger is executed, this error happens:
    ORA-06502: PL/SQL: numeric or value error: number precision too large
    ORA-06512: at line 10
    How do I resolve this problem?
    Thank you.Are you sure the code you posted is what's actually running?
    I would expect the missing semicolon after:
    RAISE_APPLICATION_ERROR(20605, 'Here is an error.')to keep this from even compiling.
    Error numbers are supposed to be negative. That will cause a run-time error when you try to raise the error.
    This isn't actually an error, but there's rarely a need to use dual in PL/SQL.
    WHERE TO_CHAR(myTableDate,'mm') = (SELECT TO_CHAR(SYSDATE,'mm') FROM DUAL);can also be done this way:
    WHERE TO_CHAR(myTableDate,'mm') = TO_CHAR(SYSDATE,'mm');Actually, the condition above would work even outside of PL/SQL.

  • Problem with a trigger

    I have a problem with a very simple trigger:
    CREATE OR REPLACE TRIGGER contratos_factuali
    AFTER UPDATE OF descrip,fautori,origpeso,origdls,
    montopeso,montodls,aant,aact,fifiobserva,pedsap
    ON ulises.contratos
    FOR EACH ROW
    BEGIN
    UPDATE contratos SET factuali=TO_DATE(SYSDATE,'DD/MM/YYYY HH24:MI')
    WHERE ncontra=:NEW.ncontra;
    COMMIT;
    END;This trigger update the column 'factuali' of this table everytime any other column of this table is updated. But returns me an error:
    SQL> update contratos set montodls=1 where ncontra='ODPS-086/00';
    update contratos set montodls=1 where ncontra='ODPS-086/00'
    ERROR at line 1:
    ORA-04091: table ULISES.CONTRATOS is mutating, trigger/function may not see it
    ORA-06512: at "ULISES.CONTRATOS_FACTUALI", line 2
    ORA-04088: error during execution of trigger 'ULISES.CONTRATOS_FACTUALI'What's happening?

    (1) You cannot use DML to update the table on which the trigger is based. Think about it: your trigger fires on UPDATE so each time fires, it updates the table and fires again. This is what is known as mutation.
    What you should do is create a trigger that executes BEFORE the update and simply do
    :NEW.factuali := SYSDATE;
    If ncontra is not a unique column and you genuinely want all rows of the same value to have the same factuali timestamp, well, it's very difficult, indeed I don't think it can be done. You could try submitting a DBMS_JOB to do the update, passing in the factuali value as a parameter; that DBMS_JOB would have to disable the trigger before doing the update (to prevent the recursion) and then re-enable it afterwards. Which seems like a lot of work: are you sure your design is correct?
    (2) You don't need the commit statement: the triggere exectutes within the commit phase of the original update.
    HTH, APC

  • Autotrace with logon trigger?

    Hi,
    I've a view and the view is be reading by an external program.
    How can i see how and how long do they communicate ?
    Thanks in advance.
    With best regards
    Nicole

    Hi:
    If you have a testing environment (that is definitely a must have) and can modify sources the simplest way to activate trace is add a 'alter session set sql_trace=true' at the beginning of the application, then run it, and then evaluate results.
    Using a logon trigger for the user the application is connecting to is another way to accomplish the same, useful when the application cannot be modified. This is an example of the same:
    CREATE TRIGGER
    schema_owner.logon_tg AFTER LOGON ON schema_owner.SCHEMA
    BEGIN
    EXECUTE IMMEDIATE 'alter session set sql_trace=true';
    END;
    This will produce a trace file containing all of the statements executed by the session:
    Trace files go to USER_DUMP_DEST, and need to be parsed with TKPROF in order to produce readable output.
    Also, check to have timed_statistics=true, so it will report timing in the trace files.
    Try to produce trace files, and post if you need assistance in interpreting results.
    ciao
    Andrea

  • A problem with plsql trigger in my form

    i created two text field and a button(insert) to take the value of the text feild at run time and insert it in the table
    this is my procedure
    CREATE OR REPLACE PROCEDURE insert_value
    (brn_id_in_p IN branch.brn_id%TYPE,
    brn_name_in_p IN branch.brn_name%TYPE)
    IS
    BEGIN
    INSERT INTO branch (brn_id,brn_name)
    VALUES (brn_id_in_p, brn_name_in_p);
    END insert_value;
    and in the form button trigger (when button pressed ) i wrote this
    EXECUTE insert_value(:BRANCH.BRN_ID_TF,:BRANCH.BRN_NAME_TF);
    but it gave me plsql error but i dont know why?
    note BRANCH is the datablock name and BRN_ID_TF,BRN_NAME_TF is the name of the items

    Only write
    insert_value(:BRANCH.BRN_ID_TF,:BRANCH.BRN_NAME_TF);
    and then give me the error which is prompted...
    another problem may occur with the data type which you declared in the properties of the text items
    :BRANCH.BRN_ID_TF and :BRANCH.BRN_NAME_TF
    in your forms.

  • Problem with logon Portal

    Dear Experts,
    When we are trying to login to portal it is showing the following error.
    Errors caused by approach to framework-side: "pcd: portal_content / every_user / general / defaultDesktop / frameworkPages / framework page," The object does not exist or lacks permissions to access the object contact system administrator if this problem persists. Log off.
    I cannot logon the portal alt all. Is it any way to logon the portal and solve this logon problem?
    Thanks

    Hi Mahesh,
    My problem is one of my college has delete default desktop id* (pcd:portal_content/every_user/general/defaultDesktop)* from:
    Content/content provided by SAP ->End User content  ->Standard Portal Users and replace that with. pcd:portal_content/com.sap.pct/every_user/general/com.sap.portal.defaultDesktop
    I have the samme id pcd:portal_content/com.sap.pct/every_user/general/com.sap.portal.defaultDesktop on
    content -> every_user -> standard Portal users
    Any idea how can get the default id (pcd:portal_content/every_user/general/defaultDesktop) again?
    Thanks
    Re
    Edited by: Ejersbo Reza on Dec 19, 2011 11:02 AM

  • Problem with logon ticket on a cluster J2EE environment.

    Hi Experts,
    We have a Portal system with one J2EE node running which issues logon ticket to do SSO into our R/3 4.6 system.
    After we added another node into the J2EE cluster on another machine, we have problem SSO into our R/3 system if you login to that new node, but everything works fine if user login into the original node directly.
    I checked the keystore in EP on both nodes and they look exactly the same.
    do we need to do anything for this to work? any help much appreciated!
    Thanks
    Jerry.

    Interesting, can you see the system landscape def from both nodes?  If so, are the connection test results the same from both nodes?
    Regards,
    Patrick

  • Problem with logon on SAPGui

    Hello,
    I Have Installed the Sap Netweaver and the sapgui, but when I Want to logon to the sap system with sap gui, I have this problem :
    partner not reached (host 127.0.0.1, service sapdp00)
    Time                Thu Oct 05 12:24:01 2006
    Release     640
    Component   NI (network interface)
    Version             37
    Return Code      -10
    Module              nixxi_r.cpp
    Line                  8602
    Detail                NiPConnect2
    System Call       SiPeekPendConn
    Error   No         10061
    Error   Text        WSAEHOSTUNREACH: Connection refused
    Counter             1
    Conf:
    description   NSP
    System Id     NSP
    Server        localhost
    System Number 00
    Enjoy, and thanks for your helps.

    Ok, something got screwed up then.  Delete that icon from your desktop.
    Next.....
    Form the start menu, choose run, type MMC and hit enter.
    Now you should see an MMC,  choose File --> Add/Remove SnapIn.  In the "Standalone" dialog, click Add.  Scroll down and choose SAP Systems Manager.  Click Add.  Next dialog,  take defaults and hit Next twice.  At the screen where it has "System"  Enter NSP if not already there.  Enter 'localhost 00' into the Instance field and click add.  Now Finish.  Close the rest of the windows and go back to the MMC, now you should see a SAP Systems node, with your NSP underneath, right-click it and "Start".   You can then save this MMC and put a shortcut on your desktop.
    Regards,
    Rich Heilman

  • Why would connection pooling cause problems with a trigger?

    This is a strange one. We have an app that deletes a row in a database table, and this table has a delete trigger on it. The row gets deleted every time the app is run, yet the trigger only fires intermittently. It's not that the trigger is failiing in some way - it just doesn't get called at all. If I issue the same delete command in PL/SQL developer then the trigger fires every time.
    Several hours later and out of desparation I tried turning off connection pooling via the app's connection string, and found that the trigger now fires every time. Any ideas what might be causing this behaviour? I can reproduce/fix the issue every time simply by setting "Pooling" to true or false!
    We are using Oracle 11g and ODP.Net v4.112.2.0.
    Thanks in advance
    Andrew

    More information: I've now been able to reproduce this issue in a small .Net app, and can make it fail in a more consistent manner (which I'll explain later). While it's still too large to post the entire code here, I can summarise what the app does in pseudo-code:-
    for(int i = 1; i <= 10; i++) // Run the test a number of times
    // Step 1 - Delete rows from the table with the delete query in question
    Execute non-query "delete from test_table";
    Wait 1 second
    // Step 2 - Check that the delete actually happened
    Execute reader "select count(*) from test_table"
    Display the count
    // Step 3 - Check that the delete trigger inserted some rows into a "logging" table. This is my method of "tracing" - I added a basic insert to the start of each trigger section, as mentioned in my previous post.
    Execute reader "select count(*) from my_logging_table"
    Display the count
    // Reinstate the test data
    Execute non-query "<insert rows back into test_table>"
    Wait 1 second
    For info the connection string is fairly basic:- "Data Source=<tns name>;User Id=<foo>;Password=<bar>"
    Some points of interest:-
    - When running the above test app, the trigger successfully fires on the very first iteration (i.e. "Step 3" displays a non-zero count from the logging table). All subsequent iterations fail ("Step 3" displays the same count each time).
    - If I turn off connection pooling (by adding "Pooling=false" to the connection string), the trigger runs on every iteration (i.e. "Step 3" displays an ever-incrementing record count).
    - Regardless of whether it works or fails, the deletion in step 1 does take place (confirmed by "Step 2" displaying a count of zero).
    - I added the waits after the non-query calls to see if that made a difference, but it doesn't. I can change these to 10 seconds or more and it will have no effect on the issue.
    The "Execute non-query" method uses code along these lines:-
    using (var conn = new OracleConnection(ConnString))
    conn.Open();
    using (var cmd = conn.CreateCommand())
    cmd.CommandText = sql;
    cmd.CommandType = CommandType.Text;
    result = cmd.ExecuteNonQuery();
    conn.Close();
    return result;
    While the "Execute reader" method looks like this:-
    var conn = new OracleConnection(ConnString);
    conn.Open();
    var cmd = conn.CreateCommand();
    cmd.CommandText = sql;
    cmd.CommandType = CommandType.Text;
    return cmd.ExecuteReader(CommandBehavior.CloseConnection);
    The calling code in the for loop, wraps the returned reader in a using clause like this:-
    using (var reader = ExecuteReader("<sql>"))
    This will dispose of the reader, which will in turn close/dispose the connection (due to the CommandBehavior.CloseConnection parameter passed to ExecuteReader).
    Interestingly, if the reader isn't disposed of then the problem becomes more intermittent (the trigger will fire perhaps 25% of the time). This is what's happening in our unit test harness. By ensuring the reader/connection is closed and disposed (which common sense would say should improve matters), the trigger only fires on the very first iteration of the loop. The plot thickens.

  • Problem With LOGON.par

    HI
    iam using NWDS 2.0.12 version as indicated i have moved the par file into the studio and edited the jsp tages according to my needs by  the system is showing the error
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    The exception was logged. Inform your system administrator..
    See the details for the exception ID in the log file
    The foloowing steps i followed
    The login page is part of the par file with the name com.sap.portal.runtime.logon.par
    1) Copy the file with the above name from the following location (EP6 SP9 and higher). It has the additional ending ">\<SID>\<Instance>\j2ee\cluster\server<#>\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\deployment\pcd\
    2) Import the PAR file into Netweaver Developer Studio:
    3)Edited the file
    4) while importing the lib directory was empty so i copied the files
    1. com.sap.portal.runtime.logon_api.jar
    2. umelogonbase.jar
    into the lib directory
    5) after that i made a par file using nwds and winzip.
    6)Then i changed the authescemes .xml file
    1. Start the Config Tool by executing <SAPJ2EEEngine_installation>\j2ee\configtool\configtool.bat.
    2. Navigate to cluster_data>server>persistent>com.sap.security.core.ume.service.
    3. Switch to edit mode by clicking on the pencil which is at the upper right area.
    4. In the tree, select authschemes.xml and choose Download. Save the file to your local directory
    5. Edit the local file: To select the new PAR file as the Logon page change the occurrence of all substrings com.sap.portal.runtime.logon to your
    project/PAR file name. All com.sap.portal.runtime.logon should be substituted with something like com.company.portal.runtime.logon (or whatever you project name is). Don’t remove the part behind it.
    (These are the profiles in the portalapp.xml and have the names default, certlogon, basicauthentication, header, and anonymous).
    6. Create a new node in the configuration tree in the Config-Tool for the edited file as follows:
    a.Select the node com.sap.security.core.ume.service.
    b. Choose the symbol for Creating a node below the selected node.
    c. Select the type File-entry.
    d. Choose Upload and select the custom file from your local directory.
    e. Enter a name for the entry, for example, authschemes_myHR.xml. By default, the name of the uploaded file is used.
    f. Choose Create.
    g. Choose “Close window”.
    h. The new node appears in the configuration tree.
    i. Go to Global server configuration>services> com.sap.security.core.ume.service and edit the property login.authschemes.definition.file.
    The value needs to be changed from authschemes.xml to authschemes_myHR.xml
    j. Restart the Portal. That is often not done and the changes will not appear.
    after doing all this the portal shows an error
    can anyone tel me where am i going wrong what steps iam missing while changing the par file.aslo pls if any one can tel me where exacty the log file is stored and how do i check the exception id.

    Hi Pankaj,
    The steps seem to be correct.
    The physical location of the log file is:
    \usr\sap\<instance name>\JC01\j2ee\cluster\server0\log
    You could check in the defaultTrace files here. Also note that the log entry could go into the Trace files in one of the Server in the clusters.
    You could also look for the Log file from within the portal using Java Home-> Portal Log Viewer -> give the Exception id in the search
    Regards,
    Ashwini.

  • Problem with Parcial trigger on master Datail

    my Entities :
    group: gId,parentId,name
    roles : pId,name
    permission: gId,pId
    my Associasions:
    GroupToGroupAssoc -> group.gId & group.parentId
    GroupToPermissionAssoc -> group.gId & permission.gId
    and i have a view on Group (that is shown as a tree on a page).
    and a view on permission (that is shown as a read Only table on the same page with the tree)
    the tree Binding is something like "myApp.model.view.GroupView(<GroupView_2>)"
    my question :
    I want the permission table to be refreshed on tree node selection change.
    but the problem is when I set parcialTrigger of the table to point to the "tree",It only get refreshed on first level selection change of the tree.
    and when inner nodes get selected no refresh happens!!!(that's because the tree seems to have two iterators)
    please advice,
    Thank you,
    Shahab

    Me once again, and I've got the solution!
    1. Put the text boxes where you want them on your Master.
    2. Go to the "Pages" panel and highlight all pages.
    3. In the "Pages" panel options pull-out, choose "Override all Master Page Items".
    Now all your pages have a free-floating text box!
    Cheers!
    Mikey

  • Having Problem with logon & logoff Triggers for the SCHEMA

    hi,
    I have created triggers "LOGOFF_TRIG" & "LOGON_TRIG" . This triggers fires each time the user SCOTT logings and logoff from the database and stores the info in table log_trig_table. Below the code of the trigger
    LOGOFF_TRIG
    CREATE OR REPLACE TRIGGER logoff_trig
    BEFORE LOGOFF ON SCHEMA
    BEGIN
         INSERT INTO log_trig_table(user_id, log_date, action)
         VALUES (USER, SYSDATE, ’Logging off’);
    END;LOGON_TRIG
    CREATE OR REPLACE TRIGGER logon_trig
    AFTER LOGON ON SCHEMA
    BEGIN
         INSERT INTO log_trig_table(user_id, log_date, action)
         VALUES (USER, SYSDATE, ’Logging on’);
    END;But whenever i m loggin off or on using the user SCOTT there seems to be nothing being updated on table log_trig_table. Why ?

    i tried the new code provided it is telling not sufficeint priviledge. But i have all the priviledges for user SCOTT.
    Also i tried putting the commit in the below code. Tried disconnect command from theSQL* Plus. this time i didnt got any ERROR but still there were no data in table log_trig_table
    CREATE OR REPLACE TRIGGER logoff_trig
       BEFORE LOGOFF
       ON SCOTT.SCHEMA
    BEGIN
       INSERT INTO log_trig_table (user_id, log_date, action)
         VALUES   (USER, SYSDATE, 'Logging off');
          commit;
    END;Below is what my requirement
    1) Create a trigger on Schema SCOTT for logon and logoff
    2) Whenever user scott is connect or disconnect the respective trigger should fire and stores the result in table log_trig_table which is in schema SCOTT

  • Problem with Logon on Handheld

    Hi,
    as you know i need to logon if i want to start a webdynpro application (directly via browser and url).
    When I do so on my desktop-computer there are no problems. But when I try to start the same applicaton on my handheld I cant logon. Nothing happens when i enter user and password in the logon screen on my handheld and click the logon button.
    Does anybody know that problem?
    Thanks!
    mehmet

    Hello Mehmet,
    i noticed from your profile that you have installed ABAP Trial Version in the last weeks.
    So have you developed a WD-ABAP or a WD-Java application?
    If you are usng WD-ABAP its not supported for mobile clients at the moment.
    For that perhaps check this thread:
    Mobile Web Dynpro
    Regards
    Frank

  • Oracle 10g standard edition installation and problems with logon (help pls)

    I installed 10g standard edition, however I got the following two messages during installation:
    1) The host IP address can not be determined
    2) Missing or Invalid password ...
    Eventhough I unlocked all the passwords during install (tiger/scott, sys, system, etc) I can not logon now with none of them ("invalid username/password: logon denied"). I also get "ORA-12170: TNS: Connect Timeout Occured" when trying to lgoon with my email addr and password used for installation.
    Please help, this is frustrating. Thx!
    P.S> Do I need to input anything in the "Host String" box ?

    Chances are
    1) you are using WIndows of some sort;
    2) your machine does not have a static IP address (you are using DHCP);
    3) you have not installed the loopback adapter, as desrcibed in the installation document.
    You may want to review the Oracle Database 10g (release whichever you are using) "Installation Guide" manual for your operating system again. I think you missed a step.

  • Problem with zoom trigger

    Hi friends,
    here i have a requirement to Customize Material Transactions Form to Zoom to the form Order Header Form after entering the Sales Order Number against which the Material transaction is happening passing order header_id as parameter (Order Fulfillment process automatically enters the Sales Order Number. The zoom must work after this process).
    Now, i can zoom to the order form and open it but i am unable to pass the parameters and i have no idea how to pass the parameters. plese help me to solve this problem.
    thanks in advance,
    siddam

    Hi Sunil,
    Firstly i would like to thank you for your time.
    I got lot of information in 115 dev guide the example is very good.
    But while definig parameters i followed the example and is as given below
    parameter name : PARAMETER996 NUMBER 30.
    In the WHERE CLAUSE have given the following code
    WHERE(PARAMETER996.HEADER_ID IS NULL OR
    MTL_MATERIAL_TRANSACTIONS.TRANSACTION_SOURCE_ID LIKE PARAMETER996.HEADER_ID).
    --mtl_material_trasactions is table name
    --parameter996 is parameter  name
    In the WHEN-NEW-FORM-INSTANCE trigger my code is
    if (:PARAMETER996.HEADER_ID is not null) THEN
    GO_BLOCK('RESULTS');
    do_key('EXECUTE_QUERY');
    :PARAMETER996.HEADER_ID := null;
    end if;
    i found the following error when i compiled it
    ERRORS:-
    ERROR 49 AT LINE 110, COLUMN 5
    BAD BIND VAIRABLE 'PARAMETER996.HEADER_ID'
    please tell me how can i rectify the errors to pass parameters to the targer form.
    thanks in advance,
    siddam

Maybe you are looking for