Problem w/ Case Statement and Video Capture
Hey!
I've got a question about a topic which seems pretty trivial, but has been giving me quite the trouble for some time now. I was hoping that someone on this forum would be able to help me catch and fix my mistake.
Basically what I'm trying to do is capture video from a camera, run some video analysis for a certain duration, and store the raw footage for that same duration in an avi file. I'm using IMAQdx and a Logitech C920 camera to gather video. When I run the program, I want there to be an output of the raw video on the front panel. When I then hit a button, I would like the camera to save a .avi file of the video for a set number of frames and concurrently run some analysis and display the results on another display on the front panel. The purpose of the raw footage in the .avi file is to be able to run the analysis again at a later date.
I've attached both a screenshot and the .vi file to this post. When I run the current script, I'm confronted with one of two possible errors (not sure why they're different from time to time). The Video Acquisition Block either "Time Out"s or the Write to AVI block issues an incompatible image type error. The reason why I'm baffled by this is because when I take it out of the case statement and have it run with the rest of the program, the .avi file is generated accurately and stored.
Any help would be greatly appreciated. Thanks!
Attachments:
Script Image.png 39 KB
11_30_12 TrackVIEW.vi 271 KB
Greetings,
Would the time out error happen every time you run the VI? In addition, do these errors have a code?
I was able to replicate the issue and initially believe that it might be that we are simultaneously opening two sessions to the same camera. Could you simply take a finite number of images from the first acquisition and chain the second one via sequence structure? It would limit the viewer to only view the video on the other Image Display during saving the AVI, but it might be worthwhile looking into.
It might also be worthwhile to consider enquewing a certain number of images whenever the button is pressed, but that would require some more programming logic.
Cordially;
Simon P.
National Instruments
Applications Engineer
Similar Messages
-
CASE STATEMENTS AND CASE EXPRESSIONS IN ORACLE9I PL/SQL
제품 : PL/SQL
작성날짜 : 2001-11-13
CASE STATEMENTS AND CASE EXPRESSIONS IN ORACLE9I PL/SQL
=======================================================
PURPOSE
아래의 자료는 Case 문에서 oracle 8.1.7과 Oracle 9i의 New Feature로 8.1.7에서는
sqlplus 에서만 가능했고, 9i 부터는 pl/sql 까지 가능하다.
Explanation
1. Oracle 8.1.7 Feature
Oracle 8.1.7 에서 Case 문은 Decode 문과 유사하지만, 기존의 decode 문을 쓰는 것보다
더 많은 확장성과 Logical Power와 좋은 성능을 제공한다. 주로 나이와 같이 category 별로
나눌때 주로 사용하고 Syntex는 아래와 같다.
CASE WHEN <cond1> THEN <v1> WHEN <cond2> THEN <v2> ... [ELSE <vn+1> ] END
각각의 WHEN...THEN 절의 argument 는 255 까지 가능하고 이 Limit를 해결하려면
Oracle 8i Reference를 참조하면 된다.
The maximum number of arguments in a CASE expression is 255, and each
WHEN ... THEN pair counts as two arguments. To avoid exceeding the limit of 128 choices,
you can nest CASE expressions. That is expr1 can itself be a CASE expression.
Case Example : 한 회사의 모든 종업원의 평균 봉급을 계산하는데 봉급이 $2000보다 작은경우
2000으로 계산을 하는 방법이 pl/sql을 대신하여 case function을 사용할 수 있다.
SELECT AVG(CASE when e.sal > 2000 THEN e.sal ELSE 2000 end) FROM emp e;
Case Example : 나이를 column으로 가지고 있는 customer table을 예로 들어보자.
SQL> SELECT
2 SUM(CASE WHEN age BETWEEN 70 AND 79 THEN 1 ELSE 0 END) as "70-79",
3 SUM(CASE WHEN age BETWEEN 80 AND 89 THEN 1 ELSE 0 END) as "80-89",
4 SUM(CASE WHEN age BETWEEN 90 AND 99 THEN 1 ELSE 0 END) as "90-99",
5 SUM(CASE WHEN age > 99 THEN 1 ELSE 0 END) as "100+"
6 FROM customer;
70-79 80-89 90-99 100+
4 2 3 1
1 SELECT
2 (CASE WHEN age BETWEEN 70 AND 79 THEN '70-79'
3 WHEN age BETWEEN 80 and 89 THEN '80-89'
4 WHEN age BETWEEN 90 and 99 THEN '90-99'
5 WHEN age > 99 THEN '100+' END) as age_group,
6 COUNT(*) as age_count
7 FROM customer
8 GROUP BY
9 (CASE WHEN age BETWEEN 70 AND 79 THEN '70-79'
10 WHEN age BETWEEN 80 and 89 THEN '80-89'
11 WHEN age BETWEEN 90 and 99 THEN '90-99'
12* WHEN age > 99 THEN '100+' END)
SQL> /
AGE_G AGE_COUNT
100+ 1
70-79 4
80-89 2
90-99 3
Example
2. Oracle 9i Feature
Oracle 9i부터는 pl/sql에서도 case문을 사용할 수 있으면 이것은
복잡한 if-else 구문을 없애고, C언어의 switch문과 같은 기능을 한다.
아래의 9i pl/sql Sample 및 제약 사항을 보면 아래와 같다.
Sample 1:
A simple example demonstrating the proper syntax for a case
statement
using a character variable as the selector. See the section entitled
'Restrictions' at the end of this article for details on which PLSQL
datatypes may appear as a selector in a case statement or
expression.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
declare
achar char(1) := '&achar';
begin
case achar
when 'A' then dbms_output.put_line('The description was Excellent');
when 'B' then dbms_output.put_line('The description was Very Good');
when 'C' then dbms_output.put_line('The description was Good');
when 'D' then dbms_output.put_line('The description was Fair');
when 'F' then dbms_output.put_line('The description was Poor');
else dbms_output.put_line('The description was No such Grade');
end case;
end;
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
Sample 2:
A simple example demonstrating the proper syntax for a case
expression
using a character variable as the selector. See the section entitled
'Restrictions' at the end of this article for details on which PLSQL
datatypes may appear as a selector in a case statement or
expression.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
declare
achar char(1) := '&achar';
description varchar2(20);
begin
description :=
case achar
when 'A' then 'Excellent'
when 'B' then 'Very Good'
when 'C' then 'Good'
when 'D' then 'Fair'
when 'F' then 'Poor'
else 'No such grade'
end;
dbms_output.put_line('The description was ' || description);
end;
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
NOTE: The above simple samples demonstrate two subtle differences in the
syntax
required for case statements and expressions.
1) A case STATEMENT is terminated using the 'end case' keywords; a
case
EXPRESSION is terminated using only the 'end' keyword.
2) Each item in a case STATEMENT consists of one or more
statements, each
terminated by a semicolon. Each item in a case expression
consists of
exactly one expression, not terminated by a semicolon.
Sample 3:
Sample 1 demonstrates a simple case statement in which the selector
is
compared for equality with each item in the case statement body.
PL/SQL
also provides a 'searched' case statement as an alternative; rather
than
providing a selector and a list of values, each item in the body of
the
case statement provides its own predicate. This predicate can be any
valid boolean expression, but only one case will be selected.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
declare
achar char(1) := '&achar';
begin
case
when achar = 'A' then dbms_output.put_line('The description was
Excellent');
when achar = 'B' then dbms_output.put_line('The description was Very
Good');
when achar = 'C' then dbms_output.put_line('The description was
Good');
when achar = 'D' then dbms_output.put_line('The description was
Fair');
when achar = 'F' then dbms_output.put_line('The description was
Poor');
else dbms_output.put_line('The description was No such Grade');
end case;
end;
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
Sample 4:
This sample demonstrates the proper syntax for a case expression of
the
type discussed in Sample 3 above.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
declare
achar char(1) := '&achar';
description varchar2(20);
begin
description :=
case
when achar = 'A' then 'Excellent'
when achar = 'B' then 'Very Good'
when achar = 'C' then 'Good'
when achar = 'D' then 'Fair'
when achar = 'F' then 'Poor'
else 'No such grade'
end;
dbms_output.put_line('The description was ' || description);
end;
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
Sample 5:
This sample demonstrates the use of nested case statements. It is
also
permissable to nest case expressions within a case statement (though
it
is not demonstrated here), but nesting of case statements within a
case
expression is not possible since statements do not return any value.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
declare
anum1 number := &anum1;
anum2 number := &anum2;
answer number;
begin
case anum1
when 1 then case anum2
when 1 then answer := 10;
when 2 then answer := 20;
when 3 then answer := 30;
else answer := 999;
end case;
when 2 then case anum2
when 1 then answer := 15;
when 2 then answer := 25;
when 3 then answer := 35;
else answer := 777;
end case;
else answer := 555;
end case;
dbms_output.put_line('The answer is ' || answer);
end;
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
Sample 6:
This sample demonstrates nesting of case expressions within another
case
expression. Note again the absence of semicolons to terminate both
the
nested case expression and the individual cases of those
expressions.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
declare
anum1 number := &anum1;
anum2 number := &anum2;
answer number;
begin
answer :=
case anum1
when 1 then case anum2
when 1 then 10
when 2 then 20
when 3 then 30
else 999
end
when 2 then case anum2
when 1 then 15
when 2 then 25
when 3 then 35
else 777
end
else 555
end;
dbms_output.put_line('The answer is ' || answer);
end;
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
Although PL/SQL anonymous blocks have been used in all of the examples
so far,
case statements and expressions can also be used in procedures,
functions, and
packages with no changes to the syntax.
The following samples are included for completeness and demonstrate the
use of
case statements and/or expressions in each of these scenarios.
Sample 7:
This sample demonstrates use of a case statement in a stored
procedure.
Note that this sample also demonstrates that it is possible for each
of
the items in the case body to consist of more than one statement.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
create or replace procedure testcasestmt ( anum IN number ) is
begin
case
when anum = 1 then dbms_output.put_line('The number was One');
dbms_output.put_line('In case 1');
when anum = 2 then dbms_output.put_line('The number was Two');
dbms_output.put_line('In case 2');
when anum = 3 then dbms_output.put_line('The number was Three');
dbms_output.put_line('In case 3');
when anum = 4 then dbms_output.put_line('The number was Four');
dbms_output.put_line('In case 4');
when anum = 5 then dbms_output.put_line('The number was Five');
dbms_output.put_line('In case 5');
else dbms_output.put_line('The description was Invalid input');
dbms_output.put_line('In the else case');
end case;
end;
exec testcasestmt(&anum);
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
Sample 8:
This sample demonstrates the use of a case statement in a stored
package.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
create or replace package testpkg2 is
procedure testcasestmt ( anum IN number );
function testcasestmt_f ( anum IN number ) return number;
end testpkg2;
create or replace package body testpkg2 is
procedure testcasestmt ( anum IN number ) is
begin
case
when anum = 1 then dbms_output.put_line('The number was One');
dbms_output.put_line('In case 1');
when anum = 2 then dbms_output.put_line('The number was Two');
dbms_output.put_line('In case 2');
when anum = 3 then dbms_output.put_line('The number was Three');
dbms_output.put_line('In case 3');
when anum = 4 then dbms_output.put_line('The number was Four');
dbms_output.put_line('In case 4');
when anum = 5 then dbms_output.put_line('The number was Five');
dbms_output.put_line('In case 5');
else dbms_output.put_line('The description was Invalid input');
dbms_output.put_line('In the else case');
end case;
end;
function testcasestmt_f ( anum IN number ) return number is
begin
case
when anum = 1 then dbms_output.put_line('The number was One');
dbms_output.put_line('In case 1');
when anum = 2 then dbms_output.put_line('The number was Two');
dbms_output.put_line('In case 2');
when anum = 3 then dbms_output.put_line('The number was Three');
dbms_output.put_line('In case 3');
when anum = 4 then dbms_output.put_line('The number was Four');
dbms_output.put_line('In case 4');
when anum = 5 then dbms_output.put_line('The number was Five');
dbms_output.put_line('In case 5');
else dbms_output.put_line('The description was Invalid input');
dbms_output.put_line('In the else case');
end case;
return anum;
end;
end testpkg2;
exec testpkg2.testcasestmt(&anum);
variable numout number
exec :numout := testpkg2.testcasestmt_f(&anum);
print numout
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
Sample 9:
This sample demonstrates the use of a case expression in a stored
package.
- - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - -
set serveroutput on
create or replace package testpkg is
procedure testcase ( anum IN number );
function testcase_f ( anum IN number ) return number;
end testpkg;
create or replace package body testpkg is
procedure testcase ( anum IN number ) is
anumber number := anum;
anothernum number;
begin
anothernum :=
case
when anumber = 1 then anumber + 1
when anumber = 2 then anumber + 2
when anumber = 3 then anumber + 3
when anumber = 4 then anumber + 4
when anumber = 5 then anumber + 5
else 999
end;
dbms_output.put_line('The number was ' || anothernum);
end;
function testcase_f ( anum IN number ) return number is
anumber number := anum;
anothernum number;
begin
anothernum :=
case
when anumber = 1 then anumber + 1
when anumber = 2 then anumber + 2
when anumber = 3 then anumber + 3
when anumber = 4 then anumber + 4
when anumber = 5 then anumber + 5
else 999
end;
dbms_output.put_line('The number was ' || anothernum);
return anothernum;
end;
end testpkg;
variable numout number
exec testpkg.testcase(&anum);
exec :numout := testpkg.testcase_f(&anum);
print numout
- - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - -
제약 사항
다음의 databasetype은 case 문에서 지원되지 않는다.
BLOB
BFILE
VARRAY
Nested Table
PL/SQL Record
PL/SQL Version 2 tables (index by tables)
Object type (user-defined type)
All of these types except for object types face a similar restriction
even for if statements (i.e. they cannot be compared for equality directly) so this is unlikely to change for these types. Lack of support for object types is simply an implementation restriction which may be relaxed in future releases.
Reference Ducumment
Oracle 8.1.7 Manual
NOTE:131557.1I have done the following code but doesn't
like the statement of - "case(butNext)". What do you mean "doesn't like" -- did you get an error message?
I'm guessing it won't compile because you're trying to switch on a Button.
I tried something
like "g.fillOval(100,50,70,90, BorderLayout.NORTH)"...no that doesn't make sense. You only use BorderLayout.NORTH when you're adding components to a BorderLayout layout manager. An oval is not a component and fillOval isn't adding a component and Graphics is not a Panel or layout manager.
Would appreciate it if someone could tell me how to position
shapes using the graohic method. I think the problem is that you're confusing shapes with components. -
Case statement and Decode function both are not working in Select cursor.
I have tried both the Case statement and Decode function in Select cursor, but both the things are not working. On the other hand both the things work in just select statement.
See the first column in select (PAR_FLAG), I need to have this evaluated along with other fields. Can you please suggest some thing to make this work. And also I would like to
know the reason why decode is not working, I heard some where Case statement do not work with 8i.
Author : Amit Juneja
Date : 06/20/2011
Description:
Updates the Diamond MEMBER_MASTER table with the values from
INC.MEM_NJ_HN_MEMBER_XREF table.
declare
rec_cnt number(12) := 0;
commit_cnt number(4) := 0;
cursor select_cur is
Select DECODE(1,
(Select 1
from hsd_prov_contract R
where R.seq_prov_id = PM.seq_prov_id
and R.line_of_business = H.line_of_business
and R.PCP_FLAG = 'Y'
and R.participation_flag = 'P'
and SYSDATE between R.EFFECTIVE_DATE AND
NVL(R.TERM_DATE,
TO_DATE('31-DEC-9999', 'DD-MON-YYYY'))),
'Y',
'N') PAR_FLAG,
H.SEQ_ELIG_HIST,
H.SEQ_MEMB_ID,
H.SEQ_SUBS_ID,
H.SUBSCRIBER_ID,
H.PERSON_NUMBER,
H.EFFECTIVE_DATE,
H.TERM_DATE,
H.TERM_REASON,
H.RELATIONSHIP_CODE,
H.SEQ_GROUP_ID,
H.PLAN_CODE,
H.LINE_OF_BUSINESS,
H.RIDER_CODE_1,
H.RIDER_CODE_2,
H.RIDER_CODE_3,
H.RIDER_CODE_4,
H.RIDER_CODE_5,
H.RIDER_CODE_6,
H.RIDER_CODE_7,
H.RIDER_CODE_8,
H.MEDICARE_STATUS_FLG,
H.OTHER_STATUS_FLAG,
H.HIRE_DATE,
H.ELIG_STATUS,
H.PREM_OVERRIDE_STEP,
H.PREM_OVERRIDE_AMT,
H.PREM_OVERRIDE_CODE,
H.SEQ_PROV_ID,
H.IPA_ID,
H.PANEL_ID,
H.SEQ_PROV_2_ID,
H.SECURITY_CODE,
H.INSERT_DATETIME,
H.INSERT_USER,
H.INSERT_PROCESS,
H.UPDATE_DATETIME,
H.UPDATE_USER,
H.UPDATE_PROCESS,
H.USER_DEFINED_1,
H.SALARY,
H.PEC_END_DATE,
H.REASON_CODE,
H.PEC_WAIVED,
H.BILL_EFFECTIVE_FROM_DATE,
H.BILLED_THRU_DATE,
H.PAID_THRU_DATE,
H.SUBSC_DEPT,
H.SUBSC_LOCATION,
H.USE_EFT_FLG,
H.BENEFIT_START_DATE,
H.SEQ_ENROLLMENT_RULE,
H.MCARE_RISK_ACCRETION_DATE,
H.MCARE_RISK_DELETION_DATE,
H.MCARE_RISK_REFUSED_DATE,
H.COMMENTS,
H.USER_DEFINED_2,
H.USER_DEFINED_3,
H.RATE_TYPE,
H.PCPAA_OCCURRED,
H.PRIVACY_ON,
H.PCP_CHANGE_REASON,
H.SITE_CODE,
H.SEQ_SITE_ADDRESS_ID,
PM.seq_prov_id rendered_prov
from hsd_member_elig_history H,
INC.PCP_REASSIGN_RPRT_DATA P,
hsd_prov_master PM
where P.subscriber_id = H.subscriber_id
and P.rendered_pcp = PM.provider_ID
and H.elig_status = 'Y'
and (H.term_date is NULL or H.term_date >= last_day(sysdate))
order by H.Seq_memb_id;
begin
for C in select_cur loop
rec_cnt := rec_cnt + 1;
update hsd_member_elig_history
set term_date = TRUNC(SYSDATE - 1),
term_reason = 'PCPTR',
update_datetime = SYSDATE,
update_user = USER,
update_process = 'TD33615'
where seq_elig_hist = C.seq_elig_hist
and seq_memb_id = C.seq_memb_id;
INSERT INTO HSD_MEMBER_ELIG_HISTORY
(SEQ_ELIG_HIST,
SEQ_MEMB_ID,
SEQ_SUBS_ID,
SUBSCRIBER_ID,
PERSON_NUMBER,
EFFECTIVE_DATE,
TERM_DATE,
TERM_REASON,
RELATIONSHIP_CODE,
SEQ_GROUP_ID,
PLAN_CODE,
LINE_OF_BUSINESS,
RIDER_CODE_1,
RIDER_CODE_2,
RIDER_CODE_3,
RIDER_CODE_4,
RIDER_CODE_5,
RIDER_CODE_6,
RIDER_CODE_7,
RIDER_CODE_8,
MEDICARE_STATUS_FLG,
OTHER_STATUS_FLAG,
HIRE_DATE,
ELIG_STATUS,
PREM_OVERRIDE_STEP,
PREM_OVERRIDE_AMT,
PREM_OVERRIDE_CODE,
SEQ_PROV_ID,
IPA_ID,
PANEL_ID,
SEQ_PROV_2_ID,
SECURITY_CODE,
INSERT_DATETIME,
INSERT_USER,
INSERT_PROCESS,
UPDATE_DATETIME,
UPDATE_USER,
UPDATE_PROCESS,
USER_DEFINED_1,
SALARY,
PEC_END_DATE,
REASON_CODE,
PEC_WAIVED,
BILL_EFFECTIVE_FROM_DATE,
BILLED_THRU_DATE,
PAID_THRU_DATE,
SUBSC_DEPT,
SUBSC_LOCATION,
USE_EFT_FLG,
BENEFIT_START_DATE,
SEQ_ENROLLMENT_RULE,
MCARE_RISK_ACCRETION_DATE,
MCARE_RISK_DELETION_DATE,
MCARE_RISK_REFUSED_DATE,
COMMENTS,
USER_DEFINED_2,
USER_DEFINED_3,
RATE_TYPE,
PCPAA_OCCURRED,
PRIVACY_ON,
PCP_CHANGE_REASON,
SITE_CODE,
SEQ_SITE_ADDRESS_ID)
values
(hsd_seq_elig_hist.nextval,
C.SEQ_MEMB_ID,
C.SEQ_SUBS_ID,
C.SUBSCRIBER_ID,
C.PERSON_NUMBER,
trunc(SYSDATE),
C.TERM_DATE,
C.TERM_REASON,
C.RELATIONSHIP_CODE,
C.SEQ_GROUP_ID,
C.PLAN_CODE,
C.LINE_OF_BUSINESS,
C.RIDER_CODE_1,
C.RIDER_CODE_2,
C.RIDER_CODE_3,
C.RIDER_CODE_4,
C.RIDER_CODE_5,
C.RIDER_CODE_6,
C.RIDER_CODE_7,
C.RIDER_CODE_8,
C.MEDICARE_STATUS_FLG,
C.OTHER_STATUS_FLAG,
C.HIRE_DATE,
C.ELIG_STATUS,
C.PREM_OVERRIDE_STEP,
C.PREM_OVERRIDE_AMT,
C.PREM_OVERRIDE_CODE,
C.SEQ_PROV_ID,
C.IPA_ID,
C.PANEL_ID,
C.SEQ_PROV_2_ID,
C.SECURITY_CODE,
SYSDATE,
USER,
'TD33615',
SYSDATE,
USER,
'TD33615',
C.USER_DEFINED_1,
C.SALARY,
C.PEC_END_DATE,
C.REASON_CODE,
C.PEC_WAIVED,
C.BILL_EFFECTIVE_FROM_DATE,
C.BILLED_THRU_DATE,
C.PAID_THRU_DATE,
C.SUBSC_DEPT,
C.SUBSC_LOCATION,
C.USE_EFT_FLG,
C.BENEFIT_START_DATE,
C.SEQ_ENROLLMENT_RULE,
C.MCARE_RISK_ACCRETION_DATE,
C.MCARE_RISK_DELETION_DATE,
C.MCARE_RISK_REFUSED_DATE,
C.COMMENTS,
C.USER_DEFINED_2,
C.USER_DEFINED_3,
C.RATE_TYPE,
C.PCPAA_OCCURRED,
C.PRIVACY_ON,
C.PCP_CHANGE_REASON,
C.SITE_CODE,
C.SEQ_SITE_ADDRESS_ID);
commit_cnt := commit_cnt + 1;
if (commit_cnt = 1000) then
dbms_output.put_line('Committed updates for 1000 records.');
commit;
commit_cnt := 0;
end if;
end loop;
commit;
dbms_output.put_line('Total number of MEMBER_ELIG_HISTROY records inserted : ' ||
rec_cnt);
exception
when others then
raise_application_error(-20001,
'An error was encountered - ' || sqlcode ||
' -error- ' || sqlerrm);
end;user10305724 wrote:
I have tried both the Case statement and Decode function in Select cursor, but both the things are not working. Please define what you mean by not working even if your computer screen is near the internet we can't see it.
You should also look at the FAQ about how to ask a question
SQL and PL/SQL FAQ
Particularly *9) Formatting with {noformat}{noformat} Tags* and posting your version.
know the reason why decode is not working, I heard some where Case statement do not work with 8i.
Does this mean you are using 8i? Then scalar sub queries - selects within the select list, are not supported, along with CASE in PL/SQL.
Select DECODE(1,
* (Select 1
from hsd_prov_contract R
where R.seq_prov_id = PM.seq_prov_id
and R.line_of_business = H.line_of_business
and R.PCP_FLAG = 'Y'
and R.participation_flag = 'P'
and SYSDATE between R.EFFECTIVE_DATE AND
NVL(R.TERM_DATE,
TO_DATE('31-DEC-9999', 'DD-MON-YYYY')))*,
'Y',
'N') PAR_FLAG,
>
exception
when others then
raise_application_error(-20001,
'An error was encountered - ' || sqlcode ||
' -error- ' || sqlerrm);
http://tkyte.blogspot.com/2008/01/why-do-people-do-this.html -
Regarding case statement and decode function
Hi Experts,
I have question.....regarding case statement and decode statement....
Can you please explain me that which one will be efficient,to place in insert statement...
insert statement(
(case when ........then
case when ....then
else
end)
else
end)
or
insert statement(
case when.....then
decode(....)
else
end)
Can you people explain me which one is more efficient method?
Thanks in advance.......The are major differences to talk about in case of CASE vs DECODE, but performance wise both are pretty much the same.
Have a look at Tom's thread
Ask Tom &quot;better performance - case or decode&quot;
I would suggest to use CASE whenever possible. Don't worry about the performance part. -
Difference beween Case Statement and Pivot Operator in a OWB mapping
Hi ,
Kindly clarify what is the difference between using a PIVOT operator and the CASE statement in a Expression Operator in a particular mapping.
rgds
ArinjitHi
With PIVOT operator you can transform columns to rows. For example if oyu have 12 column (one for every months) than you can create 12 rows with one column of month data.
If you want to do this without PIVOT you can do it with union (12 times) or with
something like this.
In this case you can't use CASE statement I think.
If you want to do the reverse of this, create 12 column from 12 rows, you can use UNPIVOT operator. In this case you can use CASE statement and aggregating.
Ott Karesz
http://www.trendo-kft.hu -
HI ALL,
in the program,i need to display description based on condition type.
so we used CASE statement as below in LOOP. ITS not working .
could anyone please suggest if anything wrong in the following code.
LOOP AT gt_mat.
MOVE gt_mat-type TO gt_final-type.
Condition description
CASE gt_mat-type .
when 'N'.
move 'New' to gt_final-condes.
when 'B'.
move 'Block' to gt_final4-condes.
ENDCASE.
ENDLOOP.
please let me know whats the problem i above code and how to solve.
thanks in advance.Hi,
The only solution for this could be to debug the program and check if the coresponding values are populated and available. You could also try to replace the CASE statement with a simple IF statement and check if its working.
LOOP AT gt_mat.
MOVE gt_mat-type TO gt_final-type.
* Condition description
IF gt_mat-type = 'N'.
gt_final-condes = 'New'.
elseif gt_mat-type = 'B'.
gt_final-condes ='Block'.
append gt_final.
clear gt_final.
ENDIF.
ENDLOOP.
Also make sure the case of the value in gt_mat-type matches with the condition
Regards,
Vikranth -
Problems with messages, Photos and videos in my N8...
I have a weird problem , and I think it's widely spread among the N82 users . The problem is that after using the phone for a while , I find my very first captured photos and videos are gone !
Some said it could be the memory card, and that I have to get a better quailty card . And what about the disapperaing messages ? should I get a better phone memory quailty as well ? :s
The phone just erases messages randomly ... and for the photos and the videos , it erases the 1st three or four captured photos and the same for videos !
Please help my guys .. I need it desperately
P.S: I've upgraded from V20 to the latest firmware V30 and still the problem exists . I save the messages on phone memory and the photos and videos on the memory card . any help would be appreciated . Thanks ...I checked the messages storage , it's the phone memory ... and for the memory card , no brand name is written on it .. just "MicroSD 2GB" and that's it ...
The memory card came inside the phone ... and i bought this phone from a Mall in Egypt .. and Nokia care won't do anything for me ... cause GPS enabled phones are not allowed in Egypt .. due to some security issues . so Nokia care won't support my N82 in here ... -
How to manipulate arrays using case statements and boolean conditions?
In the vi that is attached I am trying to compare two values in two different arrays and delete the value that is equal to zero. The values of each array are rounded to the closest integer. Then I attempted to apply the ">0" boolean as the condition for my case statement, but I am getting an error. Any tips on manipulating arrays with case statements?
Attachments:
Patient Movement Monitoring.vi 141 KBThank you!!! that was a huge help. I don't think I need the case structures at all. The next part of the code compares the 4 values in the array.
If columns 0 and 1 are both positive -> output 1
If column 0 is negative and 1 is positive -> output 2
If columns 0 and 1 are both negative -> output 3
If column 0 is positive and 1 is negative -> output 4
(0 is x-axis value, 1 is y-axis value.....outputs are assigning quadrants to the combination)
Only one of the "AND" booleans will return true for each index. Is there a way to initialize another array of outputs 1-4 depending on which AND returns true?
Attachments:
Patient Movement Monitoring.vi 144 KB -
Ok, I can't figure this one out... any help would be much appreciated.
Background:
I started server using the Video Production default customer profile. Then I created a few new metadata Sets including one called Finished Programs which is a media asset.
Problem:
When I upload a video clip and select the Finished Programs metadata set it always changes to the Media metadata set. Now this only happens when I have used MPEG Streamclip to take the video off of a DVD. If I upload a clip (mov) file that I used in Final Cut Pro it works fine.
My settings in MPEG StreamClip are Apple DV/DVCPRO-NTSC 720x480 Interlaced Scaling and Reinterlaced Chroma.
If I upload two clips at the same time and select Finished Programs metadata set, one that I used MPEG StreamClip and one that I digitized into FCP, it will place two clips in FCPserver, one with the Finished Programs and one with the Media Set.
Any ideas on how to fix this????Could be. If it's not the metadata it must be something else. You would have to figure it out by trial and error. Maybe you should try giving it the highest priority and maybe turn off all automated scans and see if it works then. just to make sure that nothing intervenes with the process while it is going on and see if you can get it to run fully and see what the outcome is then.
I have files over 1 GB that get attached to the right medadataset. I have failures on thumbnail creation to, but FCSvr then starts the same job over and over till it succeeds.
I have never user MPEG Streamclip clips in FCSvr. Hopefully somebody else has and could share their experiences. -
Case Statement and Sequential Count
I would like to obtain user input via a prompt and use what the user selects in my OBIEE Report case statement. I ve done the parameter part with a presentation variable.
and a filter with the following.
Recv Date is between @{Repair_Start_Date}{01-01-2013} and @{Repair_End_Date}{01-01-2013}
Now I would like to have a sequential count of the records that meet the case statement, please advise.
For example &START_DATE AND &END_DATE are user inputs:
CASE when SHIP_DATE BETWEEN &START_DATE AND &END_DATE THEN 1
ThanksHi,
Here is a way you could try.
CASE when SHIP_DATE BETWEEN &START_DATE AND &END_DATE THEN RSUM(1) END
So, what it does?
Whenever the CASE statement is satisfied, it increments 1 by 1.
Hope this helps.
Thank you,
Dhar -
CASE Statement - and checking number ranges
I am attempting to write a bit of SQL that can be used to do a count of Requisition Values, in different value bands, e.g.:
0 - 250
251 - 500
501 - 1000
etc...
I have got this far:
SELECT sum_value
, COUNT(req_id) req_ct
FROM (SELECT prha.requisition_header_id req_id
, CASE SUM(prla.unit_price * prla.quantity)
WHEN 250
THEN '250'
WHEN 500
THEN '500'
WHEN 500
THEN '1000'
ELSE 'OTHER'
END sum_value
FROM po.po_requisition_headers_all prha
, po.po_requisition_lines_all prla
WHERE prha.requisition_header_id = prla.requisition_header_id
AND prha.creation_date >= SYSDATE - 3
GROUP BY prha.requisition_header_id
, prla.requisition_header_id) rt
GROUP BY sum_value;
SUM_V REQ_CT
250 3
500 6
OTHER 726But - it is not that great, in that it counts REQs with an exact value of 250,400,500 etc.
I am trying to work out the syntax to allow the CASE statement to work with ranges, but I can't work it out.
I have naively attempted this, for example:
WHEN > 250 AND 500
But that errors out, because I can see that the '>' needs to know what it is checking
Any help much appreciated.
Thank youThanks for the reply Sarma,
I've attempted that:
SELECT sum_value
, COUNT(req_id) req_ct
FROM (SELECT prha.requisition_header_id req_id
, CASE SUM(prla.unit_price * prla.quantity)
WHEN BETWEEN 250 AND 500
THEN '250 - 500'
WHEN BETWEEN 501 AND 1000
THEN '501 - 1000'
WHEN BETWEEN 1001 AND 2500
THEN '1001 - 2500'
ELSE 'OTHER'
END sum_value
FROM po.po_requisition_headers_all prha
, po.po_requisition_lines_all prla
WHERE prha.requisition_header_id = prla.requisition_header_id
AND prha.creation_date >= SYSDATE - 3
GROUP BY prha.requisition_header_id
, prla.requisition_header_id) rt
GROUP BY sum_value;But I can see that it doesn't work because I need to state what 'blah' is!
For example, if I tried to state 'blah' as follows:
SELECT sum_value
, COUNT(req_id) req_ct
FROM (SELECT prha.requisition_header_id req_id
, CASE SUM(prla.unit_price * prla.quantity)
WHEN SUM(prla.unit_price * prla.quantity) BETWEEN 250 AND 500
THEN '250 - 500'
WHEN SUM(prla.unit_price * prla.quantity) BETWEEN 501 AND 1000
THEN '501 - 1000'
WHEN SUM(prla.unit_price * prla.quantity) BETWEEN 1001 AND 2500
THEN '1001 - 2500'
ELSE 'OTHER'
END sum_value
FROM po.po_requisition_headers_all prha
, po.po_requisition_lines_all prla
WHERE prha.requisition_header_id = prla.requisition_header_id
AND prha.creation_date >= SYSDATE - 3
GROUP BY prha.requisition_header_id
, prla.requisition_header_id) rt
GROUP BY sum_value;It still errors. I guess I am doing something fundamentally wrong, but I can't see how I can refer to the 'sum' value, to then use it in the Between section of the Case statement.
Thanks -
SVGA Monitor, HDTV and Video Capture
Can you connect Mac Pro to a SVGA monitor (LG Flatron 995FT 19") or HDTV (LG 32LT75 32")? Is Mac Pro the only Mac for which you can buy a HD video capture card for your Xbox 360 and PlayStation 3 games?
To connect a SVGA monitor to your DVI connector you'll need http://store.apple.com/us/product/M8754G/A?fnode=MTY1NDA5OQ&mco=MTA4MzU1ODg
To connect a HDMI equipped TV set to your DVI port you'll need http://store.apple.com/us/product/TR842LL/A?mco=MTY3ODQ5OTY -
Problem with BBM voice and video on Z10
i have problem connecting on my Z10 with BBM voice and video. before it works fine but i think after an update of BBM is not working anymore. the chat sesion works fine.
i have a second Z10 but that one works fine.
any solution ?
THX
BryanOn your BlackBerry10 device:
Reboot: On the side edge volume keys, press and hold down both of the Up and Down volume keys for about 20 seconds, ignoring the initial screenshot message... the screen will go black and reboot.
Now, try again.
Likewise, ask a BBM contact of yours to tell you if your BBM contact has the green icon for BBM voice/video.
1. If any post helps you please click the below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!
3. Install free BlackBerry Protect today for backups of contacts and data.
4. Guide to Unlocking your BlackBerry & Unlock Codes
Join our BBM Channels (Beta)
BlackBerry Support Forums Channel
PIN: C0001B7B4 Display/Scan Bar Code
Knowledge Base Updates
PIN: C0005A9AA Display/Scan Bar Code -
How to stream audio and video captured from mic and webcam in sync.
I am working on a video chat project. I need to capture audio and video from mic and webcam and create rtp stream for them. How can I proceed for this. Any source code help will be highly appreciated. Otherwise just guide me how to do this and point to any good resource which is directly related to my need.
Thanx.t.b.m
As mentioned by you, i am doing exactly like that . I have coded transmitter class. But at the receiver side it is unable to play the stream. I am posting my code . Can you please help with me with any mistake i m making in my code ?? Or with way I should receive stream at receiver side. Plz see my code. I am streaming to ip address 172.31.80.67.
package heyram;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.media.control.*;
import javax.media.protocol.*;
import javax.media.format.*;
import java.io.IOException;
import java.util.Vector;
import java.net.InetAddress;
import java.awt.*;
import java.io.*;
import java.net.InetAddress;
import javax.media.*;
import javax.media.protocol.*;
import javax.media.protocol.DataSource;
import javax.media.format.*;
import javax.media.control.TrackControl;
import javax.media.control.QualityControl;
import javax.media.rtp.*;
import javax.media.rtp.rtcp.*;
import com.sun.media.rtp.*;
import java.lang.Thread.*;
public class HEYRAM{
Format[] format=new Format[2];
Vector[] devices=new Vector[2];
CaptureDeviceInfo[] di=new CaptureDeviceInfo[2];
SessionManager rtpsm = new com.sun.media.rtp.RTPSessionMgr();
Processor p=null;
Processor p1=null;
boolean result;
public HEYRAM(String address,int port,int ttl){
try{
InetAddress destaddr = InetAddress.getByName(address);
SessionAddress sessaddr = new SessionAddress(destaddr,
port,
destaddr,
port + 1);
String cname = rtpsm.generateCNAME();
String username = null;
try {
username = System.getProperty("user.name");
} catch (SecurityException e){
username = "jmf-user";
// create our local Session Address
SessionAddress localaddr = new SessionAddress();
SourceDescription[] userdesclist= new SourceDescription[]
new SourceDescription(SourceDescription
.SOURCE_DESC_EMAIL,
"[email protected]",
1,
false),
new SourceDescription(SourceDescription
.SOURCE_DESC_CNAME,
cname,
1,
false),
new SourceDescription(SourceDescription
.SOURCE_DESC_TOOL,
"JMF RTP Player v2.0",
1,
false)
rtpsm.initSession(localaddr,
userdesclist,
0.05,
0.25);
rtpsm.startSession(sessaddr,ttl,null);
} catch (Exception e) {
System.err.println(e.getMessage());
//return null;
// rtpsm.initSession(localAddress, defaultUserDesc, rtcp_bw_fraction, rtcp_sender_bw_fraction);
// rtpsm.startSession(...);
public void createVideoSession()
format[1] = new VideoFormat(VideoFormat.YUV);
devices[1]= CaptureDeviceManager.getDeviceList( format[1]);
di[1]= null;
if (devices[1].size() > 0) {
di[1] = (CaptureDeviceInfo)devices[1].elementAt(0);
System.out.println(di[1].toString());
else {
// exit if we could not find the relevant capture device.
System.out.println("1234jjfjsajfjasf1");
System.exit(-1);
// Create a processor for this capture device & exit if we
// cannot create it
try {
p1 = Manager.createProcessor(di[1].getLocator());
} catch (IOException e) {
System.out.println("1234jjfjsajfjasf2");
System.exit(-1);
} catch (NoProcessorException e) {
System.out.println("1234jjfjsajfjasf3");
System.exit(-1);
// at this point, we have succesfully created the processor.
// Realize it and block until it is configured.
// p1.configure();
result = waitForState(p1, Processor.Configured);
if (result == false)
System.out.println("Couldn't realize processor");
p1.setContentDescriptor(new ContentDescriptor( ContentDescriptor.RAW_RTP));
// block until it has been configured
TrackControl track[] = p1.getTrackControls();
boolean encodingOk = false;
// Go through the tracks and try to program one of them to
// output ULAW_RTP data.
for (int i = 0; i < track.length; i++) {
if (!encodingOk && track[i] instanceof FormatControl) {
if (((FormatControl)track).
setFormat( new VideoFormat(VideoFormat.YUV)) == null) {
track[i].setEnabled(false);
else {
encodingOk = true;
else {
// we could not set this track to gsm, so disable it
track[i].setEnabled(false);
// Realize it and block until it is realized.
p1.realize();
result = waitForState(p1, Processor.Realized);
if (result == false)
System.out.println("Couldn't realize processor");
// block until realized.
// get the output datasource of the processor and exit
// if we fail
DataSource ds = null;
try {
ds = p1.getDataOutput();
} catch (NotRealizedError e){
//System.exit(-1);
System.out.println("1234jjfjsajfjasf4");
// Create a SessionManager and hand over the
// datasource for SendStream creation.
// The session manager then needs to be initialized and started:
// rtpsm.initSession(...);
// rtpsm.startSession(...);
try {
(rtpsm.createSendStream(ds, 0)).start();
} catch (IOException e){
System.out.println("1234jjfjsajfjasf6");
e.printStackTrace();
} catch( UnsupportedFormatException e) {
System.out.println("1234jjfjsajfjasf7");
e.printStackTrace();
public void createAudioSession(){
format[0] = new AudioFormat("linear",8000,8,1);
devices[0]= CaptureDeviceManager.getDeviceList( format[0]); -
is there a particular piece of hardware and software people use to capture video from the TV out cable for the N96.
I've tried into an ATI TV card and a gamebridge and the picture is NOT good at all. Doesn't even show up on the gamebridge.
NEED HELP URGENTLYNope I've used it all the time.
Just check that you are using the correct settings int he phone (PAL, NTSC, etc.) and match your card.
Some things to keep in mind:
TV out output is VGA but the actual resolution is QVGA as the TV out cable just clones the phone screen. There are two exceptions: PHOTOS and VIDEO. When viewing pictures and watching video this is output at VGA resolution.
I use a Xoltrix tv tuner card.
640K Should be enough for everybody
El_Loco Nokia Video Blog
Maybe you are looking for
-
How can i save the acr changes i make to jpegs (not as sidecar xmps)?
Hi Guys! I have been a full-time pro photog for 16 years and yes, yes, I always shoot in raw. Except on my cameraphone. I am on a pc. We have hundreds of pics that my family took on cameraphones on a recent cruise (when we didn't feel like lug
-
Placing a hidden video in indesign cc
Hi there, I am building a single edition iPad app with inDesign CC. Is there a way to have a video hidden on a document that is then triggered by a button so that the video opens full screen on an iPad? I have tried using states but I am obviously d
-
My reset iCloud password only works for a few days
I have a MacBookPro and iPhone 4. About 2 months ago, I began to get notices on the MBP that there was a password problem with my iCloud/AppleID. When I try to log in using my current password, I get a reject telling me that the password is incorrect
-
USER_TABLES view select problem
i have created a new user and created a test table using USERS tablespace with unlimited quota, ive dont grant select on user_tables to username; i have created test table and selecting * from user_tables shows the table but selecting where returns n
-
Bursting - Delivery Data Source
Hi, I have created a template and mapped the appropriate fields in the source data. I would like to enable bursting split by customer and delivery by vendornum. I am using the following SQL select distinct VENDORNUM KEY, BROKERS PDF TEMPLATE TEMPLATE