Case statement in the dynamic JavaScript code
Dear friends,
Using the version 4.2.6
I applied this code in dynamic action to change the color of the intractive report rows of base on the State of the column.
In my report, I have three columns VIP_GUEST, CANCEL_FLG, APPROVE_FLG.
If cancel_FLG = "Y", then the color of the line should be red.
IF VIP_GUEST = 'Y' AND CANCEL_FLG = 'n' then line color should be Orange
If VIP_GUEST = 'n' AND CANCEL_FLG = 'n' then line color should be green
How can I set the conditions in the code below. From ways below how to use the above code condtions.
{$('td[headers="VIP_GUEST"]').each (function ()} | |
If ($(this) () .text = ' don't) {} | |
$(this) .find ('td').css({"background-color":"#FFFF99"});).closest('tr') | |
} ElseIf ($(this) () .text = 'Y') {} | |
$(this) .find ('td').css({"background-color":"#EEA196"});).closest('tr') | |
} else {} | |
$(this) .find ('td').css({"background-color":"#C6EA91"});).closest('tr') | |
} | |
}); |
Hi Maxence,
CORINE wrote:
I changed condition in your code, and I have to set a condition more
IF VIP = 'Y' AND APPROVAL = 'Y', THEN the color should be orange, once again.
How can I set this condition in the code below.
Try the following code:
$('td[headers="CANCEL_FLG"]').each(function() { if ( $(this).text() === 'Y' ) { $(this).closest('tr').find('td').css({"background-color":"red"}); } else if ( $(this).text() === 'N' ) { var vipflg = $(this).closest('tr').find('td[headers="VIP_GUEST"]').text(); var aprflg = $(this).closest('tr').find('td[headers="APPROVED_FLG"]').text(); if ( vipflg === 'Y' && aprflg === 'Y' ) { $(this).closest('tr').find('td').css({"background-color":"orange"}); } else if ( vipflg === 'N' ) { $(this).closest('tr').find('td').css({"background-color":"green"}); } } });
Kind regards
Kiran
Tags: Database
Similar Questions
-
Tuning - using the CASE statement in the WHERE clause of the query
Hi all
My request has been changed to use a CASE statement in the WHERE clause to examine the data to some columns based on a parameter value. This modified request is made a full table and constantly running scan. Please suggest what can be done to improve its performance:
Query:
Description of the table:SELECT LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))) AS summary_date, os.acctnum, os.avieworigin_refid, COUNT(1) cnt_articleview, SUM(NVL(autocompletedterm,0)) cnt_autocompletedterm FROM TABLE1 os WHERE os.acctnum IS NOT NULL AND os.avieworigin_refid IS NOT NULL AND os.requestdatetime IS NOT NULL AND UPPER(os.success_ind) = 'S' AND CASE WHEN Param_ValueToCheck = 'FULL' AND get_date_timestamp(os.requestdatetime) BETWEEN TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') THEN 1 WHEN Param_ValueToCheck = 'INCR' AND os.entry_createddate BETWEEN TO_DATE('01-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('31-MAY-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') THEN 1 END = 1 AND CASE WHEN Param_ValueToCheck = 'FULL' AND os.entry_CreatedDate BETWEEN TO_DATE('01-APR-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') AND TO_DATE('07-JUN-2011 00:00:00','DD-MON-YYYY HH24:MI:SS') THEN 1 WHEN Param_ValueToCheck = 'INCR' THEN 1 END = 1 GROUP BY LAST_DAY(TRUNC(TO_TIMESTAMP(os.requestdatetime, 'yyyymmddhh24:mi:ss.ff4'))), os.acctnum,os.avieworigin_refid;
(Number of lines: approx. > amount 600 000 000)
Explain PlanName Null Type ------------------------------ -------- ------------ ARTICLEID NOT NULL NUMBER(20) USERKEY NUMBER(10) AVIEWORIGIN_REFID VARCHAR2(10) SUCCESS_IND VARCHAR2(2) ENTRY_CREATEDDATE DATE CREATED_BY VARCHAR2(10) FILENUMBER NUMBER(10) LINENUMBER NUMBER(10) ACCTNUM VARCHAR2(10) AUTOCOMPLETEDTERM NUMBER(2) REQUESTDATETIME VARCHAR2(19)
Published by: Chaitanya on June 9, 2011 02:44SQL> select * from table(dbms_xplan.display); PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Plan hash value: 2224314832 ---------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | Pstart| Pstop | ---------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 590 | 33040 | 2501K (1)| 08:20:15 | | | | 1 | HASH GROUP BY | | 590 | 33040 | 2501K (1)| 08:20:15 | | | | 2 | PARTITION RANGE ALL| | 590 | 33040 | 2501K (1)| 08:20:15 | 1 |1048575| |* 3 | TABLE ACCESS FULL | TABLE1 | 590 | 33040 | 2501K (1)| 08:20:15 | 1 |1048575| ---------------------------------------------------------------------------------------------------------- PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 3 - filter(UPPER("OS"."SUCCESS_IND")='S' AND CASE WHEN ('FULL'='FULL' AND "OS"."ENTRY_CREATEDDATE">=TO_DATE(' 2011-04-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "OS"."ENTRY_CREATEDDATE"<=TO_DATE(' 2011-06-07 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 WHEN 'FULL'='INCR' THEN 1 END =1 AND "OS"."REQUESTDATETIME" IS NOT NULL AND CASE WHEN ('FULL'='FULL' AND "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")>=TO_DATE(' 2011-05-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "ODS"."GET_DATE_TIMESTAMP"("REQUESTDATETIME")<=TO_DATE(' 2011-05-31 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 WHEN ('FULL'='INCR' AND "OS"."ENTRY_CREATEDDATE">=TO_DATE(' 2011-05-01 00:00:00', 'syyyy-mm-dd hh24:mi:ss') AND "OS"."ENTRY_CREATEDDATE"<=TO_DATE(' PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2011-05-31 00:00:00', 'syyyy-mm-dd hh24:mi:ss')) THEN 1 END =1 AND "OS"."ACCTNUM" IS NOT NULL AND "OS"."AVIEWORIGIN_REFID" IS NOT NULL)
Published by: Chaitanya on June 9, 2011 02:47When it is executed individually, MERGE LOGIC 1 and LOGIC of MERGE 2 take about ten for a daterange of 30 days data.
BUT FULL is to get the scores of APR - JUN, INCR becomes partitions for MAY so not both 30 days.
Are compare us like with like? -
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);
-
Case statement in the SQL Query prompt dashboard
Hi Experts,
I use the following case statement to generate default values in the prompt dashboard based on a condition (the other guest-generated values). Below are two of the query I've tried and the syntax error. I tried all the possibilities (like giving apostrophes, double quotes, don't quote not etc.), but could not understand the question. Don't know what exactly I'm missing here.
Query 1:
SELECT
CASE
WHEN @{PRType} = monthly THEN 'Participant pay '. "" Amount of PayRate "="15000"
WHEN @{PRType} = daily THEN 'Participant pay '. "" Amount of PayRate "="650"
WHEN @{PRType} = hourly THEN 'Participant pay '. "" Amount of PayRate "="1"
ELSE ' 0'
END
OF 'PA-Participant pay. '
Query 2:
SELECT
CASE
WHEN @{PRType} = monthly THEN "15000"
WHEN @{PRType} = daily THEN "650"
@{PRType} = schedule THEN '1'
ELSE ' 0'
END
OF 'PA-Participant pay. '
This is the query that is generated in the log with error message file.
1 log message:
SELECT CASE WHEN Hourly = Monthly THEN "Participant Payroll"."Payrate Amount" = '15000' WHEN Hourly = Daily THEN "Participant Payroll"."Payrate Amount" = '650' WHEN Hourly = Hourly THEN "Participant Payroll"."Payrate Amount" = '1' ELSE '0' END FROM "PA-Participant Payroll"
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 27002] Near <>=: Syntax error [nQSError: 26012]. (HY000)
Comment 2:
;CASE WHEN To_Char (Hourly) = 'Hourly' THEN 1 ELSE 0 END
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 27002] Near <>(): syntax error [nQSError: 26012]. (HY000)
Sorry, I wasn't clear... you must always put this CASE statement in a valid SQL SELECT statement.
SELECT
CASE
When ' @{PRType}' = 'Monthly' THEN '15000'
When ' @{PRType}' = 'Daily' THEN '650'
ELSE '0' END
OF 'PA-Participant pay. '
-
Help: How to use the Case statement in the ODI11g Interface?
Hello
My basic source I get 'Year' values and I want that these values result code in the interface and after translation want to push on the target system.
Example:
Database source, I get value for
Year
2010
2011
2012
When I get the year 2010 I want to change the value in "FY10".
When I get year 2011 I want to change the value in "FY11.
and even for the year 2012 to "FY12.
I've tried to make the Case statement, but had no success.
I don't want to create the lookup table in the source system.
Any help in this matter.
Thank you
Concerning
Sher
Published by: Sher Ullah Baig on August 26, 2012 17:52CASE
WHEN source_column = '2010' THEN 'FY10.
WHEN source_column = '2011' and THEN 'FY11.
WHEN source_column = '2012' and THEN 'FY12.
END -
Case statement in the filter responses
Hello
I'm trying to build a query in the replies that filter the returned data based on the number of current month. If the current month is 1 then we want to show every 12 months, we want to show under the current months months. If I use the following:
Excerpt from WHEN (month of current_date) - CASE = 1 THEN 'calculated monthly values. "" MONTH "> = 1 ELSE 'calculated monthly values. "" MONTH "< extracted (current_date months) END
I get the error below. Everything works fine until I have add the CASE.
Error codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
Geographical area: saw.views.evc.activate, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool, saw.threadpool, saw.threads
ODBC driver returned an error (SQLExecDirectW).
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 27002] Near <>= >: syntax error [nQSError: 26012]. (HY000)
You can use a case statement in a filter? If not, what are the other options, as appropriate?
THXziekc wrote:
HelloI'm trying to build a query in the replies that filter the returned data based on the number of current month. If the current month is 1 then we want to show every 12 months, we want to show under the current months months. If I use the following:
Excerpt from WHEN (month of current_date) - CASE = 1 THEN 'calculated monthly values. "" MONTH "> = 1 ELSE 'calculated monthly values. "" MONTH ".< extract="" (month="" from="" current_date)="">
I get the error below. Everything works fine until I have add the CASE.
Error codes: YQCO4T56:OPR4ONWY:U9IM8TAC:OI2DL65P
Geographical area: saw.views.evc.activate, saw.httpserver.processrequest, saw.rpc.server.responder, saw.rpc.server, saw.rpc.server.handleConnection, saw.rpc.server.dispatch, saw.threadpool, saw.threadpool, saw.threads
ODBC driver returned an error (SQLExecDirectW).
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 43113] The message returned by OBIS. [nQSError: 27002] Near <> =>: syntax error [nQSError: 26012]. (HY000)You can use a case statement in a filter? If not, what are the other options, as appropriate?
THX
Depending on your needs, when the month is January, you want every 12 months. any other number and you want the month 1 "1 less than the number this month. Yes? Here's what to do:
In the filter on your date column, click the filter button, convert it to SQL and enter the following:
MONTH (TableName.date_column) BETWEEN 1 AND CASE WHEN MONTH (CURRENT_DATE) = 1-12 THEN end of MONTH else (CURRENT_DATE)-1
Here's the logic:
(a) when the month is January, and then the case statement will give 12 and the filter will be:
WHERE the MONTH (tablename.date_column) BETWEEN 1 AND 12... .or every 12 months.
(b) when the current month is any month, say June, then the case statement will give a less than is the number of months, or in this case, 5.
WHERE the MONTHS (tablename.date_column BETWEEN 1 AND 5 .or every 1 to 5 months (January to may))
This will give you what you want...
-
I can't get the CASE statement to work on my 39gII. Anyone else out there there is a bit of luck? I keep getting syntax errors.
It does not in the current official version of Setpbember.
-
case statement in the dynamics
I have the following statement in the procedure.
I need TO CHECK WHEN the USER PASSES in VALUES for P_IN_SERVICE THE CORRESPONDING SELECT STATEMENT SHOULD BE ADDED to the WHERE CLAUSE OF stmt.
Please see below for p_inservice_date is the input to the procedure parameter.
When P_IN_SERVICE = "IN_SERVICE", then add the correspondent and the statement.
The user can move all the value to p_in_service
The list of p_in_service values are 'IN_SERVICE', 'NOT YET in service', 'All PROJECTS'
How can I achieve and attached to stmt. and what is the problem with my request.
Published by: 893185 on November 29, 2011 23:53stmt := 'SELECT DISTINCT pta.project_id project_id, pta.project_number project_number, pta.project_name project_name, pta.task_id TASK_ID, pta.Task_number TASK_NUMBER, pta.task_name TASK_NAME, pta.award_id AWARD_ID, pta.award_number AWARD_NUMBER, pta.award_short_name AWARD_SHORT_NAME FROM xxdl.xxdl_cd_pta_all pta WHERE pta.task_id =pta.top_task_id AND pta.cd_proj_type=''Y'' '; IF P_IN_SERVICE IS NOT NULL THEN stmt := stmt || CASE WHEN P_IN_SERVICE = 'IN_SERVICE' THEN ' AND (pta.project_id,pta.task_id,pta .award_id in (SELECT d.project_id,d.task_id,d.award_id FROM xxdl.xxdl_cd_debt_item d,XXDL.xxdl_cd_amortization_status s WHERE d.debt_id = s.debt_id AND s.active = ''Y'' AND s.amortization_status not in (''CIP'',''NONE'')) ' WHEN P_IN_SERVICE = 'NOT YET IN-SERVICE' THEN ' AND (pta.project_id,pta.task_id,pta .award_id in (SELECT d.project_id,d.task_id,d.award_id FROM xxdl.xxdl_cd_debt_item d,XXDL.xxdl_cd_amortization_status s WHERE d.debt_id = s.debt_id AND s.active = ''Y'' AND s.amortization_status in (''CIP'',''NONE'')) ' WHEN P_IN_SERVICE = 'ALL PROJECTS' THEN ' AND (pta.project_id,pta.task_id,pta .award_id in (SELECT d.project_id,d.task_id,d.award_id FROM xxdl.xxdl_cd_debt_item d,XXDL.xxdl_cd_amortization_status s WHERE d.debt_id = s.debt_id AND s.active = ''Y''' ELSE ' ' END; END IF;
What is the error message?
check that it works for me...CREATE OR REPLACE PROCEDURE test_proc (P_IN_SERVICE IN VARCHAR2, OUT Varchar2 query)
AS
stmt varchar2 (4000);
Start
stmt: = "SELECT DISTINCT pta.project_id project,
PTA.project_number numero_projet,
PTA. PROJECT_NAME project_name,
PTA. TASK_ID TASK_ID,
PTA. Task_number TASK_NUMBER,
PTA.task_name TASK_NAME,
PTA.award_id AWARD_ID,
PTA.award_number AWARD_NUMBER,
PTA.award_short_name AWARD_SHORT_NAME
OF xxdl.xxdl_cd_pta_all pta
WHERE pta.task_id = pta.top_task_id
AND pta.cd_proj_type = "Y" ';
IF P_IN_SERVICE IS NOT NULL THEN
stmt: = stmt. CASE WHEN P_IN_SERVICE = 'IN_SERVICE' THEN ' AND (pta.project_id, pta.task_id, pta .award_id in (SELECT d.project_id, d.task_id, d.award_id
OF xxdl.xxdl_cd_debt_item d, XXDL.xxdl_cd_amortization_status s
WHERE d.debt_id = s.debt_id
AND s.active = "Y"
AND s.amortization_status not in ("PEAK", "NONE")) '
WHEN P_IN_SERVICE = 'NOT YET in service' THEN ' AND (pta.project_id, pta.task_id, pta .award_id in (SELECT d.project_id, d.task_id, d.award_id
OF xxdl.xxdl_cd_debt_item d, XXDL.xxdl_cd_amortization_status s
WHERE d.debt_id = s.debt_id
AND s.active = "Y"
AND s.amortization_status in ("PEAK", "NONE")) '
WHEN P_IN_SERVICE = 'All THE PROJECTS' THEN "AND (pta.project_id, pta.task_id, pta .award_id in (SELECT d.project_id, d.task_id, d.award_id
OF xxdl.xxdl_cd_debt_item d, XXDL.xxdl_cd_amortization_status s
WHERE d.debt_id = s.debt_id
AND s.active = "Y" '
ELSE ' ' END;END IF;
dbms_output.put_line (stmt);
end;--------------------
-
How to pass the Record of entry to the dynamic SQL Code
Hi all
I am trying to run under Oracle applications API on the remote database using DB Link. I try to run using dynamic SQL. Part of the code is given below.
DECLARE
l_batch_info_rec wsh_picking_batches_pub.batch_info_rec;
l_rule_id NUMBER;
l_rule_name VARCHAR2 (240);
l_batch_prefix VARCHAR2 (240);
BEGIN
l_batch_info_rec.document_set_id: = v_document_set_id;
l_batch_info_rec.order_type_id: = v_order_type_id;
l_batch_info_rec. Default_Stage_Subinventory: = v_default_stage_subinventory;
l_batch_info_rec.pick_grouping_rule_id: = v_pick_grouping_rule_id;
l_batch_info_rec.pick_sequence_rule_id: = v_pick_sequence_rule_id;
l_batch_info_rec.autopack_level: = v_autopack_level;
l_batch_info_rec.autopack_flag: = v_autopack_flag;
l_batch_info_rec.ac_delivery_criteria: = v_ac_delivery_criteria;
l_batch_info_rec.backorders_only_flag: = v_backorders_only_flag;
l_batch_info_rec.existing_rsvs_only_flag: = v_existing_rsvs_only_flag;
l_batch_info_rec.customer_id: = v_customer_id;
l_batch_info_rec.order_header_id: = v_header_id;
l_batch_info_rec.from_scheduled_ship_date: = NULL;
l_batch_info_rec.organization_id: = v_organization_id;
l_batch_info_rec.include_planned_lines: = v_include_planned_lines;
l_batch_info_rec.autocreate_delivery_flag: = v_autocreate_deliveries_flag;
l_batch_info_rec.autodetail_pr_flag: = v_autodetail_pr_flag;
l_batch_info_rec.allocation_method: = 'I ';
l_batch_info_rec.pick_from_locator_id: = NULL;
l_batch_info_rec.auto_pick_confirm_flag: = 'n'; -The value manually to run Transact order
l_batch_info_rec.autopack_flag: = 'n'; -Manually configure to perform the manual packaging
l_rule_id: = NULL;
l_rule_name: = NULL;
l_batch_prefix: = NULL;
v_sqlstmt1: = ' START
wsh_picking_batches_pub.create_batch' | g_db_link | "(1.0,
fnd_api.g_true,
fnd_api.g_true,
: l_return_status,.
: l_msg_count,.
: l_msg_data,.
: l_rule_id,.
: l_rule_name,.
: l_batch_info_rec,.
: l_batch_prefix,.
: p_new_batch_id
);
END;';
--
EXECUTE IMMEDIATE V_sqlstmt1
With the HELP OF THE l_return_status,.
ON l_msg_count,.
ON l_msg_data,.
BY l_rule_id,
BY l_rule_name,
BY l_batch_info_rec,
BY l_batch_prefix,
OUT p_new_batch_id;
--
END;
After you run this script, I get below error "PLS-00457: expressions must be SQL types ' for variable l_batch_info_rec which is of type record. can someone please guide me how can I pass variable type dynamic SQL record.
Thank you
Priyanka
Food for thought:
On remote db:
SQL > create or replace
package 2 pkg
3 is
4 type r_type is (record
Number 5,
6 name varchar2 (10)
7 );
(p) 8 procedure
9 p_rec in r_type,
10 p_out out varchar2
11 );
12 end;
13.Package created.
SQL > create or replace
package 2 body pkg
3 is
4 procedure p)
5 p_rec in r_type,
6 p_out out varchar2
7 )
8 is
9 start
10 p_out: = "ID = ' |" p_rec.ID | 'Name =' | p_rec. Name;
11 end;
12 end;
13.Package body created.
SQL >
On local db:
SQL > set serveroutput on
SQL > declare
v_rec 2 pkg.r_type@pdb1sol12;
3 v_out varchar2 (50);
4 start
v_rec.ID 5: = 1;
6 v_rec.name: = 'XXX ';
7 immediate execution"
8 begin
9 pkg.p@pdb1sol12 (: 1,: 2);
10 end;'
11 using v_rec,
12 v_out;
13 dbms_output.put_line (v_out);
14 end;
15.
using v_rec;
*
ERROR on line 11:
ORA-06550: line 11, column 20:
PLS-00457: expressions must be SQL types
ORA-06550: line 7, column 5:
PL/SQL: Statement ignoredSQL > declare
2 number of v_id: = 1;
3 v_name varchar2 (10): = 'XXX ';
4 v_out varchar2 (50);
5. start
6 immediate execution"
7 report
8 v_rec pkg.r_type@pdb1sol12.
9 begin
10 v_rec.id := :1;
11 v_rec.name: =: 2;
12 pkg.p@pdb1sol12 (v_rec,: 3);
13 end;'
14 using v_id,
15 in v_name,
16 v_out;
17 dbms_output.put_line (v_out);
18 end;
19.
ID = 1 name = XXXPL/SQL procedure successfully completed.
SQL >
SY.
-
The information of the SMART State indicates the status 0000 code h.
What excatly doesSMART state information indicate means to 0000 h status code? Can I replace the hard drive? I got this Pc a year and a few days. I have a HP Pavilion P6000 model is p6517c.
Hello
You could also try F2 or F10 option, and then run the HARD drive test.
-
case statement and the problem posed by the...
Hello..
Here is the code I use in my pl/sql anonymous block:
I want to do something like this:DECLARE X555 NUMBER; P1_X2 varchar2(10) := to_char(sysdate, 'dd.mm.yyyy'); BEGIN case when P1_X2 = to_char('sunday') then SELECT COUNT(*) into X555 FROM biwh.ORGANIZ Tbl WHERE SAM_FORMA IN ('16') and IDEN_N_TAR in to_date(/*:*/P1_X2, 'dd.mm.yyyy')-3; else SELECT COUNT(*) into X555 FROM biwh.ORGANIZ Tbl WHERE SAM_FORMA IN ('16') and IDEN_N_TAR in to_date(/*:*/P1_X2, 'dd.mm.yyyy')-1; end case; dbms_output.put_line(X555); end;
If it's Sunday, leave this part of the labour code:
can you tell me the correct syntax of the code? where did I did mystake?SELECT COUNT(*) into X555 FROM biwh.ORGANIZ Tbl WHERE SAM_FORMA IN ('16') and IDEN_N_TAR in to_date(/*:*/P1_X2, 'dd.mm.yyyy') -3;
SRY for my English...P1_X2 varchar2(10) := to_char(sysdate, 'dd.mm.yyyy'); BEGIN case when P1_X2 = to_char('sunday')
In the light of the foregoing, you set P1_X2 to a string value that resembles '05.10.2009' and then try to compare it to a string that looks like "Sunday".
I'd be tempted to define P1_X2 as a DATE, then check against that for example
p1_x2 DATE := trunc(SYSDATE); BEGIN CASE TO_CHAR(p1_x2,'fmday') WHEN 'sunday' THEN SELECT COUNT(*) INTO x555 FROM biwh.organiz tbl WHERE sam_forma IN ('16') AND iden_n_tar = p1_x2 - 3; ELSE SELECT COUNT(*) INTO x555 FROM biwh.organiz tbl WHERE sam_forma IN ('16') AND iden_n_tar = p1_x2 - 1; END CASE;
The above assumes that you store iden_n_tar as a 'date at midnight '.
You could go further and have a single query that moves from the "cause" of the where clause:
SELECT COUNT(*) INTO x555 FROM biwh.organiz tbl WHERE sam_forma IN ('16') AND iden_n_tar = p1_x2 - CASE TO_CHAR(p1_x2,'fmday') WHEN 'sunday' THEN 1 ELSE 3 END;
-
Why can't the 'Stop' javascript code snippet work over different periods?
Hi all
I am a newbie to Adobe animate and I have absolutely no background in writing code or anything, and I need your help. The solution is probably obvious to experts like you all, but not for beginners me.
I'm trying to create an interactive infographic in Adobe animate CC using the HTML Canvas format. I want to create interactive buttons that will reveal more information when clicked. I have no difficulty to create buttons and I gave them instance names and all that, but I can only do the first work. The rest of them does not work although I made sure to correct the frame number. What I am doing wrong?Happy that you guessed it work.
It's one of the reasons why I prefer picture labels. Alternatively, you can give them to your content more intuitive names, so it is easier to stay organized, and if you change the length of your timeline or rearrange the images, you will not have to change the frame numbers in your code.
-
How to use a "Case" statement in the negative
I am pulling data in the form:
SELECT
group_num,
co_id,
pr_id,
Co_id CASE
WHEN '5N' THEN ON 'YES '.
WHEN NOT '5N' THEN 'NO '.
END AS prod_type
FROM table1
I want to get a 'YES' result when co_id is '5N' and all co_id who are not '5N' a value of 'NO '...
I get an error "Missing Expression" and its pointing to the line 'IS NOT', so I obviously don't have the correct syntax.
Any help would be appreciated...
Published by: user12296489 on November 10, 2010 11:22Hello
You're right: CASE can't compare NULL in the same way, it compares the values. My mistake.
I think that the searched CASE expression is what is needed here:
CASE WHEN co_id = '5N' THEN 'YES' WHEN co_id != '5N' THEN 'NO' END AS prod_type
If co_id is NULL, it returns null.
-
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?
-
Excel and the CASE statement.
Hello Experts,
I use a CASE statement on the column of CHAR type as follows:
CASE WHEN Sales.Ret = 'Y' THEN 'Return' END of OTHER 'new '.
It gives an error: Odbc driver returned an error (SQLExecDirectW).
Whereas, when I use another CASE statement with column Numrical it works perfectly.
CASE WHEN Sales.Amount < END If NOT 100 40 THEN 40
Am I missing an Excel data source definition related to the CHAR data type?
My source is MS Excel 2003 and OBIEE 10.1.3.4.1
Thank you for any comments, help.
~ Ash
PS: the details of the error are the following:*.
Error codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error occurred. [nQSError: 16001] ODBC error state: 37000 code:-3100 message: error [Microsoft] [ODBC Excel Driver] syntax (missing operator) in query expression ' case when T46. [Retirement] = "Y" then "known" other "new" end "... [nQSError: 16014] Prepare the SQL statement failed. (HY000)
Publ. SQL: SELECT Sales.Tran_date, saw_0, CASE WHEN Sales.Ret = 'Y' THEN 'Return' ELSE 'New' END saw_1, network. "" Network name "saw_2, Sales.Amount saw_3 FROM P4UD ORDER BY saw_0, saw_1, saw_2Sorry, the button is 'Ask DBMS' (biee 10g)
Maybe you are looking for
-
FFox itself updated to version 30 - as happens unfortunately. So far, hit the bookmarks star opens a window on the left with a search engine on the top, and the following list of the bmarks. The search engine has now disappeared, and bmarks list cove
-
WAG320n - can he endure RFC1483 bridged?
Hi all! I have a bit of difficulty to the top of my new WAG320n brilliant as a replacement for my planned ISP modem/router. I'm with Bethere, providing ADSL2 + by using encapsulation, type "RFC 1483 Bridged", but I can't seem to select this mode in t
-
Cannot get two WAP54 connected.
My current setup: [Router modem &]|| UTP cable|[WAP54 #1]|| Wireless connection|[WAP54 #2]|| UTP cable|[Switch]|| UTP cable|[All PC] _____________________________ WAP54 #1 configuration:device name: lswapSSID: corresponds to that of the #2Wireless mo
-
App lingers before closing completely
Hello guys I have an application that displays a list and download images from the Internet, the Image Loader sample-based. I opened the app and it works as expected, until I close itand the BB10 home its icon remains semi transparent for 2 or 3 seco
-
Hi, I switch to the use of the JDE debugger and attach the device. Every time attach the debugger device JDE application to run. For the last two days, I thought that my app or the debugger breaks down, But it is not the case, I press F5 to continue