Help with a CASE!!!

I did started a thread about the same problem this morning but no one couldn't help.
I tried to write it my self , well, still not working out. When i try to ran it, it just freezes........ORA-01652: unable to extend temp segment by 64 in tablespace TEMP
Can someone please see where is my problem with CASE..Im trying to put a case statment into WHERE.........
All I want is if the gl_tr_type = 'SO' then execute the rest in the case statment if the transaction is not 'SO' or 'WE' then cust_name would be blank.......If it's blank then i need N/A inserted there
This is what i need
WHEN gl_tr_type = 'SO' and a.gl_doc = inv_nbr
AND h.inv_cust_bill_to_nbr = g.cust_nbr
and
WHEN gl_tr_type = 'WE' and a.gl_doc = inv_code
AND h.inv_cust_bill_to_nbr = g.cust_nbr
Thank-you very much!!!!
SELECT
b.en_ent,
e.sa_sub,
c.cc_cstctr,
d.acct_acc,
b. EN_ENTITY_LNG,
e. SA_SUB_LNG,
c. COST_CTR_LNG,
d. ACCT_ACC_LNG ,
          g. cust_name,
f. FISCAL_MONTH,
f. FISCAL_YEAR_LNG,
d. ACCT_TYPE,
SUM(a.gl_amt)
FROM
F_ACCT_TRX_HIST_STG1 a,
D_ENTITY_STG2 b,
D_COSTCTR_STG2 c,
D_ACCTS_STG2 d,
D_SUBACCTS_STG2 e,
D_PERIOD_STG1 f,
FINMART.D_CUSTOMER g,
DSSMART.F_SALES_INVOICE h
WHERE a.gl_eff_dt BETWEEN '02-april-2007' AND '15-april-2007' AND
a.GL_ENT = b.EN_ENT AND
c.CC_CSTCTR = UPPER (a.GL_CC) AND
d.acct_acc = a.gl_acc AND
e.sa_sub = a.gl_sa AND
a.gl_eff_dt = f.calendar_date AND
a.gl_doc =
CASE WHEN a.gl_tr_type = 'SO'
AND h.inv_cust_bill_to_nbr = g.cust_nbr
THEN h.inv_nbr
END
GROUP BY b.EN_ENT, e.sa_sub, c.cc_cstctr, d.acct_acc,
b. EN_ENTITY_LNG,
e. SA_SUB_LNG,
c. COST_CTR_LNG,
d. ACCT_ACC_LNG ,
          g. cust_name,
f. FISCAL_MONTH,
f. FISCAL_YEAR_LNG,
d. ACCT_TYPE

Can someone please see where is my problem with
CASE..Im trying to put a case statment into
WHERE.........The select clause has a quite fixed structure, because it descripts the format of the result set, and the use of case statement add some more flexibility to this structure in order to make some changes to the result set that don't go in opposition with the output structure.
SQL> select case
  2     when (rownum < 2) then
  3             1
  4     else
  5             sysdate
  6     end
  7  from dual
  8  connect by level < 5
  9  /
                sysdate
ERROR at line 5:
ORA-00932: inconsistent datatypes: expected NUMBER got DATEThe where clause doesn't have such a fixed structure and has enought expressive power to implement any sort of condition.
In your "case".
WHERE
CASE WHEN (( a.gl_tr_type = 'SO') AND (h.inv_cust_bill_to_nbr = g.cust_nbr)) THEN h.inv_nbr
END
/can be expressed with
WHERE
not(( a.gl_tr_type = 'SO') AND (h.inv_cust_bill_to_nbr = g.cust_nbr)) or (h.inv_nbr)
/here is an example
SQL> select rn,word
  2  from (
  3     select rownum as rn,to_char(to_date(rownum,'j'),'JSP') word
  4     from dual
  5     connect by level <= 10
  6  )
  7  where (not(rn <= 5) or ( length(word)=3 )) /*case  (rn < 5) then ( lenght(word)=3)*/
  8  /
        RN WORD
         1 ONE
         2 TWO
         6 SIX
         7 SEVEN
         8 EIGHT
         9 NINE
        10 TENBye Alessandro

