Decode - not in

Hi, I want to do the following logic using decode:
if code = 1 OR code = 2 or code=3 THEN
     ..and db_code=code
else
..and db_code!=1 and db_code!=2 and db_code!=3
END IF
I don't find similar examples searching here. The idea would be:
and db_code=decode(code,'-1',not in 1 not in 2 not in 3,code)
The problem is the 'else' code, if it was 'any code' it would be to pass -1 as code and:
and db_code=decode(code,'-1',db_code,code)
but isn't the case.
Thanks in advance

Hi,
I agree with Eric - it's hard to understand your exact requirements,. However, if you are trying to alter your Select query based on the value of Code, you might want to try Dynamic SQL.
Check out the Table & the Procedure :-
CREATE TABLE TEST_CODE
     CODE     VARCHAR2(10),
     DB_CODE     VARCHAR2(10)
INSERT INTO TEST_CODE VALUES (1,1);
INSERT INTO TEST_CODE VALUES (2,1);
INSERT INTO TEST_CODE VALUES (3,2);
INSERT INTO TEST_CODE VALUES (4,1);
COMMIT;
CREATE OR REPLACE PROCEDURE PR_GET_DECODES
     P_CODE VARCHAR2
AS
     V_SELECT_SQL     VARCHAR2(100);
     V_JOIN_SQL     VARCHAR2(100);
     V_SQL          VARCHAR2(100);
BEGIN
     FOR rec IN ( SELECT CODE FROM TEST_CODE )
     LOOP
          V_SQL:= ' SELECT CODE,DB_CODE FROM TEST_CODE WHERE ';
          IF rec.CODE = 1 OR rec.CODE = 2 OR rec.CODE =3
          THEN
               V_SQL:= V_SQL || ' DB_CODE = CODE ';
          ELSE
               V_SQL:= V_SQL || ' DB_CODE<>1 AND DB_CODE<>2 AND DB_CODE<>3 ';
          END IF;
          EXECUTE IMMEDIATE V_SQL;
     END LOOP;
END;
/It's just an example of what can be done - you can check out various other options with Dynamic SQL.
Regards,
Sandeep

