Use of DECODE function in Discoverer 3.1

Hi all,
Is there any better way of using DECODE in Discoverer 3.1, i dont want to use that function in my Discoverer User edition or Admin ed.
Many of my queries use the DECODE function.
Your help is greatly appreciated.

If you created an instance of your time class that you called myTime
var myTime:Time = new Time(15,15,0);
and later you wanted another instance with the same time you could write
var myTime2:Time = myTime.clone()
It is just there for convienience and doesn't have anything much to do with MVC

Similar Messages

  • How to use a decode function

    I want to use the following with decode, recently started on BODS.
    Can you please provide the steps to use decode function
    in source tabke fieldname is ordid and in target fieldname is Orderid
    decode(Order_ID = 1709,lpad(Order_ID,7,'700'),Order_ID)
    thank you very much for the helpful i

    1) In the mapping tab of target column, click on Functions, select Miscellaneous Functions category, you can find decode function in it. Lpad can be found in String functions category.
    OR
    2) You can directly script this or paste this code at the mapping tab. In this case, remove the Order_ID from the script wherever used, drag and drop this column from the input schema of Query transform to avoid the syntax error. 
    Regards,
    Suneer

  • Using mysql decode function in Java

    Hi everybody,
    mysql documentation says:
    DECODE(crypt_str,pass_str) -->
    Decrypts the encrypted string crypt_str using pass_str as the password. crypt_str should be a string returned from ENCODE().
    I used the above function in a Python script and had no problem, but have difficulty using the same thing in my Java code.
    I receive runtime error when tried decode() in my Java code in executeQuery("s");. As far as I know the decode() function should be compiled, I can't run the decode() in the mysql command tool and receive a response (as I compiled and ran it in my Python script).
    Has anybody ever used this function in the Java code? How? What format did you use? What I should use instead of "s" in this code?
    conn is a database connection:
    stmt = conn.createStatement();
    rs = stmt.executeQuery("s");
    I even tried PreparedStatement, but no luck.
    Any help is greatly appreciated.

    stmt.executeQuery("select blahblahblah, DECODE(fieldName, password), blahblahblah FROM blahblah...")

  • How to use Pl/Sql function in Discoverer report

    Hi Everybody,
    Would you be able to provide a workflow/guidance how to use sql function in Discoverer right from creating the function using PLSQL Developer.
    (I am new to Oracle environment... prev. worked as analyst with Microsoft Access... took PL/Sql class in school a few years ago)
    We are using Discoverer Desktop.
    a) Just emailed dba for permission to create pl/sql function.
    b) Recently got Discoverer Administrator installed on my pc.
    can you pls add to the list:
    c)....
    d)....
    etc.?
    tx for your help, sandra

    Hi Kranthi,
    Thx for your warm words....
    The links you provided are great! Thx soooo much!
    Thanks to you and the rest of forum members, am able to use what you've all taught me
    with other Discoverer reports.... so i was able to do more on my own....
    About a month ago, I got access to Discoverer Admin, and was able to paste SQL to create a custom folder.
    Then i joined the custom folder to an existing baseline folder.
    I have found that sometimes when I use calc within a calc when the calcs use analytic functions, that Discoverer
    just displays null in the column. I thought that maybe instead I could create my own function as a work-around.
    I wrote IT for permissions to create views, functions etc. Hopefully, they'll approve and can move toward learning
    pl/sql functions for Discoverer.
    tx again, sandra

  • Using oracle decode function in ssQueryText

    Hi,
    I am populating the values for ssQueryText, ssSortField etc from the fragment parameters. Then i am using these field values in fragment jsp, put those values in the serverbean and executing the service. I am getting the results, and the results are also sorted the way i want.
    The problem is i want to fetch the data from the DB, while fetching i want to check a column value, based on the value i want to temporarily modify that column value and only after modifying i want to sort the data in the table based on the value of modified column.
    If some one has tried this earlier please suggest.
    Thanks,
    Santosh

    stmt.executeQuery("select blahblahblah, DECODE(fieldName, password), blahblahblah FROM blahblah...")

  • Using DECODE Function to change data

    I am trying to use the Decode function in a SQL statement to find a field that has a specific type, and when it finds that type, I want to blank out the results in a different field.
    For example:
    DECODE(ADDR_TYPE,'HOME',PHONE='') HOME_PHONE

    something like:
    SQL> with t as
      2   (select 219 id,
      3           'BUS' addr_type,
      4           '505-555-5555' phone
      5      from dual
      6    union
      7    select 219 id,
      8           'HOME' addr_type,
      9           null   phone
    10      from dual
    11    union
    12    select 220 id,
    13           'BUS' addr_type,
    14           '101-111-1111'   phone
    15      from dual
    16    union
    17    select 220 id,
    18           'HOME' addr_type,
    19           null   phone
    20      from dual
    21    union
    22    select 223 id,
    23           'BUS' addr_type,
    24           '202-222-2222'   phone
    25      from dual
    26    union
    27    select 224 id,
    28           'HOME' addr_type,
    29           '303-333-3333'   phone
    30      from dual
    31    union
    32    select 225 id,
    33           'BUS' addr_type,
    34           null   phone
    35      from dual
    36    union
    37    select 226 id,
    38           'HOME' addr_type,
    39           null   phone
    40      from dual)
    41  select a.id,
    42         a.addr_type,
    43         decode(a.addr_type,'BUS',phone,null) phone
    44    from (select id, addr_type, phone,
    45                 row_number() over (partition by id order by id, decode(addr_type,'BUS',1,2)) rn
    46            from t) a
    47   where a.rn = 1;
            ID ADDR PHONE
           219 BUS  505-555-5555
           220 BUS  101-111-1111
           223 BUS  202-222-2222
           224 HOME
           225 BUS
           226 HOME
    6 rows selected.
    SQL>

  • Order by clause using decode function

    Hi everybody,
    i need below order in my report.
    Connecticut
    greenwich
    stamford
    bridgeport
    New York
    NYC
    wrestcher
    byram
    Georgia
    atlanta
    athens
    oconny
    first i need above order in my view out put.
    so in order by clause i used first decode function for State ordering
    and in second decode function for city ordering.
    i do not need order by ascending or descending.
    so pls anybody can help me.
    any help is greatly appreciated.
    thanks.

    add asc after the decode. default is desc

  • How to use decode function

    Hello Friends,
    I have a query that has different columns and I am not sure what the data type of each column is ...
    I want to use decode function which displays the following if the value of the column is like this ..
    if the value of column is -714E ie -700000000000000 then display as .A
    if the value of column is -814E ie -800000000000000 then display as .B
    NOTE ; don't know which column is having the value - and i don't know the data type of the column is ..
    got to use the decode function for all the columns selected ..
    I want to use decode function pls let me know how to write for this kind of requirement.
    appreciate your help in this rgds.
    thanks/kumar

    Dear Sir / Madam,
    Thanks for your understanding.
    Right now I am facing a unique problem.
    I am using decode function in a select statement. The columns are dynamic some columns are of type number and some are varchar datatypes. I want to apply decode function for every column irrespective of datatype.
    What i am finding difficult is if the column is a number datatype , the decode funciton is working good but if the column datatype is varchar or char datatype then i am getting ..
    here's the decode function..
    decode (CHAI.EVNDRIVE,
    -800000000000000,'.A',
    -700000000000000, '.B',
    -600000000000000 ,'.C',
    -500000000000000 , '.D',
    -400000000000000 , '.E',
    -300000000000000 , '.F',
    -200000000000000, '.G',
    -100000000000000 , '.H',
    -1000000000, '.R' ,CHAI.EVNDRIVE ) EVNDRIVE
    report error:
    ORA-01722: invalid number
    pls let me know how to over come this kind of scenario.
    is their a way to find whether the column datatype is number or char , so that i can check the column datatype before the decode funciton is applied ..
    thanks ..
    kumar

  • DECODE function to validate date value and sort the records

    Hi Friends,
    I am looking for some query which can give me the required output,
    I need to do this using SQL query only and I have tried using the MIN() and MAX() functions it was working fine with limited data, now after inserting the last record(in the below table) which has date for start_range and end_range in(mm/dd/yyyy hh24:mi:ss) format.
    Because the data type is VARCHAR2 if I am using the MIN() function it is sorting as a string value, hence the min date is incorrect. I tried using validating the value to date or non date and tried to using MIN() and MAX() functions using the DECODE function, I am getting this error "ORA-01840: input value not long enough for date format".
    select table_name,
    DECODE(substr(START_RANGE,3,1)||substr(START_RANGE,6,1)||substr(START_RANGE,11,1)||substr(START_RANGE,14,1)||substr(START_RANGE,17,1),'// ::',
    to_char(min(to_date(start_range,'mm/dd/yyyy hh24:mi:ss')),'MM/DD/YYYY HH24:MI:SS'),min(start_range)) MIN_RUNS_START_RANGE,
    DECODE(substr(END_RANGE,3,1)||substr(A.END_RANGE,6,1)||substr(END_RANGE,11,1)||substr(END_RANGE,14,1)||substr(END_RANGE,17,1),'// ::',
    to_char(max(to_date(END_RANGE,'mm/dd/yyyy hh24:mi:ss')),'MM/DD/YYYY HH24:MI:SS'),max(END_RANGE)) MAX_RUNS_END_RANGE
    from MY_TABLE
    GROUP BY table_name,
    (substr(START_RANGE,3,1)||substr(START_RANGE,6,1)||substr(START_RANGE,11,1)||substr(START_RANGE,14,1)||substr(START_RANGE,17,1)),
    (substr(END_RANGE,3,1)||substr(END_RANGE,6,1)||substr(END_RANGE,11,1)||substr(END_RANGE,14,1)||substr(END_RANGE,17,1))
    Can sombody please advise what is the best way I can query this data with the required output.
    The following are the source table and records and the out put records using the sql query.
    MY_TABLE
    TABLE_NAME(VARCHAR2),START_RANGE(VARCHAR2),END_RANGE(VARCHAR2)
    TABLE1,1000,10000
    TABLE2,ABCD,EEEE
    TABLE3,01/12/2010 00:00:00,12/31/2010 23:59:59
    TABLE1,10001,20000
    TABLE2,EEEF,GGGG
    TABLE3,01/01/2011 00:00:00,01/31/2011 23:59:59
    OUTPUT :
    TABLE_NAME,MIN(START_RANGE),MAX(END_RANGE)
    TABLE1,1000,20000
    TABLE2,ABCD,GGGG
    TABLE3,01/12/2010 00:00:00,01/31/2011 23:59:59
    Thanks
    Kalycs

    i also think this is a very bad table design ...
    but if you are not able to change it, you could split the select (date and non-date data) and combine the result with UNION like this:
    with t as
    SELECT 'TABLE1' table_name,'1000' start_range,'10000' end_range FROM dual UNION
    SELECT 'TABLE2','ABCD','EEEE' FROM dual UNION
    SELECT 'TABLE3','01/12/2010 00:00:00','12/31/2010 23:59:59' FROM dual UNION
    SELECT 'TABLE1','10001','20000' FROM dual UNION
    SELECT 'TABLE2','EEEF','GGGG' FROM dual UNION
    SELECT 'TABLE3','01/01/2011 00:00:00','01/31/2011 23:59:59' FROM dual
    SELECT table_name,
           TO_CHAR(MIN(TO_DATE(start_range, 'MM/DD/YYYY HH24:MI:SS')), 'MM/DD/YYYY HH24:MI:SS'),
           TO_CHAR(MAX(TO_DATE(end_range, 'MM/DD/YYYY HH24:MI:SS')), 'MM/DD/YYYY HH24:MI:SS')
    FROM t
    WHERE start_range LIKE '%/%/%:%:%'
    GROUP BY table_name
    UNION
    SELECT table_name,
           MIN(start_range),
           MAX(end_range)
    FROM t
    WHERE start_range NOT LIKE '%/%/%:%:%'
    GROUP BY
        table_name;
    TABLE_ MIN_VALUE           MAX_VALUE
    TABLE1 1000                20000
    TABLE2 ABCD                GGGG
    TABLE3 01/12/2010 00:00:00 01/31/2011 23:59:59

  • DECODE Function In Reports 3.0

    Hi,
    When I use the decode function in a query (Reports 3.0.5.8.0) I receive an error message "Bind Variable Does Not Exist" (ORA-1006). When I remove the decode function from the query, the query compiles fine. All table and column references are existing.
    Also, the same query runs perfectly fine from SQL*Plus. The OS is Win 2000, SP2
    Any idea if this is a bug? Is there any way out? Do get back as this is very urgent.
    The database is Oracle 8i Ent, 8.1.7 on AIX 4.3
    The query is as follows:
    SELECT NAM_CMP , COD_CMP , COD_CMP_REG ,
    DECODE(FLG_CMP_SHP,'Y','S/',' /') || DECODE(FLG_CMP_AGT,'Y','A/',' /') || DECODE(FLG_CMP_CNE,'Y','C',' ') TYPE ,
    DES_ADD_STT , DES_ADD_PLC , DES_ADD_STA , DES_ADD_POS , COD_CTY , COD_cou_iso ,
    DAT_LST_AST , DAT_LST_UPD,
    cod_dcl_box_num, decode(cod_imp_chg_way,'C','CASH','CREDIT') cod_imp_chg_way,
    decode(cod_imp_cre_way,'W','WEEKLY','F','FIFTEEN DAYS','M','MONTHLY', NULL) cod_imp_cre_way,
    decode(flg_imp_prn_inv, 'N', null, flg_imp_prn_inv) flg_imp_prn_inv,
    cod_bro_box_num, decode(cod_exp_chg_way,'C','CASH','CREDIT') cod_exp_chg_way,
    decode(cod_exp_cre_way,'W','WEEKLY','F','FIFTEEN DAYS','M','MONTHLY', NULL) cod_exp_cre_way,
    decode(flg_exp_prn_inv, 'N', null, flg_exp_prn_inv) flg_exp_prn_inv
    FROM CMP
    where dat_can is null

    Try TO_CHAR(NULL) instead of NULL in all DECODE functions.
    For example:
    decode(cod_imp_cre_way,'W','WEEKLY','F','FIFTEEN DAYS','M','MONTHLY', TO_CHAR(NULL))
    instead of:
    decode(cod_imp_cre_way,'W','WEEKLY','F','FIFTEEN DAYS','M','MONTHLY', NULL).

  • Decode function involving 2 fields (urgent)

    Hi .. I am trying to use the decode function involving 2 fields.
    The query runs but does not produce the correct results. If
    anyone knows, please reply .. Usually decode function involves
    one column only but I have more
    than one. The situation is : If ins_code = 2 or special_code =
    MMI, put a 'Y', otherwise, it's a 'N'. Does anyone know how to
    put this in a decode statement? Thanks

    Thanks, Suresh ... but I have to put this condition using the
    decode statement because that's how the rest of the program is
    written. It's part of the script that I have to change. The
    current statement is this: decode(ins_code, '2', 'Y', 'N'). I
    have to change it to ins_code =2 or special_feature = MMI.
    Please reply ... thanks a lot....

  • How to write decode function in plsql

    hi
    guys
    can u plz help me in this topic
    .........

    Hi ,
    You could use the decode function in an SQL statement as follows:
    SELECT supplier_name,
    decode(supplier_id,      10000,      'IBM',
         10001,      'Microsoft',
         10002,      'Hewlett Packard',
              'Gateway') result
    FROM suppliers;
    The above decode statement is equivalent to the following IF-THEN-ELSE statement:
    IF supplier_id = 10000 THEN
    result := 'IBM';
    ELSIF supplier_id = 10001 THEN
    result := 'Microsoft';
    ELSIF supplier_id = 10002 THEN
    result := 'Hewlett Packard';
    ELSE
    result := 'Gateway';
    END IF;
    The decode function will compare each supplier_id value, one by one.
    Regards,
    xaheer

  • Use of DECODE and NULL value in a WHERE clause

    hi all,
    I came into an issue trying to use the DECODE function in a simple where clause.
    this is my test case
    CREATE TABLE tab_test (lev NUMBER, code VARCHAR2(10), val VARCHAR2(10));
    INSERT INTO tab_test VALUES (1, NULL, 'val11');
    INSERT INTO tab_test VALUES (1, NULL, 'val12');
    INSERT INTO tab_test VALUES (1, '13', 'val13');
    INSERT INTO tab_test VALUES (2, '21', 'val21');
    INSERT INTO tab_test VALUES (1, '22', 'val22');
    INSERT INTO tab_test VALUES (1, '23', 'val23');
    and this is the query
    SELECT * FROM tab_test WHERE code = DECODE(:lev,1,NULL,:cod)
    as you can see running this query, setting :lev to 1 will return an empty record set, instead of the expected first two rows (as it will be, running "select * from tab_test where code is null").
    is there a way to overcome this issue? thanks for help

    hi Frank,
    I can confirm that the queries do work when run on TOAD, but do not when they are put in the WHERE clause of my data block. I guess the problem relies on some data block setting; I should investigate on Forms forum.
    Anyway, here is my test case, including data and some examples. You can realize that it works good
    CREATE TABLE TAB_TEST
    LEV NUMBER,
    CODE VARCHAR2(10 BYTE),
    VAL VARCHAR2(10 BYTE)
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (3, 'val21', 'val3_211');
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (2, 'val21', 'val3_212');
    Insert into tab_test
    (LEV, VAL)
    Values
    (1, 'val11');
    Insert into tab_test
    (LEV, VAL)
    Values
    (1, 'val12');
    Insert into tab_test
    (LEV, VAL)
    Values
    (1, 'val13');
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (2, 'val11', 'val21');
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (2, 'val12', 'val22');
    Insert into tab_test
    (LEV, CODE, VAL)
    Values
    (2, 'val13', 'val23');
    COMMIT;
    SELECT * FROM TAB_TEST
    CONNECT
    BY PRIOR val = code
    START WITH (CASE
    WHEN :LIV = 1 AND code IS NULL THEN 'OK'
    WHEN :LIV != 1 AND code = :COD THEN 'OK'
    END = 'OK')
                   AND VAL = :V
    :LIV = 1
    :COD = [any]
    :V = 'val11'
    LEV     CODE     VAL
    1          val11
    2     val11     val21
    3     val21     val3_211
    3     val21     val3_212
    :LIV = 1
    :COD = [any]
    :V = 'val12'
    LEV     CODE     VAL
    1          val12
    2     val12     val22
    :LIV = 2
    :COD = 'val11'
    :V = 'val21'
    LEV     CODE     VAL
    2     val11     val21
    3     val21     val3_211
    2     val21     val3_212

  • Error -3016 when trying to compare a column value via "decode" function

    The following statement:
      select * from turbine_user
      where login_name  = decode(1, 2,  'name1', 'name2')
    yields a "-3016 Invalid numeric constants" error.
    OTOH, the following variations work as expected:
      (a)
      select * from turbine_user
      where login_name  = 'name1'
      (b)
      select * from turbine_user
      where login_name  = 'name2'
      (c)
      select * from turbine_user
      where 'name1'  = decode(1, 2,  'name1', 'name2')
      (d)
      select decode(1, 2,  'name1', 'name2') from turbine_user
    Does MaxDB have problems with using the decode function to compare something to column values?
    My MaxDB-Version: 7.6.03.07
    Thanks in advance,
    Alex
    Edited by: Alexander Zimmer on Feb 6, 2008 3:53 PM

    Hi,
    unfortunately I assume that I should explain the doing of decode a little bit:
    As we see in the reference manual:
    DECODE(<check_expression>,<search_and_result_spec>,...[,<default_expression>])
    <check_expression> ::=
      <expression>
    <search_and_result_spec> ::=
      <search_expression>,<result_expression>
    <default_expression> ::=
      <expression>
    <search_expression> ::=
      <expression>
    <result_expression> ::=
      <expression>
    Ok, that will mean, that the first parameter of decode will be compared to parameter number 2, 4, 6, 8, 10,... up to number n-1.
    If the result of the comparison is true with parameter number x, the result of decode will be the value of parameter x+1.
    If no comparison results in 'equal', then NULL will be returned if there is an odd number of parameters respectively the value of the last parameter if there is an even number of parameters of the decode function.
    In your context, this means, that 1 is compared to 2 (always false), thus returning 'name2' always. Therefore I do not understand what you want to do with that decode.
    Ok, if we assume that the select sent is only a short form of what you really want to do, then I have to apologize, but there is a bug in the kernel coding. It will be fixed ASAP.
    To be able to work until then, put the function DIGITS around your 1 and around the 2 (or the corresponding real parameter values) and it should do.
    BTW: with column on the left hand side, the error occurs and with a string literal it does not? This is different to my check where both values on the left side cause this error to occur.
    Elke

  • Using a C function in Oracle

    Hi,
    I have a field in my table that stores an ID which is encoded using a C function. (third party database)
    I have also been provided the C function that decodes that field to display the actual value. I have compiled this code using Visual Studio .Net 2003 to a dll file, but do not know how to use it in Oracle. Or are there other ways to use this decode function in Oracle?
    I am on 9i database, Windows 2003 server.
    Any help is appreciated.
    Thank you.

    Hi, see:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:9087161189226

