"case when not m [1] is present then" outputs ORA-03113

I find that ' case when not m [1] is present then ' outputs ORA-03113:
Why?
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
select * from dual model
 dimension by(0 as d)
 measures(1 as m)
 rules(
 m[any] = case when not m[1] is present then 1 end);
ORA-03113:
Below a is the alterNative solution.
select * from dual model
 dimension by(0 as d)
 measures(1 as m)
 rules(
 m[any] = case when presentv(m[1],1,0) = 0 then 3 end);

D  M
-  -
0  3

[Bug 6530708| https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_id=6530708&p_database_id=BUG]

SY.

Tags: Database

Similar Questions

  • Case when the field IS NULL then... end

    Hello world

    (a) If a field is null, display a message.

    (b) the field shows beak null. application for admin to make outer joins between the tables.

    (c) I have 9 rows, 3 have NULL values,
    So, I want to show a literal message on 3 rows.

    problem is that the message shows on all the 9 lines.


    now:
    ====
    I could have adopted an approach very unorthodox at this request, please bear with me.
    I work for a college and am interested in students who did not encourage the "" in the last six months
    for this semester, beak. they repeat the year.

    200830 M1 generally promote to 200920 M2 (m1 attribute replaced by m2)

    M1 - 1 year 200830 = winter
    M2 - 2nd year 200920 = fall (200910 is special and not interested by this semester for this request)


    I want to run a query to search for the students who did not encourage.

    hand the sql would be:

    SELECT st1.id
    st1.name
    sa1.academic_period
    sa1.student_attribute
    sa2.academic_period
    sa2.student_attribute
    Student st1
    INNER JOIN student_attribute sa1
    ON st1.person_uid = sa1.person_uid
    AND sa1.academic_period = '200830'
    AND sa1.student_attribute = 'M1 '.
    LEFT JOIN student_attribute sa2
    ON st1.person_uid = sa2.person_uid
    AND sa2.academic_period = '200920'
    AND sa2.student_attribute = 'M2 '.
    where st1.academic_period = '200830'
    and sa2.student_attribute is null
    ORDER BY st1.name;


    ===========

    taking the hardcoded values and putting a LEFT JOIN simplified in a display/custom folder
    and then by creating the conditions in discoverer, essentially behaved as an EQUI-join and do not show the
    null lines

    =============

    I compare a "slice" of data "another" data 200920/m2 200830/m1

    so I begged the admin as an experiment to "clone" the desired table as 2 views and external to join them
    Discover the left join to student attribute #1 to
    attribute of student views #2


    and using the technique to deceive the discoverer of a LEFT JOIN in: student_attribute is null or student_attribute is null

    I got what I wanted - pupils with NULL values in attribut2, beak. they did not encourage

    ==============

    so now I wanted to create a new discoverer in copying the above query query and adding new 'logic ':

    In this new queyr am interested if the student extensible query determined #1
    have been coded by the staff in order to take into account that they repeat:
    M1 200830 as:
    M1 200920 (their bump up current semester with the same code attribute)

    so I thought... hmmmmm... I also have the ordinary table: attribute of the student
    now watch a 3rd data slice: 200920 m1


    Discover the left join to student attribute #1 to
    attribute of student views #2

    left to join University
    attribute of student views #1

    I access the beak ordinary table this pre-established join :

    University to join
    student table attribute

    ====================
    so my 2nd query uses:
    -Discover the condition attribute #1 student: 200830/m1
    -Discover the condition attribute #2 students: 200920/m2
    -University studies
    -condition of table student attribute: 200920 / * m1 *.


    and to maintain the table: attribute of student for M1 200920
    to see if records created the current semester for Extensible students staff


    This query has worked, got the 9 lines, of which 3 had to be coded to 200920/m1
    For lines 3 nulls, want to create a calc that would show this literal:

    "needs 200920 m1 folder.

    the problem is the literal is printing even on rows that have a value in the fields from the table, it's the calc:


    BOX WHEN (period DMC_Student_Att2.Academic IS NULL) THEN

    "NEEDS" | "'-> ' |: Parm_AcademicPeriod_Current |" " ' || : Parm_StudentAttribute_Prev

    END


    Any advice that might work with this unorthodox approach would be greatly appreciated,
    Advice to the other approaches would be also appreciated, tx, sandra

    Hi, Sandra
    When you work with outer joins, with that I conclude with a double whammy an OR statement allows me to make some incredible manipulations.

    For example, if you have a folder that the master joined the detail folder B with an outer join on B you get records from one if they exist in B or no - no?

    It doesn't have to be the case, you're just limit your way of thinking. It must get off the beaten and tell ourselves, if I could force discoverer to create a subquery with the NULL filter outside, I could find these B that don't have any corresponding entry in B, or I could find who had only the entries in the two.

    Let's say there's a STUDENTID b, using a normal like condition: B.STUDENTID IS NULL will not work because of the outer join. But if you create a Boolean condition, like this:

    B.STUDENTID IS NULL or B.STUDENTID IS NULL you will see amazing results.

    This tip can help.

    In which your question, taking the knowledge above, I was wondering what would happen if you did:

    BOX WHEN (period DMC_Student_Att2.Academic IS NULL) OR (period DMC_Student_Att2.Academic IS NULL) THEN

    "NEEDS" | "'--> ' |: Parm_AcademicPeriod_Current |" " ' || : Parm_StudentAttribute_Prev

    I am not sure it will work. If it isn't then you need create 2 worksheets, one containing the students who made the promotion and the other for those who do not. You need the conditions to make this work, one like this:

    * (Period of DMC_Student_Att2.Academic IS NOT NULL) OR (DMC_Student_Att2.Academic period IS NOT NULL) *.

    and other like this: * (DMC_Student_Att2.Academic period IS NULL) OR (DMC_Student_Att2.Academic period IS NULL) *.

    Best wishes
    Michael

  • "CASE WHEN 1 = 0 THEN... ON THE OTHER... END '?

    This might be a very basic question I'm still confused about it.
    Can you explain me please "BOX WHEN 1 = 0 THEN... ON THE OTHER... END '?
    Where and why to use this declaration?


    Help appreciated.

    First Let's break down what it means. Because 1 is never equal to 0, OBI will ignore what comes immediately after and run what comes after the ELSE.

    So, why would we do that? Well, often we want to perform an action that has nothing to do with a particular column in our field. Using this CASE statement, trick us OBI into thinking that we use a column for a calculation or action, but in fact, the column is unchanged.

    For example, suppose that you have been the construction of a line of dashboard. You want to use a column twice in the dashboard command prompt, for example a column ACCOUNT_OPEN_DATE for a range of dates. You cannot use the same column twice in a row of dashboard. (Try it, OBI will ignore your attempt to put the same column twice in your workspace).

    So, what are you doing? You first get a column (in this example, I use a column of type CHAR) as the name of the branch. It doesn't matter which column you are using. The TANK is used the syntax is so logical.

    Move the column to your workspace. Now you click on the amending formula and you type CASE WHEN 1 = 0 THEN organization. "" The branch name ' ELSE 'TEST' END.
    So in this case, the values of the branch name are not affected and the dummy column represents just the word 'TEST '. Now in the 'Show' of the command prompt part, we switch to 'SQL results' and SELECT 'attributes of the account' type. Account_Open_Date OF THE industry and together for a PV called StartDate.

    Because the column is a model, you can call it in fact once again. Use the instruction BOX even make a "dummy" column Then use the same SQL, you used previously, but this time save it in a TICKET called EndDate.

    You now have two date values, you can use your ACCOUNT_OPEN_DATE column to get a date range.

    So, in conclusion, normally you choose a column in the subject box, because you have the values in this column in your report. But when you just need a column to do something unrelated to any column, you use CASE 1 = 0 to make a "dummy" column, and then you can perform your action.

    HTH,

  • When I go to my computer, then program files it will not show me the exe files

    When I go to my computer, then program files, that he will not show me the exe files, that told me what to do not have full administrator control, when I go to the page showing which is the administatrator he show me has a control total why he let me not see the exe files, it also leaves me not so far closed for my dvd writer dishes?

    Try Control Panel, user accounts, click the account, make sure that its listed as 'administrator '.

    close. Then, in control - panel.open 'Options records' stand & check the box 'Show hidden '.

    files & folders", uncheck uncheck them next box"Hide extensions"next"Hide protected. "

    files/folders", nearby... This you gives access, however, once youre thru with youre editing

    or see the files/folders, you must restore default in 'Folder Options '...

  • ORA-06592: not found CASE when executing CASE statement

    Hello

    I have a table of application where I built a form master detail (table with 33 columns, 13 is not hidden items and rest are hidden).

    When I run the page I get an error "error while rendering page, article. P10_TIME_SAVED_FREQUENCY, ORA-06592: not found when executing CASE statement CASE"

    Error:

    Error during rendering of the element on the page P8_MONEY_SAVED_FLAG.

    ORA-06592: not found CASE when executing CASE statement

    Technical information (only visible to developers)

    is_internal_error: true

    apex_error_code: WWV_FLOW_FORM. UNHANDLED_ERROR

    ora_sqlcode:-6592

    ora_sqlerrm: ORA-06592: not found CASE when executing CASE statement

    Component.type: APEX_APPLICATION_PAGE_ITEMS

    Component.ID: 13345536607188241

    Component.Name: P8_MONEY_SAVED_FLAG

    error_backtrace:

    ORA-06512: at "APEX_040200.WWV_FLOW_NATIVE_ITEM", line 1751

    ORA-06512: at "APEX_040200.WWV_FLOW_NATIVE_ITEM", line 4241

    ORA-06512: at "APEX_040200.WWV_FLOW_PLUGIN", line 1251

    ORA-06512: at "APEX_040200.WWV_FLOW_FORMS", line 977

    ORA-06512: at "APEX_040200.WWV_FLOW_FORMS", line 1406

    DEBUG:

    Exploitation forest exception in final_exception_handler:

    SQLERRM: ORA-20987: APEX - error during rendering of the element on the page P8_MONEY_SAVED_FLAG. -

    ORA-06592: not found CASE during the execution of the instruction BOX Backtrace: ORA-06512: at "APEX_040200.WWV_FLOW_ERROR"

    line 853 ORA-06512: at "APEX_040200.WWV_FLOW_ERROR"

    line 888 ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS"

    line of 3240 ORA-06512: at "APEX_040200.WWV_FLOW_PAGE"

    line of 1780 ORA-06512: at "APEX_040200.WWV_FLOW_PAGE"

    line of 1950 ORA-06512: at "APEX_040200.WWV_FLOW", line 6725

    How to solve this problem. Please advice

    Oracle Apex Vesion: 4.2.1

    Thank you

    BO123 wrote:

    Hello

    I have a table of application where I built a form master detail (table with 33 columns, 13 is not hidden items and rest are hidden).

    When I run the page I get an error "error while rendering page, article. P10_TIME_SAVED_FREQUENCY, ORA-06592: not found when executing CASE statement CASE"

    Error:

    Error during rendering of the element on the page P8_MONEY_SAVED_FLAG.

    ORA-06592: not found CASE when executing CASE statement

    Technical information (only visible to developers)

    is_internal_error: true

    apex_error_code: WWV_FLOW_FORM. UNHANDLED_ERROR

    ora_sqlcode:-6592

    ora_sqlerrm: ORA-06592: not found CASE when executing CASE statement

    Component.type: APEX_APPLICATION_PAGE_ITEMS

    Component.ID: 13345536607188241

    Component.Name: P8_MONEY_SAVED_FLAG

    error_backtrace:

    ORA-06512: at "APEX_040200.WWV_FLOW_NATIVE_ITEM", line 1751

    ORA-06512: at "APEX_040200.WWV_FLOW_NATIVE_ITEM", line 4241

    ORA-06512: at "APEX_040200.WWV_FLOW_PLUGIN", line 1251

    ORA-06512: at "APEX_040200.WWV_FLOW_FORMS", line 977

    ORA-06512: at "APEX_040200.WWV_FLOW_FORMS", line 1406

    DEBUG:

    Exploitation forest exception in final_exception_handler:

    SQLERRM: ORA-20987: APEX - error during rendering of the element on the page P8_MONEY_SAVED_FLAG. -

    ORA-06592: not found CASE during the execution of the instruction BOX Backtrace: ORA-06512: at "APEX_040200.WWV_FLOW_ERROR"

    line 853 ORA-06512: at "APEX_040200.WWV_FLOW_ERROR"

    line 888 ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS"

    line of 3240 ORA-06512: at "APEX_040200.WWV_FLOW_PAGE"

    line of 1780 ORA-06512: at "APEX_040200.WWV_FLOW_PAGE"

    line of 1950 ORA-06512: at "APEX_040200.WWV_FLOW", line 6725

    How to solve this problem. Please advice

    Oracle Apex Vesion: 4.2.1

    Post a backtrace of the page see the request and the item type properties and the source / default to the value of the P8_MONEY_SAVED_FLAG element.

    Seems to be similar to ORA-06592 with the page only items appear, which also involved a master/detail form. Can you reproduce this on apex.oracle.com?

  • When not equal then delete target does not. Please suggest.

    When not equal then delete target does not. Please suggest.

    MERGE INTO pppp pp

    With the HELP of pppp1 p1

    WE (pp.productnr = p1.productnr)

    WHEN NOT MATCHED

    THEN

    DELETE

    Hello

    2751928 wrote:

    When not equal then delete target does not. Please suggest.

    Think about it logically, is that correct?

    You say: DELETE something that does not exist. The NOT MATCHED block will be executed only when the data being sought are not found.

    AS FAR AS I KNOW:

    For NON MATCHED block, INSERT only is allowed.

    For block MATCHED, UPDATE, and DELETE are allowed.

    Take a look at this point - ORACLE-BASE - improvements in Oracle Database 10 g MERGE statement

    Please explain, in other words English, what you are trying to reach.

  • Hey, I have probem with Lightroom, when I export, add watermark, when I want to export, and then said "You did not choose a destination folder" Please HELP me PLS

    Hey, I have probem with Lightroom, when I export, add watermark, when I want to export, and then said "You did not choose a destination folder" Please HELP me PLS

    Hi Klemenh,

    In the export of Lightroom window please ensure that you have chosen the location of the export.

    Please check the screenshot:

    Concerning

    Tanuj

  • Subselect with clause with and nvl() with case when as 2nd argument does not work

    I get an error for this one

    Select)

    with x

    (select 1 of the double)

    Select

    NVL (x.a, cases where x.a is null then fine otherwise 3 2)

    the double)

    of the double

    Error is:

    ORA-00904: 'X '. "' A ': invalid identifier

    ... related to the use of x.a in an expression box as the 2nd argument of nvl (...)

    Rgds,

    Frank

    Hello

    Maybe like this?

    Select)

    with x

    (select 1 of the double)

    Select

    NVL (x.a, case when x.a is null, then Itf_Pkg.Itf_Null_Value ("x.a', 'a null value'") or 3 end)

    X)

    of the double

  • When I click on 'File' and then 'new' it keeps open a new file as a layer and not a background. The RGB mode is selected.

    When I click on 'File' and then 'new' it keeps open a new file as a layer and not a background. The RGB mode is selected.

    With the new files to open as a layer and not a background, I'm not able to create multiple layers and it won't let me convert the background layer.

    How what happened. I've used PS yesterday and had no problem. Today, my computer did updates mandatory day and now this.

    Yes. You use the option of Pixel of the Ellipse tool. He's so setting pixels as it is supposed to do without creating a layer.

    Choose the option to the form:

    Also the menu layer > new layer creates layers and paper rolled up at the bottom of your layers palette also creates a new layer. I hope these work.

  • Bytes to Port property node. When to use and when not?

    Hi all

    Ive frequently used bytes to port property node performing bed series and have not experienced any problems.  I've heard mixed on this subject reviews and I would like to know when to use and when not to use it.

    Thanks for any input.

    I will start by when it should not be used.

    When there are (as readable) ASCII data to come through and it is separated by a termination character.  Select the stop character and read more bytes than you ever expect a given message.

    When there are binary data, but a protocol where you know clearly how the message package is put in place.  In this case, you want to disable the stop character because any octet can be given legitimate and be interpreted as the stop character.  With these protocols, if you know the message is always X bytes, read X bytes.  If the message is of variable length, but the Protocol is set to tell you low for a long time the message is, and then make partial readings.  So if each message starts with 2 bytes that says follow X bytes.  Then read 2 bytes, which converted to a number, then read this number of bytes.

    When to use:

    The only time will really use bytes to the port is if you use a terminal of the installation type.  Just enter and display on-screen what never happens happened at the port since the last time it was read.  When you don't care where are message breaks.

    If you use bytes to the port and care message breaks, then you're obligated to all your new message concatenated to a string, you store in a shift register and each reading analysis through data to determine if you have a complete message and valid.  If you do not, do nothing and go back and read more.  In fact, you will need to run through the chain of data several times in a row before coming back to reread in the case where the message ever resulted in a single reading packets.

    The vast majority of applications falls into one of the above situations.  The last situation is not as common, and if you use bytes to the port with a system of e-mail that has defined a defined protocol or packages, you do a job more in programming to maintain a software buffer of data as well as the hardware buffer to the serial port.

  • Cannot hear sound when it is online and when trying to install flash player then it show ATL file DLL missing, please reinstall the program

    Cannot hear sound when it is online and when trying to install flash player then it show ATL file DLL missing, please reinstall the program

    Hello

    We are pleased to hear that you were able to find a solution to the question and I thank you for the information provided. Do not hesitate to contact us, in the case where you face other problems in the future.

  • Error number invalid when using case when

    I have a table called NATIONAL_RARE_ECOSYSTEMS that contains 1 column called TEST_COLUMN (data type: varchar2):

    TEST_COLUMN
    rare ecosystem
    rare
    0
    0
    (null)
    (null)

    what I want is a query that will add a column called NRE_SCORE that will give each instance of line a score of 0 if it is null.
    If it is 0, then the score should be 0.
    If the line contains any text, partition should be 1

    I wrote the request:

    SELECT
    (CASE WHEN test_column is null THEN 0)
    WHEN test_column = 0 THEN 0
    WHEN test_column > 0, 1
    END) AS NRE_SCORE
    OF NATIONAL_RARE_ECOSYSTEMS;

    I get the error message:

    ORA-01722: invalid number
    01722 00000 - "invalid number."

    I think it is because on the 2nd and 3rd line, trying to perform arithmetic operations on a column which is varchar2 which I know that I can't do.

    How can I write a query that says: If the line contains text, then gives the score of 1?

    I'm using oracle 11g.

    Hello

    993451 wrote:
    I have a table called NATIONAL_RARE_ECOSYSTEMS that contains 1 column called TEST_COLUMN (data type: varchar2):

    TEST_COLUMN
    rare ecosystem
    rare
    0
    0
    (null)
    (null)

    what I want is a query that will add a column called NRE_SCORE that will give each instance of line a score of 0 if it is null.
    If it is 0, then the score should be 0.
    If the line contains any text, partition should be 1

    Any text other than '0', you mean. I guess that doesn't matter if this text is all the numbers, like '9876 'or something with no numbers, as 'rare'.

    I wrote the request:

    SELECT
    (CASE WHEN test_column is null THEN 0)
    WHEN test_column = 0 THEN 0
    WHEN test_column > 0 THEN 1
    END) AS NRE_SCORE
    OF NATIONAL_RARE_ECOSYSTEMS;

    I get the error message:

    ORA-01722: invalid number
    01722 00000 - "invalid number."

    I think it is because on the 2nd and 3rd line, trying to perform arithmetic operations on a column which is varchar2 which I know that I can't do.

    You are not actually doing arithmetic, but you compare your VARCHAR2 column, so he tries to convert the string to a NUMBER, and that's why you get the error ORA-01722.
    >

    How can I write a query that says: If the line contains text, then gives the score of 1?

    I'm using oracle 11g.

    Here's one way:

    SELECT       CASE
               WHEN  NVL (test_column, '0') = '0'
               THEN  0
               ELSE  1
           END          AS nre_score
    ,       ...          -- you must want other columns, too
    FROM       national_rare_ecosystems
    ;
    

    Since you are not really care on the numerical value, do not use numbers anywhere; stick with VARCHAR2s, for example '0'.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) and also publish outcomes from these data.
    Point where the above query was to get erroneous results, and explain, using specific examples, how you get these results of the sample data in these palces.
    See the FAQ forum {message identifier: = 9360002}

  • any case when and the sql clause

    Hello:
    What follows is my sql clause:
    SELECT T.*, b.name
    OF dbtest1 t
    LEFT OUTER JOIN dbtest b ON t.NO = b.empno
    WHERE t.ChineseName like '% "| : ChineseName | ' %' AND b.name like "%" | : name | » %'
    ORDER BY t.ChineseName

    The main problem is that I want to check the b.name if it is null, it can be passed as function NVL, so I try using case when, but it does not work.
    When there are the b.name in where clause, the columns of result will not include data without b.name (or implies the b.name is NULL); And that
    the result data are not entirely accurate.
    is it possible to use the case when it is implemented in the following code snippet:

    -case when b.name is not NULL then b.name like "%" | : name | » %'
    Else b.name = NULL (b.name = b.name does not seem to work on the analysis of data zero)
    end

    Thank you very much.

    962769 wrote:
    The main problem is the table is the form of the cross, and the like clause will filter the
    data without a name. Basically, it should show the empty columns, however, it won't.
    so, when I test the sql code, I fhound Like "%" | b.Name | ' %' will not get the data when the original dbtest1 table data
    has no id corresponding to the BD test. It seems pointless to go the LEFT OUTER JOIN.

    Thank you

    WHERE t.ChineseName like '%'||:ChineseName||'%'
    AND  (
            b.name like '%'||:name||'%'
           or b.empno is null
        )
    
  • Problem to create CASE WHEN OBIEE

    Hello world

    I need to create a field to calculate in the responses of the Oracle with the sentence in the CASE.

    But I can't because I try to do this:

    BOX WHEN "Las Coronaria. "" Your note Csdst "> 8 CAN ' > 8' OTHER 'Las Coronaria. "" Your note Csdst ' END

    and OBIEE send me the following error:

    [nQSError: 10058] A general error occurred. [nQSError: 22027] Union of incompatible types. (HY000)
    Issued SQL statement: SELECT "Las Coronaria. "' Your Csdst note ', CASE WHEN"Las Coronaria. "" Your note Csdst "> 8 CAN ' > 8' OTHER 'Las Coronaria. "" Csdst your note ' the end 'INDICATORS CLINICOS.


    Why?

    Kind regards
    Daniel Hidalgo

    Since WHEN a part are tank and part ELSE is the number type.
    Make the similar data as type

    BOX WHEN "Las Coronaria. "' ACE Csdst ' > 8 THEN ' ELSE cast > 8' ("Puntajes Coronaria". "END ACE Csdst' as char)

    Pls mark as correct

  • Problem with case when try to alter the query from siimple

    Hello PL/SQL gurus and Experts.

    I'm stuck with a question (can be simple), but not gettings all headsway.
    select 365/day_num_yr Anul_Fact from Date where date_dt = trunc(sysdate -1) 
    value returns is as - 1.46

    need to write it in the form of case (I have to multiply it to some other outer query), I want to store variable ina and then use the same in an outside -.
    but when use the following syntax, then it always returns 0 and not the same output returned by the query above without the scabbard.
    select (case when date_dt =trunc(sysdate -1) then 365/day_num_yr else 0 END) Anul_Fact 
    Help kindly, I appericate your time and effort in advance.

    user555994 wrote:
    Problem is that I do not get the output as 1.46, even the output is coming like the 0 only if using the query - next

    select /*date_dt, sysdate - 1 prev_dt, trunc(sysdate - 1) trunc_prev_dt,*/
    case when date_dt = trunc(sysdate -1) then  365/day_num_yr
    else 0
    end num_day
    from date_dim;
    

    Completely, which seems to be a question of DATA. Have you checked if the table contains data for DATE_DT = SYSDATE - 1? Can you check if the data stored do not have hours and Minutes stored?

    Although I have provided examples of data, which is the same as the data in my main table and once I used the previous solution you provided and then also gives the result as same as those mentioned by you.

    I think it's something like -

    select date_dt, sysdate - 1 prev_dt, trunc(sysdate - 1) trunc_prev_dt,
    case when date_dt = trunc(sysdate -1) then  366/day_num_yr where day_num_yr=(select day_num_yr from date_dim where date_dt = trunc(sysdate -1))
    else 0
    end num_day
    from date_dim;
    

    Once we get the day_num_yr then he deviding by 366/day_num_yr :(
    but he does not like throwing an error ORA-95 - missing keyword

    Yes, it does not work

    -case when date_dt = trunc (sysdate-1) then 366/day_num_yr where day_num_yr = (select day_num_yr from the date_dim where date_dt = trunc (sysdate-1))

    due to a syntax of alien.
    I don't think that you really need. I already said, with the data in your Table, you will be having only * 1 * record with a Non - zero value. Thus, simply apply a filter to extract the corresponding record SYSDATE - 1 and you should get an output which is Non-zero. If you apply a where predicate, then would not need you a CASE statement. You can directly use something like below:

    select date_dt, sysdate - 1 prev_dt, trunc(sysdate - 1) trunc_prev_dt,
           365 / day_num_yr num_day
      from t4
     where date_dt = trunc(sysdate - 1);
    

    Published by: Jen K, September 7, 2012 16:00

Maybe you are looking for