Similar Messages

  • Archive url access throws error "SSF error: Decoding not possible"

    Hi
    We are using function module HRWPC_RFC_EP_READ_PHOTO_URI to pull the photo of an employee in ESS.
    When we paste the url in browser we get following error
    SSF error: Decoding not possible
    Can anyone help to resolve this.
    regards
    barin

    Barin,
    check these links
           1060613       SSF error, Decoding not possible       
         983550      SSF-Error occurs when viewing attachments of a solution
    https://forums.sdn.sap.com/click.jspa?searchID=17894100&messageID=5942357
    https://forums.sdn.sap.com/click.jspa?searchID=17894100&messageID=6347898
    Thanks
    Bala Duvvuri

  • SSF error: Decoding not possible

    Hi all,
    I need to get the absolute URI from a DOC_ID (TOAHR table), to display an employee photo in the browser.
    I'm trying with the following FM:
    SCMS_AO_URL_READ
    ARCHIVELINK_URL_GENERATE
    but both returns me sy-subrc = 0, the same URL and the same error message:
    "SSF error: Decoding not possible"
    when I'm copying the returned URL in the browser...
    anybody could tell me what's the problem / error?
    Thanks!
    Miguel Angel.

    ok i've got it....
    i used cl_crm_documents=>get_with_url to geht the urls.
    the returning value is cutted in the gui after some chars. thats why copy and past didn't work for me.
    but variable conatains the complete url, althoug the complete url isnt shown on the gui.
    i tried something like this, and it worked:
    CALL FUNCTION 'CALL_BROWSER'
    EXPORTING
       URL                          =  lv_url
    EXCEPTIONS
       FRONTEND_NOT_SUPPORTED       = 1
       FRONTEND_ERROR               = 2
       PROG_NOT_FOUND               = 3
       NO_BATCH                     = 4
       UNSPECIFIED_ERROR            = 5
       OTHERS                       = 6

  • "DVD DECODER NOT PRESENT" in Lombard 400mhz G3?

    I recently bought a Lombard 400mhz G3 Powerbook online which plays DVD'S fine in OS9. However my freind as since bought the same model - 400mhz 1mb cache DVD Rom etc but his won't play DVD'S in OS9 at all. The system profiler says "DVD DECODER NOT PRESENT", how can this be and what is the likley problem?
    Thanks.

    Mark,
    Your mentioning the PRAM reset was interesting...I vaguely recall this issue a long time ago with the same results.
    Are you sure the PRAM reset was successful? One way to tell is to turn AppleTalk 'off', then reset PRAM (allow 2-3 chimes); the default setting is 'on' after a reset. there are other items stored in PRAM also:
    http://docs.info.apple.com/article.html?artnum=2238
    You might also boot to a compatible MacOS System CD and check the System Profiler that is in the booting System Folder just to make sure some oddball software issue on the HD is not causing a problem.
    I hope I have not lead you astray. If the decoder was on the logic board and died, I hope it will not interfere with the operation of the PC card. I just don't have an answer to this because I have never run across it. I can only hope this is successful...

  • Decode Not working in sql loader

    I had a requirement of loading flatfile into staging table using SQL Loader, One of the columns in the the Flat file is having values FALSE or TRUE and my requirement is that I load 0 for FALSE and 1 for TRUE which can be achieved by simple DECODE function...I did use decode and tried to load several times but did not work. What might be the problem
    LOAD DATA
    INFILE 'sql_4ODS.txt'
    BADFILE 'SQL_4ODS.badtxt'
    APPEND
    INTO TABLE members
    FIELDS TERMINATED BY "|"
    ( Person_ID,
    FNAME,
    LNAME,
    Contact,
    status "decode(:status, 'TRUE', '1','FALSE','0')"
    I did try putting a trim as well as SUBSTR but did not work....the cloumn just doent get any values in the output (just null or say free space)
    Any help would be great.....

    Hello user8937215.
    Please provide a create table statement and a sample of data file contents. I would expect DECODE or CASE to work based on the information provided.
    Cheers,
    Luke
    Please mark the answer as helpful or answered if it is so. If not, provide additional details.
    Always try to provide create table and insert table statements to help the forum members help you better.

  • Adobe reader XI can't open mp3 files in a pdf document- says the required decoder not installed

    Adobe reader XI can't open mp3 file links contained in a pdf - it says the required decoder is not installed
    please help!

    This is not a function of Reader, but that your computer does not seem to be configured to play mp3 files. Try fixing your file associations. The method of doing so depends upon your OS and it version number.

  • DECODE not working!!!

    Hello,
    Why DECODE doesnt work in a computed unbound item,
    my use is :
    SUM (DECODE(item,'value',-(item1),item1))
    the 3 items are in the same block,
    I tried with :
    SUM (DECODE(:block.item,'value',-(:block.item1),:block.item1))
    How can I do this, I need the unbound item to be calculated automatically ,,,
    HELP!!!!!!!!!

    Hello Cal,
    My problem is the following :
    I have an unbond item in a bloc 1, inside I have to make a Sum, this sum must take consideration of a status and an amount witch are in another bloc2.
    First, I have tried with a computed item :
    sum decode.......), with no result!!!
    Then, I used, a client side function ( a query on columns in tables), the result is correct only when I query the form the first time,
    But, IF I change one of the items ( status or amount),
    save the changes, the unbound is not refreshed although I recalcul it in the when- validate-item of the two items ( staus and amount), the error is something like: cannot update a calculated item...
    any help ?

  • Decode not called for all UIComponents in tree

    Many of the faces .jsp pages I have been working with in EA2 have not been updating their models properly.
    The symptom I have observed is that the decode method is not called for all of the UIComponents on the page.
    I think I have tracked this down to a bug in the class com.sun.faces.tree.TreeNavigatorImpl. This class appears to be used internally by some of the .jsf code to navigate the component tree.
    Studying various stack traces, it looks like the method TreeNavigatorImpl.getNextStart() is supposed to provide a preorder traversal of the component tree. Starting from the root of the tree, each call is expected to return the next node. Experimental evidence suggests that it is not doing that properly, and it fails to visit all the nodes in the tree.
    For example, if my component tree looks like this (this is a representation of the tree; not an example of a .jsp page):
    <node id = "/">
       <node id = "page">
          <node id = "carStoreForm">
             <node id = "ba0">
                 <node id = "ba1">
                     <node id = "ba3"/>
                     <node id = "br4"/>
                 </node>
             </node>
             <node id = "bold1"/>
             <node id = "more1"/>
          </node>
       </node>
    </node>A preorder traversal of these nodes should visit nodes:
    '/page'
    '/page/carStoreForm'
    '/page/carStoreForm/ba0'
    '/page/carStoreForm/ba0/ba1'
    '/page/carStoreForm/ba0/ba1/ba3'
    '/page/carStoreForm/ba0/ba1/br4'
    '/page/carStoreForm/bold1'
    '/page/carStoreForm/more1'
    However, when I write test code that calls TreeNavigatorImpl.getNextStart() directly, only the following nodes are returned:
    '/page'
    '/page/carStoreForm'
    '/page/carStoreForm/ba0'
    '/page/carStoreForm/ba0/ba1'
    '/page/carStoreForm/ba0/ba1/ba3'
    '/page/carStoreForm/ba0/ba1/br4'
    It looks to me like the method loses track of the state of the traversal, and prematurely returns null before all the nodes are visited. (It is failing to return the "bold1" and "more1" nodes.)
    This is all extremely speculative. Without jsf source or doc for any of the tree classes, it is difficult to know what is supposed to be going on. And, of course, I may just have a bug in my code.

    Okay, rather than wait for Max to respond, I decompiled the TreeNavigatorImpl class myself and studied the source code. The
    problem arises in the getNextStart() method. If the method returns
    a null value, then presumably the class has successfully traversed
    the entire tree in preorder. Unfortunately, there was a slight
    logic error that would halt traversal after you got to the last node
    of the last subtree at the beginning of your travels.
    The following code should correct this situation (let me know if I've
    introduced any new problems into the mix...). I tested this out using the simple example that Max describes above. The test code appears at the end of my revised method:
    public UIComponent getNextStart() {
    UIComponent cur = null;
    if (startTraversalDone) {
    return cur;
    if (startStack.empty()) {
    cur = root;
    Iterator iter = cur.getChildren();
    if (iter.hasNext()) {
    startStack.push(iter);
    else {
    while (!startStack.empty()) {
         Iterator iter = (Iterator) startStack.peek();
         if (iter != null && iter.hasNext()) {
         cur = (UIComponent) iter.next();
         Iterator childIter = cur.getChildren();
         if (childIter != null && childIter.hasNext()) {
         startStack.push(childIter);
         else {
         if (!iter.hasNext()) {
         startStack.pop();
         break;
    else {
         startStack.pop();
    if (startStack.empty()) {
    startTraversalDone = true;
    if (cur != null) {
    endStack.push(cur);
    return cur;
         public static void main(String[] args) {
              MyComp root = new MyComp("root");
              // build tree....
              MyComp page = new MyComp("page");
              root.addChild(page);
              MyComp csf = new MyComp("csf");
              page.addChild(csf);
              MyComp ba0 = new MyComp("ba0");
              csf.addChild(ba0);
              csf.addChild(new MyComp("bold1"));
              csf.addChild(new MyComp("more1"));
              MyComp ba1 = new MyComp("ba1");
              ba0.addChild(ba1);
              ba1.addChild(new MyComp("ba3"));
              ba1.addChild(new MyComp("ba4"));
              MyTreeNavigator nav = new MyTreeNavigator(root);
              MyComp comp = null;
              while ((comp = (MyComp) nav.getNextStart()) != null) {
                   System.out.println(comp.getComponentId());
    public class MyComp extends UIComponentBase {
         public MyComp(String id) {
              this.setComponentId(id);
         public String getComponentType() {
              return "MyComp";

  • Decode not working on ViewObject

    In the expert mode of the view object I have a Decode Statement as
    DECODE(SUBSTR(ViewParameterPaEO.REC_STATUS,1,1),'I','INVALID')
    Column REC_STATUS is varchar2(3). The value in the Data base is "I1"
    If I access the data using DataTableComponent it returns "INV",
    Now if I use <jbo:showvalue> tag it returns "I1" (This is the value in the Database).
    Why is this happening.
    Thanks

    SELECT ViewParameterPaEO.PARM_ID,
    ViewParameterPaEO.CODE_ID,
    ViewParameterPaEO.AREA,
    ViewParameterPaEO.PARAMETER_NAME,
    ViewParameterPaEO.VALUE,
    ViewParameterPaEO.PARM_BEGIN_DATE,
    ViewParameterPaEO.PARM_END_DATE,
    ViewParameterPaEO.MODIFIER_CODE,
    ViewParameterPaEO.PROVIDER_TYPE,
    ViewParameterPaEO.PROVIDER_ID,
    ViewParameterPaEO.PROVIDER_GROUP,
    ViewParameterPaEO.PLACE_OF_SERVICE_CODE,
    ViewParameterPaEO.SPECIALTY_CODE_GRP,
    ViewParameterPaEO.PROGRAM_TYPE,
    ViewParameterPaEO.TYPE_OF_PROCEDURE,
    DECODE(SUBSTR(ViewParameterPaEO.REC_STATUS,1,1),'I','INVALID')
    FROM VIEW_PARAMETER_PA ViewParameterPaEO
    FYI- I tried to give a alias name as DECODE(SUBSTR(ViewParameterPaEO.REC_STATUS,1,1),'I','INVALID') REC_STATUS it still did not work.
    Thanks

  • SB0460 AC3/DTS decoder not working on Windows 7 (Driver 2.18.0015)

    Hello everybody!
    I hope somebody will be able to help me with my strange problem:
    I just did the move from Windows XP (x64) to Windows 7 (x64) and discovered that the X-FI's AC3/DTS decoder is not working. All I get is either noise/static/crackling (AC3) or no sound at all (DTS). I have an X-FI XtremeMusic card (Serial: MSB0460535000206P) and the decoder is working absolutely fine on Win XP.
    The latest driver version 2.8.005 is installed. I have also tried the first driver (2.8.003) that was supposed to have fixed the decoder under Windows 7. The changelog there says: Dolby? Digital and DTS? decode re-established for sound cards that included decoding in their Windows XP drivers. No such luck for me.
    My sound card is definitely supported so I'm wondering why it's not working.
    Use Built-in Decoder is selected in the Audio Control Panel I'm passing audio to S/PDIF (from e.g. PowerDVD or MPC-HC). On Win XP usually the on screen display pops up when the decoder detects the signal, nothing on Win 7.
    (Note that I am NOT trying to input a signal from an external source.)
    Gi'ven everything I have tried, logic tells me that there may still be a bug lurking in the decode driver.
    Any ideas?

    FI think you have to pay now for the decoder when using digital output but not sure what soundcards are limited.... otherwise try this drivers and see this help but i dont know if they will work...
    http: //forums.creative.com/t5/Sound-Blaster/PAX-PCI-XFI-ALL-OS-Driver-V4-5/td-p/574643

  • Error msg: Software to decode not on system

    I am working on an Encore project. I created the project, imported audio/video to a timeline, saved it and closed it. I'm now attempting to reopen it, and I get this error msg: "The software that's used to decode the media is not available on this sytem. Installing the correct decoders for the files you are working with may help to correct the problem." Say what, I just created this project, worked on it for awhile, it seemed fine. What decoders are they talking about. Any help greatly appreciated. Thanks,
    ~Bond

    Codec & Format information, with 2 links inside to read
    -read both links in reply #1 http://forums.adobe.com/thread/1270588
    Report back with the codec details of your file, use the programs below... A screen shot works well to SHOW people what you are doing
    http://forums.adobe.com/thread/592070?tstart=30 for screen shot instructions
    For PC http://mediainfo.sourceforge.net/en or http://www.headbands.com/gspot/
    For Mac http://mediainspector.massanti.com/

  • Compatible DVD decoder not installed

    Hello. I am so helpless...and need advice, please someone....
    I was working on a project in Premiere Pro and my computer(Windows XP 1GB) crashed. I heard compatibility problems with CS3 and Vista, so I took my computer to a repair place. It came back with a new hard drive, but the computer says "Compatible DVD decoder is not installed in the computer." All it has is Window Media player..... I have CS (the initial CS version), and I need Windows XP so that I can use Premiere CS version. I do not have any newer version of Premiere than CS. I am sorry, but I am totally lost and have no idea what to do.....

    The message is probably telling you that your trying to play a DVD-Video disc without having an
    MPEG-2 codec installed. Except for some versions of Vista, Windows doesn't come with an MPEG-2 codec. Most of the time it gets automatically installed with a DVD player software that often is bundled with a DVD drive. Maybe you have an installation disc of such a player lying around somewhere.
    Otherwise you will need to buy the codec:
    DVD Decoder (MPEG-2 Decoder) Plug-ins
    You can check whether or not a Media Player compatible MPEG-2 codec is installed with this utility:
    Windows XP Video Decoder Checkup Utility

  • Basic query using DECODE not working as expected.

    Version:11.2.0.3
    Platform: RHEL 5.8
    I am trying to use DECODE function.
    In the below example, If the search encounters the string "Enterprise" , then the decode should
    return 'Enterprise' . But it doesn't seem to work.
    I thought some hidden character was causing the issue, so, I used TRIM. But no luck.
    SQL> create table t (banner varchar2(80));
    Table created.
    SQL> insert into t values ('Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    SQL> select * from t where banner like '%Database%';
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    -- Trying to use decode. If the search encounters the string "Enterprise" , then return 'Enterprise'
    -- Although the string "Enterprise" is present ,  decode doesn't seem to work.
    -- I tried using trim , upper . But no luck.
    SQL> select 'EDITION', decode(banner,'%Enterprise%','Enterprise','Standard') Edition from t where banner like '%Database%';
    'EDITIO EDITION
    EDITION Standard
    SQL> select 'EDITION', decode(trim(banner), '%Enterprise%','Enterprise','Standard') Edition from t where trim(banner) like '%Database%';
    'EDITIO EDITION
    EDITION Standard
    SQL> select 'EDITION', decode(upper(trim(banner)), '%ENTERPRISE%','Enterprise','Standard') Edition from t where upper(trim(banner)) like '%DATABASE%';
    'EDITIO EDITION
    EDITION Standard
    SQL>
    Just don't understand why decode can't see the string "Enterprise"
    BTW . Where is the preview button ?

    It (a portion string matching) ain't work in DECODE, for this CASE has a advantage of using over it.
    Like
    with t
    as
    (select 'Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production' banner from dual)
    select 'EDITION',
    case when banner like '%Enterprise%' then 'Enterprise' else 'Standard' end edition
    from t
    'EDITIO EDITION
    EDITION Enterprise

  • JSON.decode not working

    Hi All,
    I have some JSON code that is generated from my server. I am
    trying to decode the JSON using the as3corelib. I am receiving the
    error Unexpected character v encountered. It's from the viewentry
    line at the beginning of the attached JSON code.
    Any thoughts on why this is?
    I can't change the JSON being generated so I'm going to have
    to handle it in the JSON decoder . . .

    You property name -- xaxis in this case -- must be a quoted
    string:
    private function decode() : void {
    var s:String = '{
    "xaxis":["test1","test2","test3","test4","test5"]}';
    var o:Object = JSON.decode(s);
    var a:Array = o['xaxis'] as Array;
    Alert.show(a.length.toString());

  • 2D barcode decoding not working with Reader Extensions trial certificate

    Dear All
    After I import the last reader extensions trial certificate for ES4, but why 2D barcode decoding checkbox is disable in the service web page?
    thanks

    A new certificate with 2D barcode capabilities has been uploaded to the LiveCycle devnet site http://www.adobe.com/devnet/livecycle.html, the direct link is http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/livecycle/solutions/R eaderExtensionCert%20p16.zip

Maybe you are looking for

  • Variables order problem in WAD?

    Actually I am using 5 queires in the template. In first query President,Group,Cycle,Fiscyer ,Date is the order and it is appearing in my Bex properly. In next all the queries President,Fiscyer,Date is the order.This is appearing corrctly in my Bex. B

  • C5 / Charging takes up whole night

    Normally my C5 charges fully from 1 to 7/7 bars in about 1,5h, very fast! Sometimes it happens that I plug in the phone at night and the next morning it appears to be still charging. I.e. bars are still moving and the beep and message saying fully ch

  • PSE8 Full screen view with high-res images

    The Full Screen View in PSE8 doesn't seem to cope well with high-resolution images, eg from a full-frame DSLR (eg my Sony A850 with 6000 x 4000 px). After selecting an image in Organsier and starting Full Screen View the first image is displayed succ

  • Renaming NDS users to their corresponding GroupWise ID

    Hi, We're renaming lots of NDS users to their corresponding GroupWise ID. Because of a new ID naming standard. The GroupWise ID does not change but is leading. As in NDS ID smithj has a GroupWise ID jsmith so we rename NDS ID smithj to jsmith. We do

  • Oracle Invoice Approval

    Hi I've just started looking at an existing setup for Invoice Approval.  There is a custom workflow in place here to utilise looking at the position hierarchy and looking for the 'Primary flag' of an assignment in order to select 1 assignment per per