Is it possible to use constants in when condition of a trigger

I need to check for a condition (say user = ‘XYZ’). Since this value XYZ has not yet been finalized, I would like to assign this value to a constant and use it in the trigger. Hence any change would require me to only change the value assigned to the constant. This condition will be used in many triggers.
So the when condition would be
CREATE OR REPLACE TRIGGER SOLI_ARI
AFTER INSERT ON SO_TABLE
REFERENCING NEW AS newRow
FOR EACH ROW
when (user = PackageA.constant_xyz)
When I do this, I get the following error:
invalid NEW or OLD specification.
Please help me. Is there any other alternative?

No, you can't do this in the WHEN clause (see the third restriction here).
Instead do it in the body of the trigger.
btw is "newRow" really much clearer than the default "new"?

Similar Messages

  • Is it possible to use repository variable in conditional formatting

    Is it possible to use repository variable in conditional formatting . if no then is there any workaround for implementing the same....
    Also i came across a sql of an init block.. which goes like 'exec OracleBi..procedure_name'
    Is 'OracleBi..' a keyword or something like that....

    Refer http://www.biblogs.com/2008/09/03/obiee-repository-variables-filtering-and-conditional-formatting/
    Init blk is calling any procedure here with name OracleBI here...no any specific significance.
    Hope this help
    Edited by: Deepak Gupta on Aug 12, 2011 8:27 AM

  • Is it possible to use dynamic 'with key' conditions of 'READ itab' ??

    Hi~
    I want to try to set  'with key'  conditions dynamically..
    READ TABLE itab WITH KEY <...>.
    In this <...> phrase, the condition keys could be 2 or 3( don't know at yet this point)
    so i want to make it dynamic with importing data.
    Is it possible?
    Please help me!
    thank you in advance~

    Hey,
    You could write 2 READ statements instead of trying to write a dynamic READ statement.
    IF CONDITION FOR 2 KEYS IS MET.
    READ TABLE WITH KEY1 = (value1) KEY2 = (value2).
    ELSE.
    READ TABLE WITH KEY1 = (value1) KEY2 = (value2) KEY3 = (value3).
    ENDIF.
    ~Kiran

  • Using FetchType.LAZY when sending entity to remote client

    Is it possible to use FetchType.LAZY when sending an entity (let's say Person) to a remote client? I'm fine with the fact that a call to person.getAddress() would have to return null o throw an exception of some sort. But, is it possible to even send the Person object when using lazy fetching?

    yeah, if you add the CMP jars to the client, it should work, but, if they attempt to introspect the lazy collection, a runtime exception will be thrown since their local copy does not have access to the backing DB... ..I understand the hesitance to have separate object types for different consumers, but, in some cases, it can save time in the long run because you a) avoid these access exceptions and b) have a middle API that can insulate the client or server from changes on the other end (i.e. the server now holds all 'tenants' as a Set, rather then List, but the VO objects still return it as a List so that client code does not need to be updated). You can also find tools to generate the value objects, so your development costs aren't too much hire during the initial release...

  • Case When contruct in a trigger

    Hi gurus,
    I want to use the case when construct in a trigger instead of the regular select count(*) into statement to check the existence of a row but it does not work. I have used this extensively when I generate XML from many tables in a sproc and they work beautifully. Here is my code from the trigger.
    if :new.charge_conditions in ('DAB', 'DOB', 'IMB') then
                                  /*     -- do not know why the case does not work here! 12/04/2006     
                   case
                        when (select count(*) from boarder_date
                             where booking_no = :new.booking_no) <= 0 then
                             insert into boarder_date(booking_no, start_date)
                             values(:new.booking_no, sysdate);
                   end ;
                   select count(*) into v_boarderCount from boarder_date
                        where booking_no = :new.booking_no;
                   if v_boarderCount <= 0 or v_boarderCount is null then
                        insert into boarder_date(booking_no, start_date)
                        values(:new.booking_no, sysdate);
                   end if;
              end if;
    The error message is this,
    PLS-00103: Encountered the symbol "SELECT" when expecting one of
    the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    PLS-00103: Encountered the symbol ")" when expecting one of the
    following:
    . ( * @ % & - + ; / at for mod rem <an exponent (**)> and or
    group having intersect minus order start union where connect
    || indicator
    I have to use select count(*) into to make it work. Is that not allowed in a trigger or did I do something wrong with the syntax here? Thanks a lot.
    ben

    I don't believe that you can use the result of a query in a CASE statement in PL/SQL like you can in SQL. While it's perfectly valid to have
      1  select case when (select count(*) from emp) > 1
      2              then 1
      3              else 0
      4          end
      5*   from dual
    SCOTT @ nx102 JCAVE9420> /
    CASEWHEN(SELECTCOUNT(*)FROMEMP)>1THEN1ELSE0END
                                                 1
    Elapsed: 00:00:00.01you cannot do the same in PL/SQL
      1  declare
      2    i number;
      3  begin
      4    i := case when (select count(*) from emp) >= 1
      5              then 0
      6              else 1
      7              end;
      8* end;
    SCOTT @ nx102 JCAVE9420> /
      i := case when (select count(*) from emp) >= 1
    ERROR at line 4:
    ORA-06550: line 4, column 19:
    PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternativ
    ORA-06550: line 4, column 43:
    PLS-00103: Encountered the symbol ")" when expecting one of the following:
    . , @ ; for <an identifier>
    <a double-quoted delimited-identifier> group having intersect
    minus order partition start subpartition union where connect
    Elapsed: 00:00:00.04Of course, even if you could use a query in PL/SQL, you couldn't perform DML
      1  declare
      2    i number;
      3  begin
      4    i := case when 2 >= 1
      5              then
      6                begin
      7                  insert into emp( empno, ename ) values (17, 'JUSTIN');
      8                end;
      9              else 1
    10              end;
    11* end;
    SCOTT @ nx102 JCAVE9420> /
                  begin
    ERROR at line 6:
    ORA-06550: line 6, column 15:
    PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
    ( - + case mod new not null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set specification>
    <an alternatively-quot
    ORA-06550: line 9, column 13:
    PLS-00103: Encountered the symbol "ELSE" when expecting one of the following:
    end not pragma final instantiable order overriding static
    member constructor map
    Elapsed: 00:00:00.07Justin

  • I am using a mac mini 2011 an 3gs i phone 2010 macbook white 2008 and a new 2013 apple tv box. When i check info on the cloud I get 'upgrade your operating system to the latest. My question is is it possible to use the icloud system without an upgrade

    I am using a mac mini 2011 an 3gs i phone 2010 macbook white 2008 and a new 2013 apple tv box. When i check info on the cloud I get 'upgrade your operating system to the latest. My question is is it possible to use the icloud system without an upgrade

    iCloud requires OS X 10.7.2.

  • When using a personal dropbox account, is it possible to use the mapped drive without downloading all my dropbox files to my hard drive as well?

    When using a personal (not business) dropbox account on my mac book pro, is it possible to use the mapped drive only?  Currently I have dropbox mapped to my computer but it is also saving a redundant copy of the data on my hard drive.  My goal is to pull, edit and save files on the mapped drive only without having a redundant back up of all my dropbox files on my computer wasting valuable storage space.   Any advice out there?  Thanks in advance for your help!

    I don't believe that is accurate, but maybe I am missing something (I am not a Windows user).
    Looking at 2 explanation of how to map a Dropbox as a drive…
    http://lkeng.org/wp/?p=147
    https://www.youtube.com/watch?v=5d8uvseVr5A
    Both of those are linking to the 'local copy' of Dropbox. It is not a true 'network' drive as far as I can see (it still requires the local copy on the PC).
    Another video suggests using another service to mount the Dropbox, but that is not using Dropbox anymore, it is going through Otixo…
    https://www.youtube.com/watch?v=FAIpm2qmglU
    Dropbox does not provide easy to use URL's to mount as a network disk so I don't think this is possible on OS X.
    Dropbox's forum has this too…
    https://www.dropboxforum.com/hc/communities/public/questions/202133795-How-to-ma p-dropbox-as-a-network-drive-on-Mac?loca…
    You may need to examine the Windows computers carefully - if they have Dropbox installed & running then all the files are stored on the local machine in addition to the 'mapped drive'.
    It looks to me like people are 'redirecting' the local copy to appear like a remote disk just so they can address that path on other machines - each PC is being setup the same. You could create aliases on OS X, but it doesn't help move files off the machine.
    Hopefully someone else will contradict me, but I don't think this is how Dropbox works.

  • Is it possible to use variant configuration (with a Non-SAP solution) when creating ERP sales orders in SAP CRM WebUI

    Hello,
    our customer plans to use a Non-SAP solution for variant configuration (Camos) in SAP ERP (ECC 6.0) and in SAP CRM 7.0 EHP1 as well.
    ERP sales orders (and ERP quotations) should be created in SAP CRM (CRM WebUI).
    Is it possible to use variant configuration (with an external variant configuration tool) when creating ERP sales orders and quotations in the SAP CRM WebUI or do we have to implement SAP IPC for this?
    Thanks in advance.
    Regards,
    AEV

    Dear AEV,
    I think LORD (lean orders) should work with variant configuration as well. In the note 1236015 there is not restriction listed. However you need lord2 activated in ECC, and ECC system should be on EHP4.
    Best regards
    Rene

  • Possible to overwrite a pdf when in use or open a pdf without holding/locking the file for update

    Possible to overwrite a pdf when in use OR alternative open a pdf without holding/locking the file
    We frequently generate pdf files from our 3D program and would like to know if it's possible to either open a pdf file in a way that it doesn't get locked or hold up so the pdf can be updated even when opened or in use.
    Most programs e.g. ultra edit & notepad will let go the file when you opened and hence the file can be updated or over written even when in use.
    If any guru can help, would be highly appreciated

    Hi Abbas,
    It's not possible to overwrite a pdf when it is already in use by a different program or user. The file then opens up in Read Only mode.
    You can make a copy of the file and then apply those changes later in the original file. That's the only possible solution.
    Regards,
    Rahul

  • Is it possible to use a case statement when joining different tables based on input parameters?

    Hi,
    I have a scenario where my stored procedure takes 5 parameters and the users can pass NULL or some value to these parameters and based on the parameters, I need to pull data from various tables.
    Is it possible to use a case statement in the join, similar the one in the below example. I'm getting error when I use the below type of statement.
    select a.*
    from a
    case
    when parameter1=1 then
    inner join a on a.id = b.id
    when parameter1=2 then
    inner join a on a.id = c.id
    end;
    Please let me know, if this type of statement works, and if it works will it create any performance issues?. If the above doesn't work, could you please give me some alternate solutions?
    Thanks.

    Here's a technique for joining A to B or C depending on the input parameters. In theory, you are joining to both tables but the execution plan includes filters to skip whichever join is not appropriate. The drawback is that you have to do outer joins, not inner ones.
    CREATE TABLE A AS SELECT LEVEL ak FROM dual CONNECT BY LEVEL <= 100;
    CREATE TABLE b AS SELECT ak, bk
    FROM A, (SELECT LEVEL bk FROM dual CONNECT BY LEVEL <= 10);
    CREATE TABLE c(ak, ck) AS SELECT ak, bk*10 FROM b;
    variable p1 NUMBER;
    variable p2 NUMBER;
    exec :p1 := 1;
    exec :p2 := 20;
    SELECT /*+ gather_plan_statistics */ A.ak, nvl(b.bk, c.ck) otherk FROM A
    LEFT JOIN b ON A.ak = b.ak AND :p1 IS NOT NULL AND b.bk = :p1
    LEFT JOIN c ON A.ak = c.ak AND :p1 is null and :p2 IS NOT NULL and c.ck = :p2
    WHERE A.ak <= 9;
    SELECT * FROM TABLE(dbms_xplan.display_cursor(NULL,NULL,'IOSTATS LAST'));
    | Id  | Operation             | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers |
    |   0 | SELECT STATEMENT      |                 |      1 |        |      9 |00:00:00.01 |       7 |
    |*  1 |  HASH JOIN OUTER      |                 |      1 |      9 |      9 |00:00:00.01 |       7 |
    |*  2 |   HASH JOIN OUTER     |                 |      1 |      9 |      9 |00:00:00.01 |       7 |
    |*  3 |    TABLE ACCESS FULL  | A               |      1 |      9 |      9 |00:00:00.01 |       3 |
    |   4 |    VIEW               | VW_DCL_5532A50F |      1 |      9 |      9 |00:00:00.01 |       4 |
    |*  5 |     FILTER            |                 |      1 |        |      9 |00:00:00.01 |       4 |
    |*  6 |      TABLE ACCESS FULL| B               |      1 |      9 |      9 |00:00:00.01 |       4 |
    |   7 |   VIEW                | VW_DCL_5532A50F |      1 |      9 |      0 |00:00:00.01 |       0 |
    |*  8 |    FILTER             |                 |      1 |        |      0 |00:00:00.01 |       0 |
    |*  9 |     TABLE ACCESS FULL | C               |      0 |      9 |      0 |00:00:00.01 |       0 |
    Predicate Information (identified by operation id):
       1 - access("A"."AK"="ITEM_0")
       2 - access("A"."AK"="ITEM_1")
       3 - filter("A"."AK"<=9)
      5 - filter(:P1 IS NOT NULL)
       6 - filter(("B"."AK"<=9 AND "B"."BK"=:P1))
       8 - filter((:P2 IS NOT NULL AND :P1 IS NULL))
       9 - filter(("C"."AK"<=9 AND "C"."CK"=:P2))
    You can see that table C was not really accessed: the buffer count is 0.
    exec :p1 := NULL;
    SELECT /*+ gather_plan_statistics */ A.ak, nvl(b.bk, c.ck) otherk FROM A
    LEFT JOIN b ON A.ak = b.ak AND :p1 IS NOT NULL AND b.bk = :p1
    LEFT JOIN c ON A.ak = c.ak AND :p1 is null and :p2 IS NOT NULL and c.ck = :p2
    WHERE A.ak <= 9;
    SELECT * FROM TABLE(dbms_xplan.display_cursor(NULL,NULL,'IOSTATS LAST'));
    Now table B is not accessed.
    | Id  | Operation             | Name            | Starts | E-Rows | A-Rows |   A-Time   | Buffers | Reads  |
    |   0 | SELECT STATEMENT      |                 |      1 |        |      9 |00:00:00.02 |       7 |      2 |
    |*  1 |  HASH JOIN OUTER      |                 |      1 |      9 |      9 |00:00:00.02 |       7 |      2 |
    |*  2 |   HASH JOIN OUTER     |                 |      1 |      9 |      9 |00:00:00.01 |       3 |      0 |
    |*  3 |    TABLE ACCESS FULL  | A               |      1 |      9 |      9 |00:00:00.01 |       3 |      0 |
    |   4 |    VIEW               | VW_DCL_5532A50F |      1 |      9 |      0 |00:00:00.01 |       0 |      0 |
    |*  5 |     FILTER            |                 |      1 |        |      0 |00:00:00.01 |       0 |      0 |
    |*  6 |      TABLE ACCESS FULL| B               |      0 |      9 |      0 |00:00:00.01 |       0 |      0 |
    |   7 |   VIEW                | VW_DCL_5532A50F |      1 |      9 |      9 |00:00:00.01 |       4 |      2 |
    |*  8 |    FILTER             |                 |      1 |        |      9 |00:00:00.01 |       4 |      2 |
    |*  9 |     TABLE ACCESS FULL | C               |      1 |      9 |      9 |00:00:00.01 |       4 |      2 |

  • Problem with 0FIGL_VC1 when use constant selection in the query

    Please kindly help me. I have this problem for 2 weeks already.
    When I create a query from virtual cube 0FIGL_VC1 (balance sheets / p&l statements), if I use constant selection in any of key figure, my report could not display financial statment correctly. 
    My report layout
    Columns :  key figures  (including 0FIGL_VC1_CK001)
    Rows:  0GLACCEXT  (financial statement item) << as hierarchy
    Initially, the query is processed correctly.
    However, based on the requirement from my customer, I really have to use "constant selection" for some of my columns. Whenever I do so, the query display incorrectly. (Some nodes of financial statement item just disappear. (it seem like all contra item will disappear.)  
    Please help!

    If I dont use constant selection in the query, data are display correctly.
    But If I use constant selection in the query, some financial statement item dont display any value
    Example :
       Financial statement item(Display in hier)     Period1   Total Period1(Constant selection)
                 A                                                       10            60
                 B                                                       20            60
                 C                                                       30            60
                 D                                                       0              60
    - Financial statement item "D"  has some value.
    - Financial statement item "D"  is in the hierarchy,one gl account has been assigned to more than one group differentiated by debit/credit indicator.
    Please help!!

  • Is it possible to use markers in a Premiere Pro sequence such as Chapter / Comment / Segmentation and export the XMP metadata for a database so that when the video is used as a Video On-Demand resource, a viewer can do a keyword search and jump to a relat

    Is it possible to use markers in a Premiere Pro sequence such as Chapter / Comment / Segmentation and export the XMP metadata for a database so that when the video is used as a Video On-Demand resource, a viewer can do a keyword search and jump to a related point in the video?

    take have to take turns
    and you have to disable one and enable the other manually

  • Is it possible to use software limits on 7354 board when switching control modes from open to closed or closed to open loop?

    Is it possible to use software limits on 7354 board when switching control modes from open to closed or closed to open loop?

    Hello Richard,
    When you say 'open loop' and 'closed loop', are you referring to running the application in position and torque mode? If not, how exactly are your controlling a servo motor in open loop? 
    In closed loop mode, the encoder values will be used as reference and the motion VIs can be used to configure the software limit as required. Are you currently losing the software limits? If so, how exactly are you losing these values? I am not sure I understood what exactly is happening with software limits in your program, so any more information on this would be useful. 
    Vivek Nath
    National Instruments
    Applications Engineer
    Machine Vision

  • Is it possible to use imessage only in wifi and sms when no wifi is available?

    is it possible to use imessage only in wifi and sms when no wifi is available? I have unlimited texting but only 200mb of data. I know how to turn i messaging on/off manually but is there away to set it so it does it automatically?

    The only option you have is to turn off cellular data completely. You are correct, there is no setting for cellular data for messages. If you toggle iMessage off/on multiple times, you will end up with problems, since others will not know if you have iMessage off/on, and will continue to try to send iMessages to you. Also, you may find you will have problems with iMessage activating again after turning it off. iMessages do not use very much data, but if you are using data for other reasons, that could use up the limited pool of data you mentioned

  • Is it possible to save a Photoshop project with multiple tabs (inducing images) for later use. Now, when I close Photoshop, it ask to save each tab separately and they are not staying in the project for later usage. Thanks in advance for you help.

    Is it possible to save a Photoshop project with multiple tabs (inducing images) for later use. Now, when I close Photoshop, it ask to save each tab separately and they are not staying in the project for later usage. Thanks in advance for you help.

    You should ask in Photoshop General Discussion
    The Cloud forum is not about using individual programs
    The Cloud forum is about the Cloud as a delivery & install process
    If you will start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

Maybe you are looking for