Case statement "when IN the cursor.

Hi people.

I wonder if it is possible to use the IN within a CASE statement?

I'm trying to see if a parameter is certain dates in another table. I have a cursor declared which points to this date column, and looks like my case statement so

case parameter_date IN certain_dates then if_holiday: = 1 else if_holiday: = 2 end;

It doesn't when I try to compile. And my procedure is listed as invalid.

Thanks for any help :)

I have the Case statement without the right to choose?

Only if specify you on literals as follows

in ('WHATEVER', 'DUDE', 'RUG')

You cannot use a variable.

I guess it may be easier if I just use an if statement.

Ah, is this a CASE of PL/SQL rather than a SQL CASE? Not that it makes a lot of difference. In any case, if this world is IF... ELSIF easier than the CASE? I mean, I'm a traditionalist, and I prefer even the syntax of the CASE.

Cheers, APC

blog: http://radiofreetooting.blogspot.com

Tags: Database

Similar Questions

  • Syntax of the case statement / WHEN

    The table I use a depreciation per fiscal year and the fiscal period.  I try to have the amount of depreciation to go to 2 different columns based on the fiscal year and the fiscal year.  I'm doing it with a nested case statement. I know that is not correct, because I get the message ORA-00905.  I'm relatively new to sql and it is contribtuing to my problem as well.  Here is the code I have and suggestions / corrections would be appreciated.  Thanks for the help...

    SELECT

    lao PDR. DEPTID as DEPTID,

    lao PDR. ASSET_ID as ASSET_NO,

    PA. Descr as DESCRIPTION,

    lao PDR. ACCOUNT_AD as AD_ACCT,

    PDL. DE_ACCT, to take into ACCOUNT

    lao PDR. ADEATH as AMT_DEPR,

    PDL. JOURNAL_ID as JRNL_ID,

    PDL. JOURNAL_DATE as JRNL_DT,

    lao PDR. FISCAL_YEAR as FY,

    lao PDR. ACCOUNTING_PERIOD AP,

    CASE

    WHEN RDP. FISCAL_YEAR = 2014 THEN

    WHEN RDP. PERIOD ACCOUNTANT = 11 THEN pdr. DEPR

    END AS CURR_MONTH,

    CASE

    WHEN RDP. FISCAL_YEAR <>2014

    WHEN RDP. ACCOUNTING PERIOD <>11 THEN pdr. DEPR

    END AS PRIOR_MONTH

    OF PS_DEPR_RPT pdr

    INNER JOIN PS_DIST_LN pdl

    THE pdl. BOOK = pdr. BOOK

    AND pdl. BUSINESS_UNIT = pdr. BUSINESS_UNIT

    AND pdl. FISCAL_YEAR = pdr. FISCAL_YEAR

    AND pdl. ACCOUNTING_PERIOD = pdr. ACCOUNTING_PERIOD

    AND pdl. ASSET_ID = pdr. ASSET_ID

    AND pdl. CF_SEQNO = pdr. CF_SEQNO

    INNER JOIN PS_ASSET PA

    WE pa. ASSET_ID = pdl. ASSET_ID

    AND pa. BUSINESS_UNIT = pdl. BUSINESS_UNIT

    WHERE

    lao PDR. BUSINESS_UNIT = "A0465.

    AND pdr. BOOK = 'RUN '.

    AND ((pdr. FISCAL_YEAR = 2014 AND pdr. ACCOUNTING_PERIOD = 11) OR (pdr. FISCAL_YEAR = 2014 AND pdr. ACCOUNTING_PERIOD = 10))

    Hello

    2713822 wrote:

    Thank you... I appreciate the information you provide when you answer these questions.  I always try to get the amount (from the same column) for 2 rows in different columns.  I tried the LAST_VALUE and LAG but it took a long time for the queries to run, I'm looking for another way to do the same.  I'm only using SQL to retrieve data.  I don't have the ability to create or insert.

    I looked the information above and the CASE statement to look like this:

    CASE

    WHEN RDP. FISCAL_YEAR = 2014

    AND pdr. ACCOUNTING_PERIOD = 11

    THEN the RDP. ADEATH AS CURR_MONTH

    ON THE OTHER

    lao PDR. ADEATH AS MONTHS PREVIOUS

    END

    But I'm now getting an "ORA-00905: lack of keyword" message.

    What I'm trying to do is to draw 2 lines 1 to 2014 / 11 and another for 2014 / 10.  The amount for the period 2014 / 11 should go in the current column and the amount for the period 2014 / 10 should go in the previous column.

    Before current assets management

    01 AB01 50.01 50.03

    ....

    If you want to give an alias for a column, then you can say "AS nome_alias" after that tell you what that is in this column.

    'AS nome_alias' applies to the entire column.  Cannot use 'alias_name' in the middle of an expression, for example, in the middle of a CASE expression, before the END keyword.

    If you want to have 2 separate output columns, curr_month and prior_month to your output, you must then 2 separate columns in your SELECT clause.  for example:

    SELECT pdr.branch

    pdr.asset

    CASE

    WHEN pdr.fiscal_year = 2014

    AND pdr.accounting_period = 11

    THEN pdr.depr

    END AS curr_month

    CASE

    WHEN...

    THEN...

    END AS prior_month

    PDR

    ;

    If post you some sample data (CREATE TABLE and INSERT statements), the results and explanations, I could show you how to complete the... sections.

    To find out what version of Oracle you have, use

    SELECT *.

    SINCE the release of v$.

    The output can be messy, like this:

    BANNER

    -------------------------------------------------------------------

    CON_ID

    ----------

    12 c Oracle database Release 12.1.0.1.0 - 64 bit Production

    0

    PL/SQL Release 12.1.0.1.0 - Production

    0

    CORE Production 12.1.0.1.0

    0

    AMT for 64-bit Windows: Version 12.1.0.1.0 - Production

    0

    NLSRTL Version 12.1.0.1.0 - Production

    0

    The important thing is the number 5 parts on the first line; 12.1.0.1.0 in the example above.

  • Helps the case statement when

    I am trying to compare the (date) "LATEST_EVENT_DT" to the "Big Date" ().

    So for 'The last event,' show "CANCELLED" If the "more great Date" is superior to the "LATEST_EVENT_DT" and if not, then display the value in the column 'LATEST_EVENT_DESC'. "

    If I take the part "Last event" everything works fine. But with it in I get the error 'keyword not found FROM or planned. " If anyone can help with this?

    Select

    LATEST_EVENT_DT,


    "OIT_Closed_Date", "OIR_Closed_Date", "OIN_Closed_Date."

    largest (LATEST_EVENT_DT, nvl ('OIT_Closed_Date', TO_DATE ('01011950', 'MMDDYYYY')), nvl ('OIR_Closed_Date', TO_DATE ('01011950', 'MMDDYYYY')), nvl ('OIN_Closed_Date', TO_DATE ('01011950', 'MMDDYYYY'))) "Big Date"

    "Last event" =.
    CASE
    WHEN LATEST_EVENT_DT < 'Date of larger' THEN 'CANCELLED '.
    OF OTHER LATEST_EVENT_DESC
    END

    of apex01.greatest_date_vw_SGD

    Thank you

    Steven

    Hi, Steven,

    What is

    "Last event" =.

    supposed to do?  Do you want the column returned by the expression BOX to appear as the "Last event" in the output?  If so, use an alias for column after the expression, as you did with "Big Date".

    You cannot define an alias for column (such as "largest Date") and then refer to this alias in the select even where it has been set.  Derive from the column in a subquery, you can reference it in a great query, like this:

    WITH got_greatest_date AS

    (

    Select LATEST_EVENT_DT

    , "OIT_Closed_Date".

    , "OIR_Closed_Date".

    , "OIN_Closed_Date".

    largest (LATEST_EVENT_DT

    nvl ('OIT_Closed_Date',

    , TO_DATE ('01011950', 'MMDDYYYY')

    )

    nvl ('OIR_Closed_Date',

    , TO_DATE ('01011950', 'MMDDYYYY')

    )

    nvl ('OIN_Closed_Date',

    , TO_DATE ('01011950', 'MMDDYYYY')

    )

    ) AS "Big Date".

    of apex01.greatest_date_vw_SGD

    )

    SELECT eff.*

    CASE

    WHEN LATEST_EVENT_DT< "greatest="">

    THEN "CANCELLED."

    OF OTHER LATEST_EVENT_DESC

    END as the "last event".

    OF got_greatest_date g

    ;

    You really like the names in double quotes?  Most people find them very confusing and a lot more trouble than they are worth.

  • using a Case statement to display the values of column even as table headers

    I have a database that has been set up kind of tricky, in that some tables are made up of columns that are field names and one link to another table that contain the data for these field... also names there ID displays as many lines instead of as a row of data. I would like to write a query to extract that information and display it as one line for each ID.

    example: table 1

    ID, name, itemresponse and itemcode, Description

    Dee Jones Childrens Hospital 123 SITE location

    123 dee Jones, Date of appointment next NEXTAPPT 22/04/2014

    123 dee Jones was on bedrest NOSHOW reason do not show

    I would like to have the display of data as a record on this same patient, instead of as 3 separate registers (with the Description column in table 1

    Table 2

    ID, name, place, Date of the next meeting, show no reason

    123 dee Jones Childrens Hospital 22/04/2014 was the bed rest

    I have included the code I worked on below my question, for me to get the desired results should I use the Case statement and it's the right way to do it below?

    (SELECT
    PAT.ID "PATIENT ID."
    PAT. FIRST | » '|| PAT. "PATIENT FIRST NAME."
    PAT. "PATIENT DOB," DATE_OF_BIRTH
    DS. Date 'Date of inpatients ',.
    Dai. ITEM_CODE "Item Code",
    Dai. DESCRIPTION "Description."
    Siad. ITEM_RESPONSE,

    Max (CASE WHEN dai. ITEM_CODE IS "SITE" THEN DAI. Decription
    ANOTHER NULL
    END) AS "name of the hospital."

    Max (CASE WHEN DAI.) ITEM_CODE IS 'NEXTAPPT' THEN DAI. ITEM_Description
    ANOTHER NULL
    END) AS 'next Appt Date. "

    Max (CASE WHEN DAI.) ITEM_CODE IS "LASTDATE" THEN DAI. Description
    ANOTHER NULL
    END) AS 'last visit Date.

    Max (CASE WHEN DAI.) ITEM_CODE IS 'NOSHOW' THEN DAI. Description
    ANOTHER NULL
    END) THAT "the reason has not shown".

    Of
    (PAT.ID "IDENTIFYING PATIENT",
    PAT. FIRST | » '|| PAT. "PATIENT FIRST NAME."
    PAT. "PATIENT DOB," DATE_OF_BIRTH
    DS. Date 'Date of inpatients ',.
    Dai. ITEM_CODE "Item Code",
    Dai. DESCRIPTION "Description."
    Siad. ITEM_RESPONSE

    Of

    dm_sessions Ds,
    dm_session_assessments dsa,
    DAS dm_admin_sections,
    dm_session_assessment_items Siad,
    Dai dm_admin_items,
    Po Patient_Orders,
    Inventory inv,
    Patients_Table PAT
    dm_admin_categories CAD

    where dsa.session_Id = ds.session_Id
    and PAT.ID = ds. Patient_ID
    and dsa.excluded_assessment =' no
    and dac.category_code = 'OPEN'

    and dsa.section_id = das.section_id
    and das.category_id = dac.category_id
    and das.section_code = 'northwest'
    and dai.section_id = das.section_id
    and dsai.item_id = dai.item_id
    and dsai.session_assessment_Id = dsa.session_assessment_Id
    and dsai.excluded =' no
    - and Dai.ITEM_ID = Dsai.ITEM_ID
    and Dai.ITEM_CODE IN ('SITE', 'NEXTAPPT', 'LASTDATE', 'NOSHOW')
    and po.patient_ID = ds.patient_ID
    and in. NDC_NO = inv. NDC_NO
    and inv. TDRUG_ABBREV = in. DRUG_ABBREV

    PAT.ID GROUP, PAT. FIRST | » '|| PAT. LAST, PAT. DATE_OF_BIRTH, ds. Date, dai. ITEM_CODE, dai. DESCRIPTION, Siad. ITEM_RESPONSE))

    Hello

    DATE is not a very good name for a column.  Use something like EVENT_DATE, that will not be confused with a keyword from Oracle, instead.

    I don't see something like this column in the CREATE TABLE statement.  He will always be the same value on all lines?

    Here's a way to get the results you requested:

    SELECT id

    first name | ' ' || LastName AS name

    Date of birth

    MAX (CASE WHEN item_code = "NEXTAPPT", THEN item_response END) AS next_appointment,

    MAX (CASE WHEN item_code = "LASTDATE" THEN item_response END) AS last_visit_date,

    MAX (CASE WHEN item_code = "SITE" THEN item_response END) AS location

    FROM mytable1

    GROUP BY id, firstname, lastname, dob

    ;

    Of course, I can't test it very well until you post INSERT statements for the sample data.

    I guess that 2 or more lines of the entry have the same id, then they will necessarily be first name last name, the name and date of birth, too.  No doubt they are standardized in your actual tables.

  • Dynamic transformations (Case statements) conducted through the user interface

    Hello

    I have a vision that a lot of business logic with values coded hard and would like to re - design the view make the transformation of dynamic business logic. I would like to give an example to tell the requirement in detail with the example below.

    Example SQL view: -.

    SELECT

    A.EMP_ID,

    A.EMP_NAME,

    BOX WHEN A.STATE = 'CA' AND A.DEPT_CODE = "C123" THEN 10 '

    WHEN ELSE A.STATE = 'NJ' AND A.DEPT_CODE IN ('N111', 'N454') AND A.GRADE = 'AAA' THEN '08'

    ELSE END '00' AS TAX_RATE,

    CASE WHEN A.JOIN_DT > = '20010101' OR (A.EMP_ID IN ('E134', "E456") OR A.DEP_CDE IN ('C222', "F222")) THEN '30'

    WHEN of OTHER A.JOIN_DT < '20010101' OR A.EMP_ID IN ('J133', "K556") THEN '20'

    ELSE '10' END AS BONUS_PERCENT

    A.ADDRESS

    FROM EMP A

    WHERE A.END_DATE > = '20000101'

    AND NVL (A.DEL_FL, 'N') = ' don't

    AND EXISTS (SELECT DEPT 1 D)

    WHERE D.EMP_ID = A.EMP_ID)

    Result: -.


    I wish I had the TAX_RATE and logic BONUS_PERCENT dynamically generated fields which has a lot of statements of case and hardcode, where the USER can change the logic and its values according to rank.

    To do this, we can design a table EMP_BUS to have fields that can be modified and the transformation of the UI logic. Please share your ideas in the design of the table or the applicable...

    Thank you in advance.

    Hello

    One way is to have all the settings defined by the user that is stored in a global Table Temporay and join at this table in your point of view.  The advantage of a global temporary Table is that each session has its own set of parameters which does not interfere with the other, so you can have multiple sessions using the view at the same time, and everyone will see the results based on its own parameters.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.
    Explain, using specific examples, how you get these results from these data.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • Why Firefox does not scroll the page when choosing &amp; the cursor reaches the bottom of the screen

    The selection of text on a page of the screen when the cursor reaches the lower edge of the screen in Firefox (version 9.0.1) does not scroll. Other programs (including IE) do, so it doesn't seem to be a local computer problem.
    I don't see a setting in the page options that enables / disables this then what is the solution?

    Activate the module bar (Firefox > Options or view > toolbars;) CTRL + /) or find bar to make Firefox scroll the page while selecting the text (Ctrl + F).

  • My laptop Dell Inspiron 1525... When typing, the cursor jumps around & inserts as I type

    When you use the keyboard, the cursor will jump to another place in what I typed & insert here where it shouldn't.

    Hello

    Check with the manufacturer of system support, documentation in line, or forums as there
    probably are shortcut keys that enable and disable the touchpad functions.

    Dell - disable or enable the touchpad by using the access key
    http://support.Dell.com/support/topics/global.aspx/support/KCS/document?c=us&docid=424135&doclang=en&l=en&s=Gen&cs

    Dell support
    http://support.Dell.com/

    Dell support drivers - product manual & warranty Info (left side) - and much more
    http://support.Dell.com/support/index.aspx?c=us&l=en&s=DHS

    Dell forums
    http://en.community.Dell.com/forums/

    Parameters for TouchPad located in the control panel - mouse (there may be several tabs with)
    Entries of TouchPad) and some have a utility that loads in the Notification area near clock on
    at the bottom right.

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

    If necessary: (make sure that you have restarted at least once, if the above did not work)

    Panel of configuration manager devices - mouse and pointing devices - Double click on the touch pad-
    The driver tab - click on Update Driver (which is may not make anything like MS is far behind certifying)
    (drivers), now right CLICK on the touchpad and UNINSTALL.

    Then go to the USB and UNINSTALL ALL controllers except the category itself (all in
    It). RESET

    This will refresh the driver for the TouchPad and battery USB. This does not prevent the touchpad
    of work.

    The similar procedure on XP, Windows 7 and Vista is the same, except that we must
    Clear the specific device if present.
    http://support.Microsoft.com/kb/310575

    Then go to the system manufacturer's website and get the latest touchpad drivers.

    Download - SAVE - go to where you put it-click on - RUN AS ADMIN.

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

    This utility also allows to control the TouchPad:

    TouchFreeze
    http://code.Google.com/p/TouchFreeze/

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • EXTRACT function can be used directly in the CASE statement WHEN

    I wrote the following SELECT statement. The function 'calc_time_diff' is a stored function that subtracts two timestamps and returns the result to the total number of seconds. My DBA does not 'calc_time_diff' as a stored function, then, I replaced the third line (in bold) in the SELECT statement with this:

    COUNTY ( BOX WHEN (extract (DAY OF v_end_ts-v_st_ts) * 24 * 60 * 60) +)

    (extract (HOUR FROM v_end_ts-v_st_ts) * 60 * 60) +.

    (excerpt (v_end_ts-v_st_ts MINUTE) * 60) +.

    extract ((DEUXIÈME à PARTIR de v_end_ts-v_st_ts) < 3600 THEN 1 END) less_than_1_hrs_count

    But the CASE above does not work. It returns the same value as COUNT (*). If the total number of tickets is 32 output will be

    total_tickets less_than_1_hrs_count

    32                                 32

    If I call the "calc_time_diff" then I get the correct result. What I'm doing wrong here?

    **********************************************************************************************************************************************************************

    SELECT

    Count (*) total_tickets,

    COUNTY ( CASE WHEN END of calc_time_diff (t.created_date, h.closed_date) < 3600 THEN 1) less_than_1_hrs_count

    OF n01.cc_ticket_info t

    JOIN IN-HOUSE

    (SELECT ticket_id, MAX (created_date) closed_date

    OF n01.cc_ticket_status_history

    WHERE ticket_status = 'CLOSED' AND created_date > = 18 August 2013 ' AND created_date < (to_date('08/24/2013','MM/DD/YYYY') + interval '1' DAY)

    GROUP BY ticket_id

    ) h

    WE (t.ticket_id = h.ticket_id)

    INNER JOIN n01.cc_ticket_notes n

    WE (n.created_date = h.closed_date)

    WHERE (t. ticket_status = 'NOTIFICATION' t.ticket_status 'CLOSED' = GOLD) AND t.created_date > = 18 August 2013 ' AND t.last_changed < to_date('08/24/2013','MM/DD/YYYY') + interval '1' DAY);

    ***********************************************************************************************************************************************************

    create or replace

    FUNCTION calc_time_diff)

    p_st_ts N01.cc_ticket_info. Type of LAST_CHANGED %,

    p_end_ts N01.cc_ticket_info. Type of LAST_CHANGED %)

    RETURN NUMBER

    AS

    v_no_sec NUMBER;

    v_st_ts N01.cc_ticket_info. Type of LAST_CHANGED %;

    v_end_ts N01.cc_ticket_info. Type of LAST_CHANGED %;

    BEGIN

    v_st_ts: = p_st_ts;

    v_end_ts: = p_end_ts;

    SELECT (extract (DAY OF v_end_ts-v_st_ts) * 24 * 60 * 60) +.

    (extract (HOUR FROM v_end_ts-v_st_ts) * 60 * 60) +.

    (excerpt (v_end_ts-v_st_ts MINUTE) * 60) +.

    excerpt ((SECOND from v_end_ts-v_st_ts)

    IN v_no_sec

    DOUBLE;

    Return v_no_sec;

    END calc_time_diff;

    Hello

    You don't need a function defined by the user or the EXTRACT to find the difference between two timestamps.

    SELECT COUNT (*) AS total_tickets

    , COUNTY ( BOX WHEN h.closed_date < t.created_date="" +="" interval="" '1'=""> )

                         THEN 1

    END

    ) AS less_than_1_hrs_count

    ...

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.
    If you change the query at all, post your modified version.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002

  • CASE statement when

    Hello everyone,

    I have the following SQL statement. To verify that p01.euro IS NOT NULL, I think I should add a "BOX WHEN" statement in the code, the problem is, I don't know how this here... The statement "BOX WHEN" should be for the subselect statement - statement I marked in red...
    Maybe you have an idea... Thank you
    select
    
    (select apex_item.select_list_from_query (5,name,'select name from cn_pl_projektidee order by idee_id asc', 'style="width:130px"', NULL) name 
    from cn_pl_projektidee s01 where s01.idee_id = t1.idee_id) idee,
    
    (select htmldb_item.text(6,sum(stunden))stunden_ilp from cn_pl_std_peplanung t02
     where abt_id = '1'  
     and  t02.pe_id = t1.pe_id 
     and  t02.version_id = t1.version_id
     and  t02.idee_id = t1.idee_id) stunden_ilp,
    
    (select htmldb_item.text(7,sum(stunden))stunden_ild from cn_pl_std_peplanung t02
     where abt_id = '3'  
     and  t02.pe_id = t1.pe_id 
     and  t02.version_id = t1.version_id
     and  t02.idee_id = t1.idee_id) stunden_ild,
    
    (select htmldb_item.text(8,sum(stunden))stunden_ilm from cn_pl_std_peplanung t02
     where abt_id = '4'  
     and  t02.pe_id = t1.pe_id 
     and  t02.version_id = t1.version_id
     and  t02.idee_id = t1.idee_id) stunden_ilm,
    
    (select htmldb_item.text(9,sum(stunden))stunden_ief from cn_pl_std_peplanung t02
     where abt_id = '9'  
     and  t02.pe_id = t1.pe_id 
     and  t02.version_id = t1.version_id
     and  t02.idee_id = t1.idee_id) stunden_ief,
    
    (select htmldb_item.text(10,sum(stunden))stunden_ir from cn_pl_std_peplanung t02
     where abt_id = '10'  
     and  t02.pe_id = t1.pe_id 
     and  t02.version_id = t1.version_id
     and  t02.idee_id = t1.idee_id) stunden_ir,
    
    (select sum(euro) from cn_pl_primaerkostenplanung p01 
    where p01.pe_id = t1.pe_id 
    and  p01.version_id = t1.version_id
    and  p01.idee_id = t1.idee_id) summe_la,
    
    
    "CASE WHEN p01.euro IS NOT NULL THEN"
    
    (select sum((sum(t02.stunden) * k01.euro_std * 8)+(select sum(p01.euro) from cn_pl_primaerkostenplanung p01 
    where p01.pe_id = t1.pe_id 
    and  p01.version_id = t1.version_id
    and  p01.idee_id = t1.idee_id))
    
    from cn_pl_std_peplanung t02, cn_pl_sap_leistungsarten k01
    
    where k01.l_art_id = t1.l_art_id 
    and t02.pe_id = t1.pe_id 
    and  t02.version_id = t1.version_id
    and  t02.idee_id = t1.idee_id
    group by t02.pe_id, k01.euro_std) "END" kosten_ges,
    
    
    
    
    (select distinct htmldb_item.hidden(2,pe_id) pe_id from cn_pl_std_peplanung t02
     where t02.pe_id = t1.pe_id
     and  t02.version_id = t1.version_id) pe_id,
    
    (select  distinct htmldb_item.hidden(3,l_art_id) l_art_id from cn_pl_std_peplanung t02
     where t02.pe_id = t1.pe_id 
     and  t02.version_id = t1.version_id) l_art_id,
    
    (select distinct htmldb_item.hidden(4,version_id) version_id from cn_pl_std_peplanung t02
     where t02.pe_id = t1.pe_id 
     and  t02.version_id = t1.version_id) version_id
    
    from cn_pl_std_peplanung t1, cn_pl_projektelemente z1, cn_pl_version u1, cn_pl_projektidee s1 
    where t1.version_id = '&P6_VERSION_WAHL.' and t1.pe_id ='&P6_HELP_PRODET.'  and t1.l_art_id ='&P6_L_ART_ID.'
    
    group by t1.pe_id, t1.version_id, t1.idee_id, t1.l_art_id order by t1.idee_id desc

    Don't know if the rest is ok, but syntactically, you can go for

      SELECT (SELECT apex_item.select_list_from_query (
                        5,
                        name,
                        'select name from cn_pl_projektidee order by idee_id asc',
                        'style="width:130px"',
                        NULL
                     )
                        name
                FROM cn_pl_projektidee s01
               WHERE s01.idee_id = t1.idee_id)
                idee,
             (SELECT htmldb_item.text (6, SUM (stunden)) stunden_ilp
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '1'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ilp,
             (SELECT htmldb_item.text (7, SUM (stunden)) stunden_ild
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '3'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ild,
             (SELECT htmldb_item.text (8, SUM (stunden)) stunden_ilm
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '4'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ilm,
             (SELECT htmldb_item.text (9, SUM (stunden)) stunden_ief
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '9'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ief,
             (SELECT htmldb_item.text (10, SUM (stunden)) stunden_ir
                FROM cn_pl_std_peplanung t02
               WHERE     abt_id = '10'
                     AND t02.pe_id = t1.pe_id
                     AND t02.version_id = t1.version_id
                     AND t02.idee_id = t1.idee_id)
                stunden_ir,
             (SELECT SUM (euro)
                FROM cn_pl_primaerkostenplanung p01
               WHERE     p01.pe_id = t1.pe_id
                     AND p01.version_id = t1.version_id
                     AND p01.idee_id = t1.idee_id)
                summe_la,
             CASE
                WHEN p01.euro IS NOT NULL
                THEN
                   (  SELECT SUM( (SUM (t02.stunden) * k01.euro_std * 8)
                                 + (SELECT SUM (p01.euro)
                                      FROM cn_pl_primaerkostenplanung p01
                                     WHERE     p01.pe_id = t1.pe_id
                                           AND p01.version_id = t1.version_id
                                           AND p01.idee_id = t1.idee_id))
                        FROM cn_pl_std_peplanung t02, cn_pl_sap_leistungsarten k01
                       WHERE     k01.l_art_id = t1.l_art_id
                             AND t02.pe_id = t1.pe_id
                             AND t02.version_id = t1.version_id
                             AND t02.idee_id = t1.idee_id
                    GROUP BY t02.pe_id, k01.euro_std)
             END
                kosten_ges,
             (SELECT DISTINCT htmldb_item.hidden (2, pe_id) pe_id
                FROM cn_pl_std_peplanung t02
               WHERE t02.pe_id = t1.pe_id AND t02.version_id = t1.version_id)
                pe_id,
             (SELECT DISTINCT htmldb_item.hidden (3, l_art_id) l_art_id
                FROM cn_pl_std_peplanung t02
               WHERE t02.pe_id = t1.pe_id AND t02.version_id = t1.version_id)
                l_art_id,
             (SELECT DISTINCT htmldb_item.hidden (4, version_id) version_id
                FROM cn_pl_std_peplanung t02
               WHERE t02.pe_id = t1.pe_id AND t02.version_id = t1.version_id)
                version_id
        FROM cn_pl_std_peplanung t1,
             cn_pl_projektelemente z1,
             cn_pl_version u1,
             cn_pl_projektidee s1
       WHERE     t1.version_id = '&P6_VERSION_WAHL.'
             AND t1.pe_id = '&P6_HELP_PRODET.'
             AND t1.l_art_id = '&P6_L_ART_ID.'
    GROUP BY t1.pe_id,
             t1.version_id,
             t1.idee_id,
             t1.l_art_id
    ORDER BY t1.idee_id DESC
    
  • PLS-00355 error when opened the cursor in the procedure

    Hello everyone,

    I have a problen that makes me crazy:

    Whenever I try to compile the following procedure, the error "PLS-00355: table using pl/sql not allowed in this context" occurs but I don't see what the problem is. I hope that the wisdome of the community will help to solve the problem.

    Here is the code:

    CREATE or REPLACE PROCEDURE data_year (study_year in NUMBER) HAVE
    CONSTANT CHAR Sep: = "";
    CURSOR cursor_year (year_of_interest NUMBER) IS
    Select
    BBS_CONDITIONS. COUNTRYNUM as a country,
    BBS_CONDITIONS. STATENUM as State,
    BBS_CONDITIONS. ROUTE road,
    BBS_ROUTES. LATITUDE lat,
    BBS_ROUTES. LONGITUDE as lon,
    BBS_SUMMARY. AUG as Aug,
    BBS_SPECIES. ENGLISH_COMMON_NAME as the name,
    BBS_SPECIES. MIGRATION_TYPE as migtype,
    BBS_SUMMARY. SPECIESTOTAL County,
    BBS_CONDITIONS. MONTH as smonth,
    BBS_CONDITIONS. STARTTIME as starttime,
    BBS_CONDITIONS. ENDTIME as end time,
    BBS_CONDITIONS. AMATURES amatures, as
    BBS_CONDITIONS. ASSISTANT Assistant
    of BBS_SPECIES.
    BBS_ROUTES,
    BBS_SUMMARY,
    BBS_CONDITIONS
    where BBS_ROUTES. ROUTE = BBS_CONDITIONS. ROUTE
    and BBS_ROUTES. STATENUM = BBS_CONDITIONS. STATENUM
    and BBS_ROUTES. COUNTRYNUM = BBS_CONDITIONS. COUNTRYNUM
    and BBS_SPECIES. AUG = BBS_SUMMARY. AUG
    and BBS_CONDITIONS. AN = BBS_SUMMARY. YEAR
    and BBS_CONDITIONS. ROUTE = BBS_SUMMARY. ROUTE
    and BBS_CONDITIONS. STATENUM = BBS_SUMMARY. STATENUM
    and BBS_CONDITIONS. COUNTRYNUM = BBS_SUMMARY. COUNTRYNUM
    and BBS_SPECIES. CLASS_ID = 0
    and BBS_CONDITIONS. AN = year_of_interest
    order by country, State, road, migtype, Aug.
    rec_year cursor_year % ROWTYPE;
    I have NUMBER: = 1;
    TYPE table_year_type IS TABLE OF cursor_year % ROWTYPE;
    table_year table_year_type;
    BEGIN - Beginning of the data_year procedure
    table_year: = table_year();
    OPEN cursor_year (study_year);
    LOOP
    EXTRACT the cursor_year in rec_year;
    EXIT WHEN cursor_year % NOTFOUND;
    table_year. EXTEND (1);
    table_year (i): = rec_year;
    i: = i + 1;
    END LOOP;
    CLOSE Cursor_year;
    DBMS_OUTPUT. Put_line ('country' | sep |) "the State" | Ms | "Route". Ms | "lat". Ms | "lon".
    || Ms | "Aug" | Ms | "name" | Ms | "migtype" | Ms | 'count '. Ms | 'month ' | Ms
    || "starttime" | Ms | "endtime" | Ms | "amatures | Ms | "Wizard");
    BECAUSE me in table_year. FIRST... table_year. LAST LOOP
    DBMS_OUTPUT. Put_line (to_char (table_year (i). Country) | Ms | To_char (table_year (i). State) |
    Ms | To_char (table_year (i) .route) | Ms | To_char (table_year (i). LAT) | Ms |
    To_char (table_year (i). LON) | Ms | To_char (table_year (i). AUG) | Ms |
    table_year (i) .name | Ms | To_char (table_year (i) .migtype). Ms |
    To_char (table_year (i). Count). Ms | To_char (table_year (i) .smonth). Ms |
    To_char (table_year (i). StartTime) | Ms | To_char (table_year (i). EndTime) | Ms |
    To_char (table_year (i). RPID) | Ms | To_char (table_year (i). Assistant));
    END LOOP;
    END; -End of the data_year procedure
    /

    Thanks in advance, TC

    Give a line number? I wonder if it might be

    table_year: = table_year();

    that is the origin of the problem. Try to remove and see.

    Better yet, change your code to

    ...
       TYPE table_year_type IS TABLE OF cursor_year%ROWTYPE INDEX BY BINARY_INTEGER;
    
       table_year     table_year_type;
    BEGIN         
    
        OPEN cursor_year (study_year);
        FETCH cursor_year BULK COLLECT INTO table_year;
        CLOSE cursor_year;
    ...
    

    Published by: Dave hemming on November 21, 2008 09:51

  • If the else statement when click the button

    Hello all;

    I ran into a project, I'm having a problem on how to encode.

    Scenario.

    You have 3 States of a button.

    MouseOver

    Mouseout/mouseouthandler()

    Mouse click

    Now.

    When the click of the mouse is done, I need to do the following.

    Under the MouseOver and mouseout/mouseouthandler().

    IF THEN MouseClick

    (Check if the button has been clicked or not)

    Preserve the State of the button

    ON THE OTHER

    (If has not clicked on the button, then change its status)

    Change the State of the button

    How do I d code this?

    Thank you

    Wayne

    Update of productivity: I added a second file (same link: see previous post).

    Productivity means that I then use a symbol.

    • ==> right click and then convert to symbol.
    • use ==> drag and drop library to the stage.
  • How to case statement based on the array of values of 3 or more?

    I'm trying to figure out how to do a comparison or case structure... based on the creation of an array of boolean 3 (or maybe more).

    I have a table (it's from a serial connection, and I am conversion back to a table to work with) [t, F, F] in this case I would like to display on a status indicator "STBY".

    If the array is defined on [F, T, F] I want to display in this indicator "ON".

    If the array is defined on [F, F, T] I want to display in this "EMPTY" indicator

    I can not understand how to compare combinations of things... I read in an array of bytes, and the first 3 bits in this example, determine what to display in a status... I can't figure out how to do with structure case... or without some channels to research and/or bad comparison...

    Any suggestions?

    Thanks in advance,

    Cayenne

    You can use search 1 d array and find the first real.

    Or you could convert the table of Boolean integer U8 and integer that results to determine which cases to run.  (4, vs, vs 1-2)

  • When typing, the cursor jumps around

    while I type fast jumps everywhere and I find myself typing the letters in the words previously seized... What do I do to fix this?

    Hello

    There are some good suggestions in the following thread:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-performance/cursor-jumps-while-typing/9de98945-525a-45fe-a74c-741fb42d2069

  • Cursor to delay when moving the mouse / when entering, the cursor then jumps to new post or leave aside several characters typed.

    I have a desktop Dell Inspiron s. Windows 32-bit Vista, Mcafee internet security 2009, Office home and Student 2007.
    A month ago, I crossed her uninstall, reinstall office, mcafee, windows updates. The problem disappeared about a week and now he's back. Windows update is daily trying to install "microsoft xml 4.0 basic services security update service pack 2: kb954430, don't know if that part of the problem?

    Hello Georgeous

    Thank you for using the Microsoft Answers Forums!

    I would like to ask you a few questions to help focus in the right direction:

    Are there other specific details that you can provide that will help us understand and solve your problem?

    If this KB954430 is not installed on your computer and prompts you for every day then it must go corrupt. I suggest that you follow these steps and check if it works.

    Download the update program "msxml4-KB936181 - enu.exe" on the Microsoft website, no Windows Update.

    http://www.Microsoft.com/downloads/details.aspx?FamilyId=021E12F5-CB46-43DF-A2B8-185639BA2807&displaylang=en

    Run the program and delete all.

    Restart, and then rerun the program again to install it.

    Then, run the file of Windows Update for "Update for Microsoft XML Core Services 4.0 Service Pack 2 security".

    Restart the computer.

    Now, check if you get the same problem again.

    After the return.

    All the best!

    Thank you and best regards,

    R uma - Microsoft technical support.

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • the cursor moves when you type on another line without any command to do so. Line never even

    When type any message in outlook or word or excel the cursor will move to another line anywhere in the message, never the same thing apparently not and of course you add letters to words, a line or it will even go to the signature block.  In this case no order for the cursor to move

    This usually happens on laptops by a sleeve or an arm moving above the small box that replaces a conventional mouse.  Most of these devices can have their reduced sensitivity, or you can search the ' net for one of the many utilities that turn them all in being key off the coast.

Maybe you are looking for

  • the display has square blue/red

    Hello, when I use Mozilla square of red and Blue appear on the screen. They are not always present. See the attached screenshot. Thank you for your help.

  • Where can I find the AddressBook to thunderbird?

    Had to manually load Thunderbird mail in new PC and I need to locate the address book on the old hard drive. Where it could be stored?Thank you

  • Satellite C870-1J6 wired LAN DHCP problems

    Hi all Here, I have a new laptop C870-1J6, which makes my life miserable. It won't start not reliable PXE, and the network card also does not start in Windows. On a cold start the PXE boot Gets an address dhcp fine most of the time, but a warm reboot

  • NB305-106 - how to reset the user password

    Hello. My question is: How can I reset its password if I don't have the USB flash drive or a floppy disk required for this operation? My model is: Toshiba NB305-106. Thank you.

  • WMP changes its name at the time where I change the names in the playlists

    Hi people, to support I have XP and WMP 11. I love working with WMP very much but I have a big problem with the creation of playlists. First, he must know that. If I make a playlist of different artists like this and sync it to my MP3 player, the pla