Maybe you are looking for

  • How do I set external monitor to work with my G4 iMac?

    I just bought a 22" Proview LCD monitor to use with my iMac b/c it's monitor is pretty much gone. It did not work for six months, then came on for 1 day and went out again. Long story short, since I've hooked up the new monitor when I print in iPhoto

  • Errors in the OLAP storage engine: A duplicate attribute key has been found when processing

    Hi dear MSDN Community, I am facing a problem while processing a cube with a customer hierarchy as follows: Global Account --> Main Customer --> Master Customer --> Customer The data comes from a flatted parent child table, that is, I create an extra

  • Error when I try to send document to Business Objects Inbox in Infoview

    I am testing XI 3.1 and when I select a Webi document then click on the option to send a document to a Business Objects Inbox, I get the following error: An Error has occurred: Unspecified error. Any ideas?

  • Images - RoboSourceControl Issues

    Our team of 8 people is currently working on a RH7 project that has over 200+ images. We are running into some major issues with how these are stored in the project. I will list them below. 1. What is the best way to house 200+ images. I don't see a

  • Photos in iOS8

    The best photo feature on my iPhone is the album called Faces. Prior to iOS8, the Faces were alphabetical, so it was quite easy to find people whose photos I wanted to display. This is no longer the case. I have over 200 Faces in my Faces Album and i