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
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.
-
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
-
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
ENDof 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.
-
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
-
Between the statement/Case statement
Hi all
I can't find how to use the case statement when you try to find pick_date between X and Y.
The following example shows if the day = Monday then use
where pick_date between next_day (trunc (sysdate)-14, 'MY') and next_day (trunc (sysdate)-7, 'SAT')
Otherwise, use
where pick_date between next_day (trunc (sysdate)-7, 'MY') and next_day (trunc (sysdate), 'SAT')
Select apple
of the double
where pick_date between
(case when to_char(sysdate,'d') = 2 then
(next_day (trunc (sysdate)-14, 'MY') and next_day (trunc (sysdate)-7, 'SAT'))
on the other
(next_day (trunc (sysdate)-7, 'MY') and next_day (trunc (sysdate), 'SAT'))
end)
Thanks in advance!the condition is
BETWEEN expr1 AND expr2
so you can easily use
select apple from dual where pick_date between (case when to_char(sysdate,'d') = 2 then next_day(trunc(sysdate)-14,'MON') else next_day(trunc(sysdate)-7,'MON') end) and (case when to_char(sysdate,'d') = 2 then next_day(trunc(sysdate)-7,'SAT') else next_day(trunc(sysdate),'SAT') end);
-
I have problem with value NULL when the use CASE statement please help this question
I have problem with value NULL when the use CASE statement please help this question
Table: digital_val
SNO cl C2
1 San1 11
2 22 San2
Actual result: expected to A B
A B 11 22
11 NULL
22 NULL
query:
Select case when c1 = "san1" then c2,.
case If c1 = "san2" then c2 B
of digital_val
I'm more curious why, when you select 2 rows, you expect a result of row?
WITH digital_val
AS (SELECT 1 AS 'Sno', 'San1"C1, c2 FROM DUAL 11)
UNION ALL
2 SELECT AS 'Sno', 'San2"C1, c2 FROM DUAL 22)
SELECT CASE WHEN c1 is "San1" THEN END AS A c2.
CASE WHEN c1 = "San2" THEN END AS B c2
OF digital_val;
With no other input, if you select 2 rows, you get 2 rows. One of the other solutions use a max function, but is this really what you want, does not specify?
-
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?
-
Hi, I have a question: if my case when the statement is correct. "Œuvre" is an alias for the database.
and BOX WHEN "Work" =: WORK THEN END of TO_CHAR (0) of OTHER 'work' = NVL ('Work' =: WORK, '0')Hello TKS -.
Here is the general syntax for a CASE statement in OBIEE:
CASE 'Table name' WHEN. "' column name ' = @{variable presentation} THEN"table name ". "' column name ' ELSE '0' END
Some things to note:
(1) ' table name '. ' column name ' is the logical naming convention used by OBIEE. You can get these values automatically simply by clicking on the column on the left side of the screen
(2) variable presentation can be defined using the guests of dashboard, where the user can select a value and have the report reflect these changes.
(3) to put single quotes around a value is a string, not a number. I guess this based on your post.If you use NVL function on the above statement, use the following:
IFNULL (BOX "Table name" WHEN. "column name" = @{variable presentation} THEN 'table name' "." column name"END ELSE ' 0 ', ' 0')"
I hope this helps and please assign points if you found it useful!
Kind regards
Jason -
Case statement is not spend.
Hello
I'm having a strange problem with a case statement. I'm passing is a Boolean value that is set to false, but the case statement never switches to the loop of "false". I have attached a word doc who did the screen has a step of this unique through being shot. The photo of the top has the case highlighted with the probe #8 beside him indicate 'False. ' In the lower screen shot is the very next step that highlights the outside circle while ' loop', but the case statement is always 'True '. Anyone seen this before?
Gary Tyrna
Hey Mello,
Well, I see what you're saying and you are right, the problem is the case statement works when highlight of execution. But I have a main case statement in the loop that either allows the state machine to execute a loop or hides them and that case is triggered for no steps to true or false. So that was the reason why I sent the first e-mail because I could see this case change, but not the smallest. But if this is the fix well I'll run with it and lets see case statement switch the highlight of the performance.
Thanks again.
Gary Tyrna
-
How can you change a menu drop-down menu in a case statement?
Hello
I'm trying a table find vi. This VI will be an existing xml file and once the user has selected access to its equipment, input, output and frequency it put all of these options in a string and search the XML for this exact table name and post it on one screen of output. The problem I have is my entry and exit selection must be a little different depending on the chosen equipment. I thought I could use an instruction box to change the options of selectable input and output, but I ran into snags a lot with it. For whenever I have to put a new drop of entry and exit in the drop-down menu in the case statement, he wants to put a new one in the front (I only want to enter and exit not only three I have two inputs and outputs hidden right now). I think I'm using the wrong case statement... Can someone help change my input and output, selectable options depending on the chosen equipment. Attached is my xml file, Array Find.vi (the original) and table Find_Test.vi (that's what I'm trying to change).
Thank you
dlovell
Hi dlovell,
A few changes in the attached VI:
Requirements/possible Solutions
- When the value of the equipment, do something
- Add the cases to the value of equipment change event
- Do something = decide what channels to write, to change the input and output strings
- Read material value changed
- Decision (case structure)
- Channel (same method as the previous mod)
Hope this helps
-
How to fill a table only if a case statement runs?
Hello. I want to have a while loop with a case statement. When the case is true, it should read the analog data each iteration of the while loop via Daqmx and store these values in a table. If the case is wrong, I don't want to read all the data or to store anything else in the table. When the loop is finished, I want to have this available table to write to a file or something. How can I go about it?
Search for a "shift register. This will hold your data. In the case of fake feed the data in the table back through without change. In the case of true add the new value in the table to "build the table" or even better "subset of the table to replace' for a defined table size.
-
Case statement in the process Page
Request Express 3.2.1.00.11
I put the following code in an anonymous block (will return no error) for a process Page;
BEGIN INSERT INTO DAD_ASSESSMENT_REQUEST ( tenure_id , client_id ) VALUES ( :P10101_TENURE_ID , :P10101_CLIENT_ID ); END;
But when I put a statement case it throws the following error;
1 error has occurred ORA-06550: line 7, column 3: PL/SQL: ORA-01747: invalid user.table.column, table.column, or column specification ORA-06550: line 3, column 1: PL/SQL: SQL Statement ignored
BEGIN INSERT INTO DAD_ASSESSMENT_REQUEST ( tenure_id , client_id , (CASE WHEN (:P10101_MEASURE_OPTION = 'AREA') THEN estimated_area_ha WHEN (:P10101_MEASURE_OPTION = 'LINE') THEN estimated_length_km END) ) VALUES ( :P10101_TENURE_ID , :P10101_CLIENT_ID , :P10101_X ); END;
Why is this code not work and it is possible to use a case statement in a Page Apex process
Concerning
Ben
Benton says:
Request Express 3.2.1.00.11
I put the following code in an anonymous block (will return no error) for a process Page;
- BEGIN
- INSERT
- IN DAD_ASSESSMENT_REQUEST
- (tenure_id
- client_id
- )
- VALUES
- (: P10101_TENURE_ID)
- ,: P10101_CLIENT_ID
- );
- END;
But when I put a statement case it throws the following error;
- 1 error has occurred
- ORA-06550: line 7, column 3: PL/SQL: ORA-01747: specification user.table.column, table.column or invalid column ORA-06550: line 3, column 1: PL/SQL: statement ignored
- BEGIN
- INSERT
- IN DAD_ASSESSMENT_REQUEST
- (tenure_id
- client_id
- (CASE
- WHEN (: P10101_MEASURE_OPTION = 'SPACE') THEN estimated_area_ha
- WHEN (: P10101_MEASURE_OPTION = 'LINE') THEN estimated_length_km
- END)
- )
- VALUES
- (: P10101_TENURE_ID)
- ,: P10101_CLIENT_ID
- ,: P10101_X
- );
- END;
Why is this code not work and it is possible to use a case statement in a Page Apex process
Of course, it is possible to use a CASE statement or expression (it is the latter) in a page APEX process. However, it is not possible to use an invalid syntax while doing so. Part of a clause INSERT INTO can contain only static column names.
In general the SQL expressions (and also the bind variable, another cause frequent errors of syntax) can be used only in
- the projections of the SELECT queries and subqueries
- the right side of the disposals in the SET update clause
- the lists of VALUES of INSERTs
- WHERE clause predicates
ReemaPuri wrote:
Try this
INSERT
IN DAD_ASSESSMENT_REQUEST
(tenure_id
client_id
estimated_area_ha
estimated_length_km
)
VALUES
(: P10101_TENURE_ID)
,: P10101_CLIENT_ID
, (SELECT CASE WHEN: P10101_MEASURE_OPTION = 'SPACE' AND THEN: P10101_X)
OTHERWISE, NULL END OF DOUBLE)
, (SELECT CASE WHEN: P10101_MEASURE_OPTION = 'LINE' THEN: P10101_X)
OTHERWISE, NULL END OF DOUBLE)
);
It's a good idea, but it can be simplified, eliminating unnecessary subqueries:
insert into dad_assessment_request ( tenure_id , client_id , estimated_area_ha , estimated_length_km) values ( :p10101_tenure_id , :p10101_client_id , case when :p10101_measure_option = 'AREA' then :p10101_x end , case when :p10101_measure_option = 'LINE' then :p10101_x end);
-
Join the results of a case statement
Hello everyone;
I can't with a query where I use a case statement to create a new column and attempt to reach an additional table on the resulting column. I am fairly new to this and learn by trial and error, so if you think that it looks a little ugly or ineffective, I won't be offended. It is used on my interface based on the web of companies, while I am not able to answer some basic questions such as the version of db.
My need to use the case statement is the result of some strange methods and somewhat contradictory in order to link the product subcodes (sku, fcsku, fnsku), to a product code parent (ProdID). In this case, the inventory is stored in the first table with one of the few types of premises SKUs, however the dimensional data only links to the ProdID. I'm trying to instruction box allows to send the parent a second table (ProdID) code if the sku is there, or a third table if it is found on this table. The main reason (in this case) I have to this ProdID is I can join the dimensional data of a fourth table.
My current query:
SELECT / * + USE_HASH (dbin, sku, xProdID, msr) * /.
dbin.snapshot_date, dbin.bin_id, dbin. ISBN,
CASE WHEN sku. ProdID IS NULL THEN xProdID.ITEM_AUTHORITY_ID
Of ANOTHER sku. ProdID
END ProdIDMaster,
dbin. OWNER, dbin. QUANTITY, dbin. CONTAINER_ID,
MSR. HEIGHT, msr. WIDTH, msr. LENGTH, msr. WEIGHT, msr. DIMENSIONAL_UOM, msr. WEIGHT_UOM,
MSR. HEIGHT * msr. WIDTH * msr. LENGTH as a Volume
OF D_BIN_ITEMS dbin
SKU of LEFT JOIN O_FCSKUS ON dbin. ISBN = sku. FCSKU
LEFT JOIN (SELECT * FROM D_FNSKU_ProdID_MAP)
WHERE REGION_ID = 1
AND SNAPSHOT_DAY = TO_DATE('{RUN_DATE_YYYY/MM/DD}','YYYY/MM/DD')) xProdID
ON dbin. ISBN = xProdID.FULFILLMENT_NETWORK_SKU
LEFT JOIN (SELECT * FROM D_MP_ProdID_PKG_MEASUREMENTS)
WHERE REGION_ID = 1 AND MARKETPLACE_ID = 1 AND PACKAGE_TYPE_ID = 1) msr
ON ProdIDMaster = msr. ProdID
WHERE dbin. WAREHOUSE_ID = "PHL5."
AND dbin. Snapshot_date = TO_DATE('{RUN_DATE_YYYY/MM/DD}','YYYY/MM/DD')
AND dbin.bin_id like '% P-1-R '.
ORDER BY dbin.bin_id;
The error I receive:
Statement 1 is invalid. ORA-00904: "ProdIDMaster": invalid identifier
ProdIDMaster appears only in two places, an alias for the case statement, as well as a side of the join statement. If I simply change the alias name, it has no effect, so I can only assume the question is how I refer to results of the case statement. I also tried to reach the word 'CASE', which returned "1 statement is not valid. "ORA-00904:"The MATTER": invalid identifier.
Any help or advice would be greatly appreciated.
Post edited by: 8ea4344e-80ea-44e7-b8ac-d482be7245a7 I made a mistake when I posted the code. The ProdID_ID shown in the join should have been ProdIDMaster. I need to change this due to the fact that the name of the column used (which is what I based my alias on) may have been considered confidential information. All the other columns names remained unchanged.
Hello
8ea4344e-80EA-44e7-B8AC-d482be7245a7 wrote:
Hello everyone;
I can't with a query where I use a case statement to create a new column and attempt to reach an additional table on the resulting column. I am fairly new to this and learn by trial and error, so if you think that it looks a little ugly or ineffective, I won't be offended. It is used on my interface based on the web of companies, while I am not able to answer some basic questions such as the version of db.
My need to use the case statement is the result of some strange methods and somewhat contradictory in order to link the product subcodes (sku, fcsku, fnsku), to a product code parent (ProdID). In this case, the inventory is stored in the first table with one of the few types of premises SKUs, however the dimensional data only links to the ProdID. I'm trying to instruction box allows to send the parent a second table (ProdID) code if the sku is there, or a third table if it is found on this table. The main reason (in this case) I have to this ProdID is I can join the dimensional data of a fourth table.
My current query:
SELECT / * + USE_HASH (dbin, sku, xProdID, msr) * /.
dbin.snapshot_date, dbin.bin_id, dbin. ISBN,
CASE WHEN sku. ProdID IS NULL THEN xProdID.ITEM_AUTHORITY_ID
Of ANOTHER sku. ProdID
END ProdIDMaster,
dbin. OWNER, dbin. QUANTITY, dbin. CONTAINER_ID,
MSR. HEIGHT, msr. WIDTH, msr. LENGTH, msr. WEIGHT, msr. DIMENSIONAL_UOM, msr. WEIGHT_UOM,
MSR. HEIGHT * msr. WIDTH * msr. LENGTH as a Volume
OF D_BIN_ITEMS dbin
SKU of LEFT JOIN O_FCSKUS ON dbin. ISBN = sku. FCSKU
LEFT JOIN (SELECT * FROM D_FNSKU_ProdID_MAP)
WHERE REGION_ID = 1
AND SNAPSHOT_DAY = TO_DATE('{RUN_DATE_YYYY/MM/DD}','YYYY/MM/DD')) xProdID
ON dbin. ISBN = xProdID.FULFILLMENT_NETWORK_SKU
LEFT JOIN (SELECT * FROM D_MP_ProdID_PKG_MEASUREMENTS)
WHERE REGION_ID = 1 AND MARKETPLACE_ID = 1 AND PACKAGE_TYPE_ID = 1) msr
ON ProdIDid_ID = msr. ProdID
WHERE dbin. WAREHOUSE_ID = "PHL5."
AND dbin. Snapshot_date = TO_DATE('{RUN_DATE_YYYY/MM/DD}','YYYY/MM/DD')
AND dbin.bin_id like '% P-1-R '.
ORDER BY dbin.bin_id;
The error I receive:
Statement 1 is invalid. ORA-00904: "ProdIDMaster": invalid identifier
ProdIDMaster appears only in two places, an alias for the case statement, as well as a side of the join statement. If I simply change the alias name, it has no effect, so I can only assume the question is how I refer to results of the case statement. I also tried to reach the word 'CASE', which returned "1 statement is not valid. "ORA-00904:"The MATTER": invalid identifier.
Any help or advice would be greatly appreciated.
Whenever you have a problem, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) of all the tables involved, so that people who want to help you can recreate the problem and test their ideas.
Also post the exact results you want from this data, as well as an explanation of how you get these results from these data, with specific examples.
Always say what version of Oracle you are using (for example, 11.2.0.2.0). Use "SELECT * VERSION of $ v;" to get it.
See the FAQ forum: Re: 2. How can I ask a question on the forums?
When you define an alias for column (such as PriodIDMaster) in the SELECT a query clause, you can use the alias in the ORDER byclause in this request, but this is the only place in this same query, where you can use it. If you want to use anywhere, like in a join condition, then calculate the new column in a subquery; then you can use it anywhere you want in a Super request.
I see expression BOX (not the same as a declarationBOX) where when ProdIDMaster is defined, but I do not see where it is used. Are you sure that you posted the code that is causing the problem?
-
Hello
I am trying to use a global variable 'Global.test' in my ODI "pkg_test" package and step declaration type as a variable that is defined with the value 1 when my package evaluates the condition successfully run and with 0 if the fails.now condition I will carry out the same "pkg_test" package in my load "LP_TEST" and using the variable 'Global.test' Plan as a case statement in terms of load "LP_TEST".
It's workload Odi is unable to understand the value of the variable 'Global.test', which is defined in my pkg 'pkg_test' and my case statement is put down in my care Plan.
Thank you
Hi Santosh Pradhan,
What kind of story do you have in your variable?
If you have not selected any antecedent, the scope of the variable is limited to the session. As the execution of the package is a session in its own (independent of the workload performance), the value of the variable is not accessible after his execution.
You can also try assigning / updating of the value of the variable directly from your plan, instead of in the package:
It will be useful.
Best regards
JeromeFr
Maybe you are looking for
-
I just bought a laptop Satellite T210-10Z while in a trip to Europe. The keyboard, however, the doesn´t work fine. The letters * ', 'j', 'u' * and number * '7' * does not apear on the screen after we press one of them.They will apear on the screen, i
-
Z400: Z400 firewire pinout of the connector?
I noticed that the connector on the front panel 1394 connector 12 pin rather than the standard 10 pin. Does anyone know the pinout? It is not in the maintenance manual. Thank you!
-
I get error 2503 and 2502 when I try to install or to update most of my programs
Update itunes, blackberrydesktop, lightroom etc problems. facilities get all the way to the end and then fail. I checked the permissions in the installation folder, it is set correctly. Windows and my antivirus are able to install updates. I downlo
-
Question on phone blackBerry Smartphones
I bought my 8820 on EBay, the seller sold me a refurb phone, but there was no SD metal piece on the back, is there a place I canjust buy this part?
-
I have a problem with the user account control restricting printing.
Original title: problem of UAC Restriction... In fact, this problem only occurs on Windows 7 / Vista including our field is now progressing to it. The problem is that we still use an OLD way for ourselves print documents by a former software which wi