Similar Messages

  • Help with a CASE statement

    Please help me with a CASE Statement:
    - When ID = 15, 16, 17, 18 then "Bad"
    - when ID = 19, then "Average"
    - when ID = 21, then "Good"
    - else "Null"
    Thank you!!

    Well the 1st thing to do would be to correct my poor spelling... change    Delault : to Default :
    Don't know why you would get an error stating "The result of selection formula must be a boolean". It's working fine on my machine.
    If your ID field is numbers stored text you have a couple different options...
    1) Convert the ID to a number...
    Select  ToNumber({home.noone_ID})
    2) Wrap the ID values in double quotes...
       Case "15", "16", "17", "18" :
          "BAD"
    Even if this were your problem... the error should be something other than the boolean thing...
    Jason

  • Need help with upper case

    I'm stuck on my coding when I have to write a function to
    detect upper cases has been used in a sentence
    For example if my array element has this:
    2345
    SAINT PAUL
    STREET
    APT 5
    PHILADELPHIA
    I need to be able to write a code to let me know that the 2nd
    OR 3rd OR 5th element is written in upper case letter
    Or if I set the variable not as array, 2345 SAINT PAUL STREET
    APT 5 PHILADELPHIA
    I need to be able to detect that at least one of the section
    on that street name is written with upper case
    Can anyone help please?

    compare() cf function performs a case-sensitive comparison of
    2 strings
    and returns 0 is the strings are the same. so you can compare
    an
    uppercase version of the string to the original string, and
    if the
    comparison returns 0 then your string is in uppercase:
    <cfif compare(ucase(myarray[2]), myarray[2]) is 0>
    <!--- the string in myarray[2] IS in uppercase --->
    <cfelse>
    <!--- it is NOT in uppercase --->
    </cfif>
    the above code compares the value of the second array element
    converted
    to uppercase to the original value of the second array
    element. if the
    result is 0, i.e. the uppercase and original strings are the
    same, then
    you know the original string is in uppercase.
    if you are dealing with a single string (which is equivalent
    to a
    space-delimited list), then use appropriate list function to
    get
    required list element, i.e. listfirst(), listlast(),
    listgetat()...
    <cfif compare(ucase(listlast(mylist, " ")),
    listlast(mylist, " ")) is 0>
    <!--- the last element in the list IS in uppercase --->
    <cfelse>
    <!--- it is NOT in uppercase --->
    </cfif>
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Help with multiple case statements

    Hello,
    I am new to BO.  I am on XI 3.0.  SQL 2005.  In Designer, I am trying to create a measure in a financial universe that would end up being multiple case statements within one select.  This is what I tried to do, but it doesn't work with the two case statements.  Can I use an ELSE leading into the second CASE WHEN somehow?  How can I accomplish this?  Sorry for my ignorance!
    CASE WHEN dbo.ClientBudgetYear.DateStage1Approved > 01/01/1900 AND dbo.ClientBudgetMonth.Month = 12 THEN dbo.ClientBudgetMonth.Stage1Sales END
    CASE WHEN  dbo.ClientBudgetYear.DateStage1Approved > 01/01/1900 AND dbo.ClientBudgetMonth.Month = 11 THEN dbo.ClientBudgetMonth.Stage1Sales END
    Any Suggestions?
    Thanks,
    Holly

    Holly,
    I don't know enough about your data or requirement to provide a solution, however, the construct that you post will not work because it causes you to build an object with multiple case statements when only one case statement per object is permitted.  From what I see in your code I would be inclined to combine the two statements into one as such:
    CASE WHEN dbo.ClientBudgetYear.DateStage1Approved > 01/01/1900 AND dbo.ClientBudgetMonth.Month in (11,12) THEN dbo.ClientBudgetMonth.Stage1Sales else null END
    Thanks,
    John

  • Need some help with a case statement implementation

    I am having trouble using a CASE statement to compare values and then display the results. The other issue is that i want to put these results in a separate column somehow.
    Heres how the code would look:
    SELECT "Task"."Code",
    "Stat" = CASE WHEN "Task.Code" = 1 THEN string
    ....and so on
    I wanted to make "Stat" the new column for the results, and string represents the string to be assigned if 1 was the value for code. I keep getting syntax error, any help would be nice.

    This is a lot easier than you might think.
    1) First, move another column of "Code" to your workspace.
    2) Click on the fx button and then on the BINS tab.
    3) Click on "Add BIN" and with the operand on "is equal to/is in," input 1 and then click "OK."
    4) Name this what you had for "string."
    Repeat for all the different values you want to rename as another "string" value.
    5) Finally, check the "custom heading" checkbox, and rename this column "Stat" as you indicated.
    That's it.

  • Need help with switch/case

    Thanks in advance.
    I read the tut on switch statements. My assignment is asking me to do something that is not detailed in that explanation ;
    I have a total of 5 case statements, 1-4 and a default statement. The instructions for them are as follows:
    Case 1: If the user enters a 1, display a message that informs users they are correct, as any input canbe saved as a String. Enter the break statement.
    Case 2: If the user enters a 2, parse the value into tryInt. Display as message that informs the users they are correct. Enter the break statement.
    Case 3. If they user enters a 3, parse the value into tryDouble. Display a message tha t informs users they are correct. Enter the break statement.
    Case 4: Set done equal to true. Enter code to display a closing message. Enter a break statement.
    Case default: throw a new NumberFormatException.;
    Here is the code
    import java.io.*;
    import javax.swing.JOptionPane.*;
    public class MyType1
         public static void main(String[] args)
              //declaring variables
              String strChoice, strTryString, strTryInt, strTryDouble;
              int choice, tryInt;
              double tryDouble;
              boolean done = false;
              //loop while not done
              while (!done)
                   try
                        choice = Integer.parseInt(strChoice);
                        switch(choice)
                             case 1:
                                  JOptionPane.showMessageDialog(null,"You are correct!");
                                  break;
                             case 2:
                                  choice = Integer.parseInt(tryInt); JOptionPane.showMessageDialog(null,"You are correct!");
                                  break;
                             case 3:
                                  choice = Double.parseDouble(tryDouble);
                                  JOptionPane.showMessageDialog(null,"You are correct!");
                                  break;
                             case 4:
                                  done = true; JOptionPane.showMessageDialog(null,"Goodbye!");
                                  break;
    As usual Im doing something wrong. Please help.

    Thanks for your input. The directions for the assignment tells me to first declare the variables.
    Begin a while(!done) loop to repeat as long as teh user does not click the Cancel button.
    Inside a try statement, enter code to display an input box with three choices.
    Type choice = Integer.parseInt(strChoice); on the next line to parse the value for the choice entered by the user.
    (HERE THE SWITCH STATEMENT WITH CAST STATEMENTS)
    Close the switch statement with brackets
    Create a catch statement.
    import java.io.*;
    import javax.swing.JOptionPane.*;
    public class MyType1
         public static void main(String[] args)
              //declaring variables
              String strChoice, strTryString, strTryInt, strTryDouble;
              int choice, tryInt;
              double tryDouble;
              boolean done = false;
              //loop while not done
              while (!done)
                   try
                        String message = "What is My Type:" + "\n\n1) String\n2)Integer\n3)double\n4)Quit the program\n\n";
                        choice = Integer.parseInt(strChoice);
                        //test for valid choice 1, 2, 3, or 4
                        if (choice<1 || choice>4) throw new NumberFormatException();
                        else done = true;
                        switch(choice)
                             case 1:
                                  JOptionPane.showMessageDialog(null,"You are correct!");
                                  break;
                             case 2:
                                  choice = Integer.parseInt(tryInt); JOptionPane.showMessageDialog(null,"You are correct!");
                                  break;
                             case 3:
                                  choice = Double.parseDouble(tryDouble);
                                  JOptionPane.showMessageDialog(null,"You are correct!");
                                  break;
                             case 4:
                                  done = true; JOptionPane.showMessageDialog(null,"Goodbye!");
                                  break;
                   catch (NumberFormat Exception e)
                        JOptionPane.showMessageDialog(null, "Please enter a 1, 2, 3 or 4:",  "Error", JOptionPane.INFORMATION_MESSAGE);
              }Typing this now, I see I dont have anything in my try statement entering code to display an input box with three choices.
    (PS. I know I would write a catch statement for the NumberFormatException, but why would I also write this exception in the case statement also??)

  • I need to find someone to help with a case # from a previous chat

    On 11/17 I chatted online with a gentleman for quite a while discussing a printhead issue. He gave me a case # and sent me new ink to try. That did not work and I have been trying to contact someone to resume the conversation. I was to;ld the printer would then have to be replaced. It is still under warranty. Now I cannot find any help online.

    I will ask to have an HP support agent contact you via private message.  Do not post any private information (including contact information, case ID's or serial numbers) in the forum here, but you can supply this to the agent in private message if requested.
    To access messages look for a number next to the envelope in the upper right of the page.  Click on the envelope to read messages.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Help with Decode/CASE function

    Can anyone provide some help or insight how can this be done.
    Senario:
    I have two parameters in my report.
    Paramerer_A and Parameter_B
    If I enter a value (XYZ) in Parameter_A and value (XYZ) in Parameter_B, I want the report to display ERROR and do not run.

    Hi
    It is not possible to have a use defined message come up based on the values of parameters but we can stop the workbook from executing.
    First of all, you will will need to make sure that both parameters are optional and then create your condition such that it will not run if both are populated, like this:
    (Item1 = :Parameter_A OR Item2 = :Parameter_B)
    AND NOT
    :Parameter_A IS NOT NULL AND :Parameter_B IS NOT NULL
    You can also put in a check parameter that controls whether A or B should be used, with a prompt like this: Use Parameter A or Parameter B? Enter A or B
    :Check_Parameter = 'A' AND Item1 = :Parameter_A
    OR
    :Check_Parameter = 'B' AND Item2 = :Parameter_B
    Best wishes
    Michael

  • Help with Switch-Case Statement

    How do you get this in a switch-case statement or work with it?
              if (age < 70) {
                        JOptionPane.showMessageDialog(null, "People that are below the 70s are nothing special.");
              else if (age > 69 && age < 80) {
                        JOptionPane.showMessageDialog(null,  "People that are in their 70s are called septuagenarian.");
              else if (age > 79 && age < 90) {
                        JOptionPane.showMessageDialog(null,  "People that are in their 80s are called octogenarian.");
              else if (age > 89 && age < 100) {
                        JOptionPane.showMessageDialog(null,  "People that are in their 90s are called nonagenarian.");
              else (age > 99 && age < 110) {
                        JOptionPane.showMessageDialog(null,  "People that are in their 100s are called centenarian.");
                   }Thanks~

    As per Java Specification, swtich case expects an integer and boolean cannot be used as param for switch.
    In your case switch can be used like this.
    int index = age /10;
    switch(index) {
    case 1:
    case 2:
    case 3:
    case 4:
    case 5:
    case 6:
    Your First case
    break;
    case 7:
    your second case
    break;
    case 8:
    third case
    break;
    case 9:
    fourth case
    break;
    default:
    fifth case
    break;
    Take note of the break statements. Its very important. But I wont prefer in this case. Code looks awkward and is not so meaningful.....

  • Help With A Case Statement With Multiple Variables

    I apologize if this is the incorrect Forum for this type of question, but it was the closest one that I could find. I'm pretty new with SQL and am stuck on this issue. I have roughly 26 dates that I need to compare to one another. Each date is tied to a step code. I also have a Stop value that is tied directly to the "max date" of the step codes. So, I need to compare 30 dates against one another to 1st - ID the max date; 2nd - ID if the Stop value is correct; 3rd - if the stop value is incorrect, identify what the correct value would be.
    At first, this seemed like it wouldn't be that hard. I wrote a query that found the max date for each step code. Then I realized that multiple step codes could have the same date. So, I tried using this case statement, but I did not get the expected results. Is there a more efficient way of getting what I need? This code seems like it's not necessary and probably the source of my issue.
    CASE
    WHEN FS25.ACTUAL_COMPLETION_DATE > FS.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS1.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS2.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS3.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS4.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS5.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS6.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS7.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS8.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS9.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS10.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS11.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS12.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS13.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS14.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS15.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS16.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS17.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS18.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS19.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS20.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS21.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS22.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS23.ACTUAL_COMPLETION_DATE AND FS25.ACTUAL_COMPLETION_DATE > FS24.ACTUAL_COMPLETION_DATE AND L.FORECLOSURE_STOP_CODE <= '8' THEN '9'
    ELSE 'UH OH'
    END AS "CHANGE FC STOP TO"
    Any assistance is appreciated!

    I think Igor pointed out a working solution before.
    Applying it at your examples (you missed the operator after STOP_CODE, I assume it =):
    CASE
    WHEN FS25 = GREATEST(FS25, FS24, FS23) AND STOP_CODE = '9' THEN '9'
    ELSE 'UH OH'
    END AS 'CHANGE STOP CODE TO'
    {code}
    Be careful at the second example. You are checking:
    {code:sql}
    FS25 > FS24 OR FS25 IS NOT NULL AND FS24 IS NULL AND FS25 > FS23
    OR
    FS25 IS NOT NULL AND FS23 IS NULL AND STOP_CODE = '9'
    {code}
    Remember that AND has higher priority among operators than OR so if FS25 is greater than FS24 and FS23 the condition will be true even if STOP_CODE is not equal 9.
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Need Help With A Case Statement.

    Apex 3.2
    I currently have a report with the sql
    select oid oid,
    APEX_ITEM.MD5_CHECKSUM(oid, jobid, gdc, status)||
    apex_item.hidden(2,oid)||
    apex_item.display_and_save(3,jobid) jobid,
    apex_item.display_and_save(4,gdc) gdc,
    apex_item.display_and_save(5,bday) bday,
    num_rows num_rows,
    status current_status,
    APEX_ITEM.SELECT_LIST_FROM_LOV(6,status,'WORKLOAD_STATUS_FULL_LIST',null,'YES',null,'-Select-') new_status,
    case
        when status in ('TO_TABLE','ERROR_TABLE') then 'PREPARED'
        when status in ('TO_FILE','ERROR_FILE') then 'IN_TABLE'
        when status like '%SEND%' and status <> 'SEND_RENAME_OK' then 'IN_FILE'
        when trim(translate(status,'-1234567890',' ')) is null then to_char(jobid)
        else status
      end status_if_reset
    from scp_workload
    where jobid = :P28_JOBIDWhat I want to do is, if the result of status_if_reset column
    is not in ('PREPARED','EMPTY_FILE','IN_FILE','SEND_RENAME_OK','DEPRICIATED')
    then the new_status status column should be the APEX_ITEM.SELECT_LIST_FROM_LOV.
    If not it should just be status (normal report column)
    Hope I have explained properly
    Gus

    Your function had errors but maybe that was copy paste. The way you wrote your code is way to complicated. This should work for you:
    CREATE OR REPLACE FUNCTION fn_28_get_status (p_status IN VARCHAR2)
       RETURN NUMBER
    AS
       v_status   NUMBER;
    BEGIN
       IF    p_status IN
                ('TO_TABLE', 'ERROR_TABLE', 'TO_FILE', 'ERROR_FILE',
                 'SEND_RENAME_OK')
          OR p_status LIKE '%SEND%'
       THEN
          v_status := 1;
       ELSE
          v_status := 0;
       END IF;
       RETURN v_status;
    END fn_28_get_status;
    SELECT OID OID,
              apex_item.md5_checksum (OID, jobid, gdc, status)
           || apex_item.hidden (2, OID)
           || apex_item.display_and_save (3, jobid) jobid,
           apex_item.display_and_save (4, gdc) gdc,
           apex_item.display_and_save (5, bday) bday, num_rows num_rows,
           status current_status,
           CASE
              WHEN fn_28_get_status (status) = 1
                 THEN apex_item.select_list_from_lov
                                         (9,
                                          status,
                                          'WORKLOAD_STATUS_FULL_LIST',
                                          NULL,
                                          'YES',
                                          NULL,
                                          '-Select-'
              ELSE status
           END new_status
      FROM scp_workload
    WHERE jobid = :p28_jobidYou should not expect the others will debug you code. They don't have your objects to test.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    https://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Need help with this CASE statement

    Hi everyone,
    I would like to create a CASE that references another view and uses fields in that view to create a new field in a new view.
    The fields I am working with are called LEVEL_CD and AVAILABLE_AMT.
    In this case I would like to create a field called AVAILABLE_AMT (in my new view) that inserts the AVAILABLE_AMT from the old view into the new field only if the LEVEL_CD = 1. If the LEVEL_CD is anything else but 1 I would like to insert a 0 into my new
    AVAILABLE AMOUNT field.
    This is what I have so far and it doesn't seem to work:
    CASE WHEN old_view.LEVEL_CD = 1 THEN old_view.AVAILABLE_AMT
    WHEN old_view.LEVEL_CD <> 1 THEN 0 END AS AVAILABLE_AMT
    This just gives me zeroes in every record. Can anybody spot what I am doing wrong?
    Thanks!

    SELECT <columns>,CASE WHEN old_view.LEVEL_CD
    =
    1
    THEN old_view.AVAILABLE_AMT
    ELSE 0 END AS AVAILABLE_AMTFROM old_view.PK JOIN new_view.PK WHERE....PS.PK -Primary Key
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Help with test case

    Hi,
    I'm trying to produce a test case for a subtle problem, but can't get a
    simple one to work :-(
    I think I'm doing something wrong:
    Source:
    package kodo;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Properties;
    import javax.jdo.JDOHelper;
    import javax.jdo.PersistenceManager;
    import javax.jdo.PersistenceManagerFactory;
    import junit.framework.TestCase;
    public class KodoTest1 extends TestCase
    * @param id
    public KodoTest1(String id)
    super(id);
    public void test1() throws Exception
    PersistenceManagerFactory pmf = getFactory();
    PersistenceManager pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    A a = new A();
    a._b = new ArrayList();
    pm.makePersistent(a);
    Object aId = JDOHelper.getObjectId(a);
    B b = new B();
    b._parent = a;
    a._b.add(b);
    pm.currentTransaction().commit(); // looks good after this -- _b is
    a ProxyLinkedList
    pm.close();
    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    A aClone = (A) pm.getObjectById(aId, false);
    assertNotNull(aClone);
    Collection c = aClone._b;
    assertNotNull(c); // fails
    assertEquals(1,aClone._b.size());
    pm.currentTransaction().commit();
    private static PersistenceManagerFactory getFactory() throws Exception
    InputStream propStream =
    KodoTest1.class.getResourceAsStream("/kodo-local.properties");
    Properties props = new Properties();
    props.load(propStream);
    return JDOHelper.getPersistenceManagerFactory(props);
    package.jdo:
    <?xml version="1.0"?>
    <jdo>
    <package name="kodo">
    <class name="B"/>
    <class name="A">
    <field name="_b">
    <collection element-type="B"/>
    <extension vendor-name="kodo" key="inverse" value="_parent"/>
    </field>
    </class>
    </package>
    </jdo>
    kodo-local.properties:
    javax.jdo.option.RetainValues: true
    javax.jdo.option.RestoreValues: true
    javax.jdo.option.Optimistic: true
    javax.jdo.option.NontransactionalWrite: false
    javax.jdo.option.NontransactionalRead: true
    javax.jdo.option.Multithreaded: true
    javax.jdo.option.MsWait: 5000
    javax.jdo.option.MinPool: 1
    javax.jdo.option.MaxPool: 80
    javax.jdo.option.IgnoreCache: false
    javax.jdo.option.ConnectionUserName: tomd
    javax.jdo.option.ConnectionURL: jdbc:oracle:thin:@holygrail:1521:db1
    javax.jdo.option.ConnectionPassword: password
    javax.jdo.option.ConnectionDriverName: oracle.jdbc.OracleDriver
    javax.jdo.PersistenceManagerFactoryClass:
    com.solarmetric.kodo.impl.jdbc.JDBCPersistenceManagerFactory
    com.solarmetric.kodo.impl.jdbc.WarnOnPersistentTypeFailure: true
    com.solarmetric.kodo.impl.jdbc.SequenceFactoryClass:
    com.solarmetric.kodo.impl.jdbc.schema.DBSequenceFactory
    com.solarmetric.kodo.impl.jdbc.FlatInheritanceMapping: true
    com.solarmetric.kodo.impl.jdbc.AutoReturnTimeout: 10
    #com.solarmetric.kodo.Logger:
    #stdout
    # (Kodo 2.4 license key)
    com.solarmetric.kodo.LicenseKey: xxxxxxxxxxxxxxxxxxxxxxx
    com.solarmetric.kodo.EnableQueryExtensions: false
    com.solarmetric.kodo.DefaultFetchThreshold: -1
    com.solarmetric.kodo.impl.jdbc.DictionaryProperties:NameTruncationVersion=1
    com.solarmetric.kodo.impl.jdbc.UseBatchedStatements=false
    com.solarmetric.kodo.impl.jdbc.StatementCacheMaxSize=1

    You should not be directly accessing fields of PersistenceCapable
    instances or should enhance as Persistence aware:
    e.g. jdoc kodo.KodoTest1.
    However, I strongly recommend against this. It is bad object oriented
    design to be exposing internal variables so (wrap at the least in a
    get method). And in JDO, can easily cause strange behavior if not
    handled correctly as you see in your test case.
    Btw, I would recommend against packaging in kodo as we may be moving
    towards simplifying our package structures into kodo prefixed packages.
    On Wed, 18 Jun 2003 20:11:45 +1000, Tom Davies wrote:
    Hi,
    I'm trying to produce a test case for a subtle problem, but can't get a
    simple one to work :-(
    I think I'm doing something wrong:
    Source:
    package kodo;
    import java.io.InputStream;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Properties;
    import javax.jdo.JDOHelper;
    import javax.jdo.PersistenceManager;
    import javax.jdo.PersistenceManagerFactory;
    import junit.framework.TestCase;
    public class KodoTest1 extends TestCase {
    * @param id
    public KodoTest1(String id)
    super(id);
    public void test1() throws Exception
    PersistenceManagerFactory pmf = getFactory(); PersistenceManager pm =
    pmf.getPersistenceManager(); pm.currentTransaction().begin();
    A a = new A();
    a._b = new ArrayList();
    pm.makePersistent(a);
    Object aId = JDOHelper.getObjectId(a); B b = new B();
    b._parent = a;
    a._b.add(b);
    pm.currentTransaction().commit(); // looks good after this -- _b is
    a ProxyLinkedList
    pm.close();
    pm = pmf.getPersistenceManager();
    pm.currentTransaction().begin();
    A aClone = (A) pm.getObjectById(aId, false); assertNotNull(aClone);
    Collection c = aClone._b;
    assertNotNull(c); // fails
    assertEquals(1,aClone._b.size());
    pm.currentTransaction().commit();
    private static PersistenceManagerFactory getFactory() throws Exception
    InputStream propStream =
    KodoTest1.class.getResourceAsStream("/kodo-local.properties");
    Properties props = new Properties();
    props.load(propStream);
    return JDOHelper.getPersistenceManagerFactory(props);
    package.jdo:
    <?xml version="1.0"?>
    <jdo>
    <package name="kodo">
    <class name="B"/>
    <class name="A">
    <field name="_b">
    <collection element-type="B"/>
    <extension vendor-name="kodo" key="inverse" value="_parent"/>
    </field>
    </class>
    </package>
    </jdo>
    Steve Kim
    [email protected]
    SolarMetric Inc.
    http://www.solarmetric.com

  • Help with complaint case

    3.5 Weeks ago i sent my Thinkpad Yoga (12.5'') to repair because of several problems.
    I never heard anything from the company, until 1.5 Weeks later i phoned them, they told me they were waiting for a replacement mainboard.
    Since then i phoned more than 2.5 hours around, waiting in lines, getting reconnected until i got one lady that told me the replacement parts will arrive in amsterdam this week.
    Since when is it my job to phone around for spare parts? Why didn't they have spare parts for a brand new laptop?
    Why is nobody awnsering my complain mail? I sent two of them, nobody awnsered after 2 weeks. ( I got the mail from a lenovo employee at their hotline )
    Why am i treated like a total jerk?
    I am dependent on my laptop,...
    Short version:
    Where can i file a complaint?
    I live in germany and already tried support_de at ibm.uk.com, nobody is awnsering there.
    Thank you for your help
    If i was able to help - feel free to give Kudos

    Bump.
    Please help me, since nobody from the official side is
    If i was able to help - feel free to give Kudos

  • Help with Decode/Case

    Hello All,
    Can I use decode/case function within a decode function?
    {code}
    SELECT TO_CHAR (
              EDMS_STRAGG_WC (
                 DISTINCT DECODE (
                             eqs.attrib_code,
                             'PRODUCT_AUTHORIZATION',    'Authorization: '
                                                      || CASE eqs.qual_value
                                                            WHEN 'LIST'
                                                            THEN
                                                               (SELECT lookup_desc
                                                                  FROM edmsadm.edms_lookup
                                                                 WHERE     lookup_type =
                                                                              'PARTNER_AUTHORIZATION'
                                                                       AND lookup_code =
                                                                              eqls.list_value)
                                                            ELSE
                                                               (SELECT lookup_desc
                                                                  FROM edmsadm.edms_lookup
                                                                 WHERE     lookup_type =
                                                                              'PARTNER_AUTHORIZATION'
                                                                       AND lookup_code =
                                                                              eqs.qual_value)
                                                         END,
                             'PRODUCT_CERTIFICATION',    'Certification: '
                                                      || CASE eqs.qual_value
                                                            WHEN 'LIST'
                                                            THEN
                                                               eqls.list_value
                                                            ELSE
                                                               eqs.qual_value
                                                         END,
                             'PRODUCT_SPECIALIZATION',    'Specialization: '
                                                       || (SELECT lookup_desc
                                                             FROM edmsadm.edms_lookup
                                                            WHERE     lookup_type =
                                                                         'PARTNER_SPECIALIZATION'
                                                                  AND lookup_code =
                                                                         CASE eqs.qual_value
                                                                            WHEN 'LIST'
                                                                            THEN
                                                                               eqls.list_value
                                                                            ELSE
                                                                               eqs.qual_value
                                                                         END))))
              program_value
      FROM edms_qual_stg eqs, edms_qual_list_stg eqls
    WHERE     1 = 1
           AND eqs.qual_id = eqls.qual_id(+)
           AND eqs.req_id = 192647
           AND eqs.disc_line_id = 598631
           AND eqs.attrib_code IN
                  ('PRODUCT_CERTIFICATION',
                   'PRODUCT_AUTHORIZATION',
                   'PRODUCT_SPECIALIZATION');
    {code}
    Edms_qual_stg:
    AND_OR_CONDITION
    ATTRIBUTE_SOURCE
    ATTRIB_CODE
    CREATED_BY
    CREATED_DT
    DISC_LINE_ID
    END_DT
    EXCLUDE_INCLUDE
    GROUP_AND_OR_CONDITION
    GROUP_CODE
    MAX_VALUE
    MIN_VALUE
    MODIFIED_BY
    MODIFIED_DT
    QUAL_APPL_PRECEDENCE
    QUAL_ID
    QUAL_OPERATOR
    QUAL_TYPE
    QUAL_VALUE
    REQ_ID
    START_DT
    Edms_qual_list_stg:
    ATTRIBUTE_SOURCE
    ATTRIB_CODE
    CREATED_BY
    CREATED_DT
    END_DT
    INCLUDE_AFFILIATES
    INCLUDE_EXCLUDE
    LIST_VALUE
    MODIFIED_BY
    MODIFIED_DT
    PRIMARY_PARTY
    QUAL_ID
    QUAL_LIST_ID
    REFERENCE_ID
    START_DT
    Edms_lookup:
    CREATED_BY
    CREATED_DT
    DISPLAY_SEQ
    EDMS_LOOKUP_ID
    END_DATE
    LOOKUP_CODE
    LOOKUP_DESC
    LOOKUP_REFERENCE
    LOOKUP_TYPE
    MODIFIED_BY
    MODIFIED_DT
    START_DATE
    SELECT eqs.qual_id, eqs.disc_line_id, eqs.req_id, eqs.attrib_code, eqs.qual_value, eqls.list_value
      FROM edms_qual_stg eqs, edms_qual_list_stg eqls
    WHERE     1 = 1
           AND eqs.qual_id = eqls.qual_id(+)
           AND disc_line_id = 598631
           AND req_id = 192647
           AND eqs.attrib_code IN
                  ('PRODUCT_CERTIFICATION',
                   'PRODUCT_AUTHORIZATION',
                   'PRODUCT_SPECIALIZATION');
    7509575    598631    192647    PRODUCT_CERTIFICATION    LIST    GOLD
    7509575    598631    192647    PRODUCT_CERTIFICATION    LIST    SILVER
    7509576    598631    192647    PRODUCT_AUTHORIZATION    LIST    ATP - JOULEX PROVIDER ESCO
    7509576    598631    192647    PRODUCT_AUTHORIZATION    LIST    ATP - JOULEX PROVIDER IDENTIFY
    7509577    598631    192647    PRODUCT_SPECIALIZATION    LIST    ADVANCED SECURITY
    7509577    598631    192647    PRODUCT_SPECIALIZATION    LIST    EXPRESS FOUNDATION
    Required Output:
    Certification: GOLD, SILVER, Authorization: ATP - JOULEX PROVIDER ESCO, ATP - JOULEX PROVIDER IDENTIFY,  SPECIALIZATION: ADVANCED SECURITY, EXPRESS FOUNDATION.
    Thx
    Shank.

    Hi,
    Sure; a DECODE or CASE expression that returns a NUMBER can be used any place a NUMBER is expected, including within another DECODE or CASE expression.  A DECODE or CASE expression that returns a DATE can be used any place a DATE is expected, including within another DECODE or CASE expression.  A DECODE or CASE expression that returns a VARCHAR2 can be used almost any place a VARCHAR2 is expected.  (There a  couple of special situations where a string literal is absolutely required.)
    There are not many situations where you really need to do that, though.  It's usually simpler and more efficient to use a single CASE expression; nesting is rarely needed.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Simplify the problem as much as possible, so that it contains only enough to show the part you don't already know how to do.
    If you really need a user-defined function to show the problem, then include a CREATE FUNCTION statement, and explain what the function does.  Again, simplify: if the function isn't what you don't understand, post a problem that doesn't use the function.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

Maybe you are looking for

  • Very slow display of whatu0092s typed in

    Hi, Sometimes the user experiences a very slow rendering of what he's just typed in: he types in for example the note for an Interaction Record and instead of the text instantaneously showing up sometimes only the first letters appear and then it tak

  • Why can not find "NationalInstruments.Teststand.Interop.API" when add it from C# referenes

    Hello experts, I would like to learn to how to use C# IN teststand,and find an instructio about how build dll in C#. It said add  "NationalInstruments.Teststand.Interop.API" reference in C# references. However,it can not be found as attached. Who can

  • Converting field NAME1 to fields NAME_LAST and NAME_FIRST

    Hi to all of you, I have a question concerning to the next issue: When we run transaction JUCDCM (Convert customer and vendor masters to SAP Business Partner), the information contained in field NAME1 from customer/vendor master is migrated to field

  • Hide the row structure in Bex query

    Hi Experts, i have a query regarding display of report in Bex Analyzer.  I have two structures in report one in Row & other in Column. In row  have only one field against which there are two columns having figures my query is as follows: Is this poss

  • Dynamic refreshes

    In my application, there are cases where I need to update a form when the user changes some input value on the form. For instance, say the user selects a car as a vehicle type, I might want to update the form to add some input fields that are specifi