DECODE in expression

Hello list,
How do I go about DECODE function in expression?
It's legal only in SQL statement, so validation is fine, but when OWB deploys a script I have error message because DECODE is used in PL/SQL as well. I have solved it temporarly manually changing the script, but this is an error-prone method. What are other solutions except creating user transformation?
TIA,
Alex

I have tried it, but it won't work.
For instance:
case INGRP1.CD
when 1 then 2
else 3
end
Gives the folowing error:
Line 1, Col 1:
PLS-00103: Symbool "CASE" aangetroffen terwijl een van de volgende werd verwacht:
( - + mod 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 time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
This means that the word CASE cannot be used as first.
Any suggestions? I cannot found any documentation about creating expressions (syntax, functions, examples).
Very sad, because it takes a lot of time to accomplish such a simple thing.
Regards,
Maurice

Similar Messages

  • Using Decode in Expression Builder...

    Hi everybody,
    I want to use the DECODE function of SQL in an Expression Builder....
    Of course this function does not exist in any of the transformation categories(arithmetic,character,e.t.c.) in the expression builder.
    I have read in the OWB on-line help that in the Expression Builder there should be an 'Others' drop - down list in order to select any of the available SQL clauses - one of them is 'decode'...
    The problem is that this drop - down list in the Expression Builder is disabled.....
    How can I use this function anyway..????
    Instead of using ... in the Expression Builder...
    decode(<column_name>,'1','val_one','2','val_two') what can I use to do the same....???
    As regards the problem that the drop-down list is disabled , what may be the cause..???
    I use Microsoft XP machine , Oracle 10g (v.10.2) and OWB v.10.1.0.4
    The documentation says....
    "This allows you to deploy the DECODE functionality in all operating modes (setbased, rowbased, etc.) and transparently across Oracle database releases (8.1, 9.0 and 9.2)."
    The above means that the cause is the incompatibility..????
    Thanks , a lot
    Simon

    I am using OWB 9.2.0.8 and I can't reproduce the problem you are having with 10.1, but did you try just typing it into the expression?
    Or, better yet, use CASE. The syntax is easier to read. I think OWB translates DECODEs to CASE when the SQL is generated.
    (Case <column_name>
       When '1' Then 'val_one'
       When '2' Then 'val_two'
    End)

  • OWB Error for using Decode in Expression

    Debug code deployment messages:
    LINE 4558 ,COLUMN 71:
    PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only
    LINE 4558 ,COLUMN 17:
    PL/SQL: Statement ignored
    End debug code deployment messages
    DBG1012: Debug deployment errors, can't run debug code.

    What i have experience is that if you use Decode inside the expression the OWB cannot validate it .
    But it will execute perfect.
    Use Case statement so that you can validate it and debug then
    Cheers
    Nawneet

  • Decode limited expression?

    Hello Guru's,
    I have a table t with 13,000 records.
    I am attempting to update records in a column, example:
    update t
    set col1=(decode(col1,'AA','Antiseptic',
    ,'BB,'Builder',
    ,'CC','Contractor'))
    commit;
    The problem is that I have to update around 300 types of AA, BB at once- needless to say DECODE has it's limits. So, not being a very good developer I decided to break the decode updates to every 40 or so types- this did not work.
    It would update only on the first set of decoding I did- around 40 enteries, then the next update I made did not work.
    Is there anyway I can update these all 300 types in one execution? Or is there another way to update the records with another expression other than decode that will allow 300 plus type updates?
    I hope this is not confusing.

    While my strong preference would be to use a dummy table approach as Eric and 519668 suggested, if y ou really want to go the DECODE route, and I still prefer the dummy table, then your update statements need to be like:
    UPDATE t
    SET col = DECODE(col, 'AA', 'Antiseptic',
                          'BB', 'Builder',
                          'CC', 'Contractor')
    WHERE col in ('AA', 'BB','CC');
    UPDATE t
    SET col = DECODE(col, 'DD', 'Developer',
                          'EE', 'Engineer',
                          'FF', 'Foo')
    WHERE col in ('DD', 'EE','FF');But really, put the values in a table and use that table to update as suggested.
    HTH
    John

  • I cant put .xesc in decoder (microsoft Expression Encoder) or windows movie player

    tell me how we can decode an .xesc after renaming it cause if I double click it it plays but when I drag into wmm it says it not compatable please send a solution back please

    I've had pretty good luck with Flip4Mac. Here's a blurb about what it will translate (thru Quicktime):
    Advanced Systems Format (ASF), Advanced Stream Redirector (ASX) and Audio Video Interleaved (AVI). The plug-in can also handle Windows Media Video (WMV) containers, which have the same roots as ASF. The Microsoft's audio container, Windows Media Audio (WMA) is also supported by this plug-in.
    One quick question....you downloaded it, but did you install it? Sorry if that's a dumb question for you, but, for some, it's a reasonable concern.
    All that being said, if you're asf isn't playing, possibly it doesn't conform to a standard compatible with F4M. Occasionally I will run across a file that says it's a wmv, but hiding underneath is an unsupported codec, which renders it unplayable on a Mac with F4M, or anything else.
    Sometimes VLC will play content that nothing else will.

  • How to use DECODE function in Exspression?

    Hi,
    Can we use DECODE in Expression?
    I'm trying to use DECODE function but there is an error during the validation. But when i validate the mapping, it is successfully compiled but it is failed during deployment.
    But if I use CASE instead of DECODE, it works fine.
    Can we use DECODE in OWB???
    Thanks
    Raj

    Hi,
    In OWB 10gR2, if your are using only one DECODE in an expression, it's working. The package will compile when deploying the mapping. OWB will replace the DECODE by a CASE.
    But when you are using nested decode in an expression ( for example : decode(col1, 1, 'M', decode(col2, 'Madame', 'Mme', null)) ) only the first one is replaced by a case at deployment.
    In ROW_BASED mode, text of the expression is used outside of an sql statement and deployment will fails with "PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only."
    If operating mode for the mapping is set to SET_BASED, it's working because the expression is used in an sql statement.
    I have logged a SR in metalink for this issue and a bug is opened (bug 5414112).
    But I agree with you, it's better to use case statement.
    Bernard

  • Decode vs. Case in OWB Transformation

    Hello all,
    I am trying to count or sum all of Reasons where the value is Test. Here is the code which I would like to covert into OWB transformations:
    sum(decode( REASON ,'Test',1,0) )
    Step 1:
    I tried to use Decode in expression
    (decode( REASON ,'Test',1,0) ) and it gives me following error:
    Line 1, Col 1:
    PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only
    Line 0, Col 1:
    PL/SQL: Statement ignored
    It seems OWB does not recognize Decode. How should I solve the problem? Should i try using Case to substitute the above decode code ? like:
    Case
    when Reason='Test'
    then 'Test'
    End
    Am I doing it right?
    and following this I can use aggregator to Sum(test) for counting/summing all tests. Is there anyway I can use this code: sum(decode( REASON ,'Test',1,0) ) in one transformation? Please let me know.
    Thanks,
    K

    OWB provides case statement in place of decode. OWB does not recognize decode statements(till what i know, and tried out)
    Why dont you first use a filter (on reason='test') and then use an aggregrator transformation, You can put input as the column reason from the filter and make a new column in the output group for summing it.
    Hope i have solved your doubts....
    -Nikita.

  • Report Performance - Summary Fields Setting

    I have a report data model with 3 groupings. Summary fields are needed for each group. There are 2 approaches for me to have the summary values :
    1. i can set the data source of each summary field to be the corresponding column of my based Q_1 selection statement, and then set the "Reset At" for different data groups.
    2. On the other hand, i can set the data source to be the summary field of the inner data group.
    Could anyone tell me which method can give me a better performance? I want the report to run faster.

    Puvan,
    I figured out the problem myself. It is not a version issue.
    I was using a sum function on a decode expression in the sql command. The % total was applied on that sum expression. Every time I was reopening the report the sum expression was getting created in a new group.
    When I gave an alias for the sum(decode(xyz)) expression it is working fine now.
    I would still consider that as an issue with Reports Developer.
    FYI...
    Ritendra.

  • Summary fields in the JSP report

    I created a JSP report using Oracle 9i Reports Developer using report wizard. It has a %Total field on one of the columns.
    It is running good for the first time. But when I am closing and reopening the report the Summary column is showing a null value in the source column. And it would not run the report.

    Puvan,
    I figured out the problem myself. It is not a version issue.
    I was using a sum function on a decode expression in the sql command. The % total was applied on that sum expression. Every time I was reopening the report the sum expression was getting created in a new group.
    When I gave an alias for the sum(decode(xyz)) expression it is working fine now.
    I would still consider that as an issue with Reports Developer.
    FYI...
    Ritendra.

  • I am unable to run this query

    Can i use logical operator in decode in expression like following ..
    SELECT 'FY'||DECODE( TO_CHAR(TO_DATE('1/30/2008','MM/DD/YYYY'),'MON'),'JAN',
         DECODE('(TO_DATE(''1/30/2008'',''MM/DD/YYYY'') >= TO_DATE(''1/30/2008'',''MM/DD/YYYY''))','TRUE',
         TO_CHAR(TO_DATE('1/30/2008','MM/DD/YYYY'),'YYYY')
         ,TO_NUMBER(TO_CHAR(TO_DATE('1/30/2008','MM/DD/YYYY'),'YYYY')-1))
    ,TO_CHAR(TO_DATE('1/30/2008','MM/DD/YYYY'),'YYYY')
    ) FROM dual
    unable to get the result in true condition
    it should print FY2008 but printing FY2007 why?
    can anyone help me on this ?
    Regards
    shyam~

    Try This
    SELECT 'FY'||
    DECODE(TO_CHAR(TO_DATE('1/30/2008','MM/DD/YYYY'),'MON'),'JAN',
    DECODE('(TO_DATE(''1/30/2008'',''MM/DD/YYYY'') >= TO_DATE(''1/30/2008'',''MM/DD/YYYY''))','TRUE',
    TO_CHAR(TO_DATE('1/30/2008','MM/DD/YYYY'),'YYYY')
    ,TO_NUMBER(TO_CHAR(TO_DATE('1/30/2008','MM/DD/YYYY'),'YYYY')))
    ,TO_CHAR(TO_DATE('1/30/2008','MM/DD/YYYY'),'YYYY')
    ) FROM dual
    Cheers
    http://fiedizheng.blogspot.com/

  • Adobe Barcoded Forms and LiveCycle Licensing

    If you add a Paper Forms Barcode object to a fill-and-print PDF form using either Designer or Acrobat and the value of the barcode will change while opened within the free Adobe Reader then the PDF form you are distributing needs to be licensed with an Adobe® LiveCycle® Barcoded Forms ES license. I need to create a dynam ic barcode that users can change using Adobe Reader and print the form with barcode intact. It's for use in a pre-K school. Usage will be limited to 200 students per year.(Creating 200 forms that teacher's will fill out). I believe this is my solution, but pricing may be way too high. What are my options and have I been correct so far? There is no server, only a WORKGROUP environment. Thanks.
    Tom: Ok, so from the Adobe side, yes, LiveCycle Forms is the only tool that can achieve this. It used to be called Barcoded Forms ES, now it is just Forms ES2. Unfortunately it is a server only product so you would need a server.
    Tom: List price is around 85k, so I think it might be a bit more than you guys need unfortunately.
    Tom: We don't really have a basic barcoded forms piece for smaller initiatives, unfortunately.
    Visitor: Yikes!
    Visitor: What are my options?
    Tom: Do you absolutely need barcodes? Or could you do online fill in and submit?
    Visitor: If I purchase Acrobat Standard(I created the form is Professional) for 5-10 people, that should do the trick as long as the Adobe READER user doesn't change the barcode information, correct?
    Tom: Honestly, I'm not sure. Acrobat isn't something I am an expert on.
    Tom: You could try Adobe Formscentral as well as using Acrobat.
    Tom: Otherwise you'd have to try the Acrobat forums or user community as I don't have a lot of info about it.
    Visitor: The forms are printed by the teacher/evaluator and hand-written to be scanned when completed(End of month, etc). A barcode decoder(Kofax Express) will read the barcode and rename the file according to the barcode data.
    Tom: Hm, I think the Acrobat forums is your best bet, then.

    Thanks for the great suggestion!
    Can a Pre-K school receive an educational
    institution discount on Acrobat pricing?

  • SQL Expression in decode function or case statement?

    Can I put SQL expressions in decode function or case statement?
    For example,
    select le.profile, decode( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile, 0, 'N', 'Y')
    from element le;
    or
    select le.profile, case WHEN ( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile) = 0 THEN 'N'
    ELSE 'Y'
    from element le;
    None of the above work.
    Can anyone tell me how to make it work?
    Is there any workaround?
    Thanks,
    J

    You simply needed and END to your CASE statement;
    SQL> with profile_data as (
       select 'XXXX_AFTER' name, 1 object_id from dual),
         element as (
       select 1 profile from dual union all
       select 2 from dual)
    select le.profile,
       case WHEN ( select count(1) from profile_data where NAME= 'XXXX_AFTER' and object_id = le.profile) = 0
       THEN 'N'
       ELSE 'Y'
       END new_col
    from element le
       PROFILE N
             1 Y
             2 N

  • How can i use this expression in DECODE function?

    My PNO table formart is
    PNO PDate PCount
    P001 08/27/05 09:45 20
    P001 08/27/05 09:50 10
    P002 08/27/05 03:40 20
    P003 08/28/05 11:00 20
    P003 09/28/05 10:00 20
    P003 08/27/05 11:00 10
    P003 09/27/05 04:00 50
    I want to display total pcount for shift1(morning) and shift2(evening) & the date is 08/27/05
    PNO Shift1(08/27/2005 08:00 to 12:30) Shift2(08/27/2005 02:00 to 05:30)
    P001 30 0
    P002 0 20
    P004 10 50
    So for shift1 condition is:
    pdate>=08/27/2005 08:00 and pdate<=08/27/2005 12:30
    So for shift2 condition is:
    pdate>=08/27/2005 02:00 and pdate<=08/27/2005 05:30
    If i tried to give this expression in decode function , its not working.
    Please give me the sql query to solve this problem.
    Millions of thanks in advacne

    forgot to paste the output for a given date.
    SQL> create table pno
      2  (pno    varchar2(32)
      3  ,pdate  date
      4  ,pcount number)
      5  /
    Table created.
    SQL>
    SQL> insert into pno values('P001', to_Date('08/27/05 09:45', 'mm/dd/yy hh:mi') ,20)
      2  /
    1 row created.
    SQL> insert into pno values('P001', to_Date('08/27/05 09:50', 'mm/dd/yy hh:mi') ,10)
      2  /
    1 row created.
    SQL> insert into pno values('P002', to_Date('08/27/05 03:40', 'mm/dd/yy hh:mi') ,20)
      2  /
    1 row created.
    SQL>
    SQL> insert into pno values('P003', to_Date('08/28/05 11:00', 'mm/dd/yy hh:mi') ,20)
      2  /
    1 row created.
    SQL> insert into pno values('P003', to_Date('09/28/05 10:00', 'mm/dd/yy hh:mi') ,20)
      2  /
    1 row created.
    SQL> insert into pno values('P003', to_Date('08/27/05 11:00', 'mm/dd/yy hh:mi') ,10)
      2  /
    1 row created.
    SQL> insert into pno values('P003', to_Date('09/27/05 04:00', 'mm/dd/yy hh:mi') ,50)
      2  /
    1 row created.
    SQL> select pno,sum(pcount) "Morning Shift Count"
      2  from pno
      3  where to_char(pdate, 'mm/dd/yyyy hh:mi') >= '08/27/2005 08:00'
      4    and to_char(pdate, 'mm/dd/yyyy hh:mi') <='08/27/2005 12:30'
      5  group by pno
      6  /
    PNO                              Morning Shift Count                           
    P001                                              30                           
    P003                                              10                           
    SQL> select pno,sum(pcount) "Evening Shift Count"
      2  from pno
      3  where to_char(pdate, 'mm/dd/yyyy hh:mi') >= '08/27/2005 02:00'
      4    and to_char(pdate, 'mm/dd/yyyy hh:mi') <='08/27/2005 05:30'
      5  group by pno
      6  /
    PNO                              Evening Shift Count                           
    P002                                              20                           

  • Decode Attachment in OutLook Express .dbx with MimeUtility?

    Hi boys,
    I want to extract an attachment (encoded in base64 format) from outlook express .dbx file.
    I construct 2 classes :
    - the first extract from dbx file the attachment data and write it to disk.
    - the second read from disk and decode with MimeUtility class (JavaMail).
    The result is that the final file decoded is 600 byte less the original.
    sigh!.
    Can Anyone help me?
    Thanks Emanuele
    These are the classes :
    package dbxreader;
    import java.io.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2004</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Reading // THIS CLASS EXTRACT FROM DBX
    private BufferedReader reader;
    private FileOutputStream output;
    private boolean complete = false;
    public Reading()
    public void parse(String archive,String fileName) throws IOException
    reader= new BufferedReader(new FileReader(archive));
    boolean found=false;
    while(!found)
    String line=reader.readLine();
    if(line!=null)
    int i=line.indexOf("filename=\""+fileName+"\"");
    if(i!=-1)
    found=true;
    extractFile();
    output.close();
    reader.close();
    private void extractFile() throws IOException
    boolean finish=false;
    boolean firstAttempt=true;
    output= new FileOutputStream("solobyte.dat");
    while (!finish)
    char[] buffer=new char[2048];
    byte[] dest;
    int numberfBytes=reader.read(buffer);
    if(firstAttempt)
    dest=new byte[numberfBytes-2];
    byte[] src=new String(buffer).getBytes("iso-8859-1");
    System.arraycopy(src,2,dest,0,dest.length);
    //String stringa=new String(dest);
    firstAttempt=false;
    else
    byte[] src=new String(buffer).getBytes("iso-8859-1");
    dest=new byte[numberfBytes];
    System.arraycopy(src,0,dest,0,dest.length);
    // controllo se il file e finito
    // e scrivo l'array
    String appoggio=new String(dest);
    int index=appoggio.indexOf("------=_NextPart_");
    if(index!=-1)
    byte[] newdest=new byte[index-4];
    System.arraycopy(dest,0,newdest,0,newdest.length);
    System.out.print("Ci sono");
    String prova=new String(dest);
    finish=true;
    String prova2=new String(newdest);
    output.write(newdest);
    output.flush();
    else
    output.write(dest);
    output.flush();
    System.out.print("ciao");
    public static void main(String[] args)
    try
    Reading reading = new Reading();
    reading.parse("Posta in arrivo.dbx", "PathAssolutoW.exe");
    catch (IOException ex)
    ex.printStackTrace();
    THIS CLASS rRECONSTRUCT THE FILE
    package dbxreader;
    import java.io.*;
    import javax.mail.internet.MimeUtility;
    import javax.mail.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2004</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Decode {
    public Decode() {
    public static void main(String[] args)
    try {
    // FileInputStream file = new FileInputStream(new File("Prova.txt"));
    //FileInputStream file = new FileInputStream(new File("Temp64.txt"));
    FileInputStream file = new FileInputStream(new File("solobyte.dat"));
    InputStream stream = MimeUtility.decode(file, "base64");
    FileOutputStream output =new FileOutputStream("PathAssolutoW.exe");
    //FileOutputStream output =new FileOutputStream("PathAssolutow.exe");
    int iter=0;
    while(stream.available()>0)
    byte[] buffer=new byte[4096];
    int nbytes=stream.read(buffer);
    output.write(buffer,0,nbytes);
    output.flush();
    stream.close();
    output.close();
    // FileOutputStream output =new FileOutputStream("path.exe");
    output.close();
    catch (MessagingException ex)
    ex.printStackTrace();
    catch (FileNotFoundException ex)
    ex.printStackTrace();
    catch(IOException ex)
    ex.printStackTrace();
    }

    The situation is this :
    i have send to myself a mail with an attachment pathassolutow.exe.
    The original file info are(from right click and properties)
    - 85.854 byte dimension
    - 86.016 byte on disk
    When i launch my process (the two classes) the result is:
    - 85.237 byte dimension
    - 86.016 byte on disk
    there is a difference :
    85.854 before
    85.237 after
    If i try to launch the result file i get an error.
    I open the result file(85.237 bytes) with visual studio tool depends.
    I have get an error " NO PE SIGNATURE FOUND.This File is Not a valid win32 module.
    This application write on c a text file.
    Thanks for the reply Emanuele

  • Does the condition specified in the function 'DECODE' allow 'BETWEEN' expression?

    Does the condition specified in the function 'DECODE' allow 'BETWEEN' expression?

    As a completely different approach, in 8i SQL and 9i PL/SQL we can use the CASE function. This delivers decode functionality, but allows us to use conditions e.g.
    SELECT CASE WHEN col BETWEEN 1 and 9 THEN 'one' ELSE 'two' END FROM my_table;I love DECODE and wouldn't use anything else for straight value substitutions but CASE does have the advantage of clarity when it comes to maths, etc. Also I believe DECODE is not ANSI compliant. In which case (ho ho!) I suspect it will probably be deprecated, as Oracle seems to be moving towards ANSI SQL compliance, as part of its open standards drive.
    Cheers, APC

Maybe you are looking for

  • Help with error program not registered CPI-C error CM_ALLOCATE_FAILURE_RETR

    I have the following connection error in SM59 ... Connection error        program ZCCCOM_NZ_PMH01 not registered / CPI-C error CM_ALLOCATE_FAILURE_RETRY.  I have deleted and re-registered the program but still no connection. Any ideas as to what/wher

  • How to use two ALV grids in a single program (pl read below for details)?

    Please read thoroughly:: I have an ALV report using REUSE_ALV_GRID_DISPLAY. On the output of this report, when I click on a "change" button, a couple of columns should be made editable. I achieved this by modifying the fieldcatalog and triggering the

  • G5 DVI LCD HD TV HDMI

    I have a Dual 2.5 G5 with an Apple Cinema HD 23" LCD connected. I have just bought a Sony 32" HD LCD TV with a HDMI input and understand that all I need is a male DVI to male HDMI cable to then be able to use my Mac's DVD player to view movies on my

  • Copying standard program

    Hi Gurus, Am trying to copy the standard program PPPIH000 to make some changes . The problem am facing is it has 3 screens 800, 1000, 1200 The sub screen 800 is getting copied but the other screens are not getting copied... because of this the proces

  • Nokia 6280

    how do I allow jar files to acces/edit/read files on my nokia 6280? when I try to allow it, its doesn't let me, please give me a guide on how to allow the jaw files to acces/edit/read the files on my nookia 6280 thank you. sorry if its the wrong topi