NULLIF Function converts to illegal DECODE Statement
I am converting a SQLServer 2000 application to Oracle 8i (release 3) using release 9.2.0.1.7 of the Migration Workbench. I have 39 SQLServer stored procedures which utilize the NULLIF function. The Migration Workbench is converting the NULLIF into a DECODE statement which results in the following PL/SQL compilation error.
Line: 59 Column: 40 Error: PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL statement only
T-SQL line --> SET @VAL = LTRIM(RTRIM(NULLIF(@VAL,'')))
PL/SQL line --> PROCNAME.VAL := LTRIM(RTRIM(DECODE(PROCNAME.VAL,'',NULL,PROCNAME.VAL)));
Why is the workbench creating an illegal use of the DECODE function in the PL/SQL ? Is there another workaround or 'trick' that I could apply so I don't have to manually correct a lot of code ?
Stephen,
Bug logged: Bug3393406
The workaround is to use select from dual:
SELECT LTRIM(RTRIM(DECODE(PROCNAME.VAL,'',NULL,PROCNAME.VAL)))
INTO PROCNAME.VAL FROM DUAL;
This is automatically done if 'SELECT' is used in place of 'SET' in T-SQL.
Turloch
Similar Messages
-
How to convert the compund case statement into decode statement
(CASE
WHEN FRCST = 0 AND SALE = 0 THEN 'No transaction '
WHEN FRCST = 0 AND SALE <>0 THEN 'Sale ag. Nil Forecast : '||SALE||' Kgs'
WHEN FRCST<> 0 AND SALE = 0 THEN 'No Sale ag. Forecast : '||FRCST||' Kgs'
WHEN FRCST<>0 AND SALE<>0 AND DIFF=0 THEN 'No Variance'
ELSE TO_CHAR(ROUND((DIFF/FRCST),2))||'%'
END)VARIANCE
How to convert this tatement to decode statement ?
YogeshDecode(FRCST,0,DECODE(SALE,0,'nO TRANSACTION','SALE AGAINST NIL FORECAST'),DECODE(SALE,0,'NO SALE AGAINST FORECAST',
DECODE(|SALE-FORECAST|,0,'NO VARIANCE',TO_CHAR(ROUND((DIFF/FRCST),2))||'%')))As per me whole case can be replaced by above decode -
Logical Standby SQL Apply Using Incorrect Decode Statement
We are seeing statements erroring out on our logical standby that have been rewritten (presumably by sql apply) with decode statements that don't appear to be correct. For example, here is one of the rewritten statements.
update /*+ streams restrict_all_ref_cons */ "CADPROD"."OMS_SQL_STATEMENT" p
set *"APPLICATION"=decode(:1,'N',"APPLICATION",:2)*,
"STATEMENT"=dbms_reputil2.get_final_lob(:3,"STATEMENT",:4)
where (:5='N' or(1=1 and (:6='N' or(dbms_lob.compare(:7,"STATEMENT")=0)or(:7 is null and "STATEMENT" is null)))) and(:8="APPLICATION")
The problem comes in, we believe, with the attempt to write the value "APPLICATION" to the application column which is only a 10 character field. the value for the :1 bind variable is "N" and the value for :2 is null.
We see the following error on the logical standby:
ORA-00600: internal error code, arguments: [kgh_heap_sizes:ds], [0x01FCDBE60], [], [], [], [], [], []
ORA-07445: exception encountered: core dump [ACCESS_VIOLATION] [kxtoedu+54] [PC:0x2542308] [ADDR:0xFFFFFFFFFFFFFFFF] [UNABLE_TO_READ] []
ORA-12899: value too large for column "CADPROD"."OMS_SQL_STATEMENT"."APPLICATION" (actual: 19576, maximum: 10)
Is this a configuration issue or is it normal for SQL Apply to convert statements from logminer into decode statements?
We have an Oracle 10.2.0.4 database running on windows 2003 R2 64-bit os. We have 3 physical and 2 logical standby's, no problems on the physical standbys.Hello;
I noticed some of your parameters seem to be wrong.
fal_client - This is Obsolete in 11.2
You have db_name='test' on the Standby, it should be 'asadmin'
fal_server=test is set like this on the standby, it should be 'asadmin'
I might consider changing VALID_FOR to this :
VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES)Would review 4.2 Step-by-Step Instructions for Creating a Logical Standby Database of Oracle Document E10700-02
Document 278371.1 is showing its age in my humble opinion.
-----Wait on this until you fix your parameters----------------------
Try restarting the SQL Apply
ALTER DATABASE START LOGICAL STANDBY APPLY IMMEDIATEI don't see the parameter MAX_SERVERS, try setting it to 8 times the number of cores.
Use these statements to trouble shoot :
SELECT NAME, VALUE, UNIT FROM V$DATAGUARD_STATS;
SELECT NAME, VALUE FROM V$LOGSTDBY_STATS WHERE NAME LIKE ;TRANSACTIONS%';
SELECT COUNT(1) AS IDLE_PREPARERS FROM V$LOGSTDBY_PROCESS WHERE
TYPE = 'PREPERER' AND STATUS_CODE = 16166;Best Regards
mseberg
Edited by: mseberg on Feb 14, 2012 7:37 AM -
How to determine INT and FLOAT in a DECODE statement
Can anyone help me with the following problem:
I have a column defined as a NUMBER(15,4). I am trying to determine the java type using the getScale() method in ResultSetMetaData. When the scale is greater than 0, then it is an float, else it is an int. In this case, the getScale() method should return 4. However, when querying with a DECODE statement on the NUMBER(15,4) field, the getScale() method always returns 0 and the value is therefore converted to an int. Anyone knows how to solve this problem?
ThanksAlcides,
Oracle NUMBER data type is mapped to "java.math.BigDecimal" class.
You will find more information in the JDBC Developer's Guide and Reference which is part of the Oracle documentation and available from:
http://www.oracle.com/technology/documentation/index.html
Good Luck,
Avi. -
I had the table as follows :
ITEMCODE TEDCODE AMOUNT
AAAA BED 12345
AAAA EDU CESS 1234
AAAA SHECESS 123
AAAA CST 3% 12456
AND SO ON.
Now i want to convert the rows in Column heading TEDCODE to columns. But i want the specific rows like BED, EDU CESS, SHECESS in one column suppose EXCISE, and the other row i.e CST 3% in other column under heading TAX.
Please help me how i can do it using Decode statement.SQL> create table t (itemcode varchar(4),tedcode varchar(10),amount number);
Table created.
SQL> insert into t values('AAAA','BED',12345);
1 row created.
SQL> insert into t values('AAAA','EDU CESS',1234);
1 row created.
SQL> insert into t values('AAAA','SHECESS',123);
1 row created.
SQL> insert into t values('AAAA','CST 3%',12456);
1 row created.
SQL> select itemcode, tedcode,decode(tedcode,'CST 3%',null,amount) EXCISE, decod
e(tedcode,'CST 3%',amount,null) TAX from t;
ITEM TEDCODE EXCISE TAX
AAAA BED 12345
AAAA EDU CESS 1234
AAAA SHECESS 123
AAAA CST 3% 12456 -
Immediate help required with decode statement in scheduling jobs
Hi
Iam trying to change a job that runs my procedure using dbms_job.. Here is the output I got.
Can someone help me why this is giving me errors.
<code>
SQL> exec dbms_job.next_date(395,decode(sign(substr(to_char(sysdate,'dd/mm/yy hh24:mi'),10,2)-17),-1,'trunc(sysdate) +18.5/24',1,'trunc(sysdate)+1+6.5/24'));
BEGIN dbms_job.next_date(395,decode(sign(substr(to_char(sysdate,'dd/mm/yy hh24:mi'),10,2)-17),-1,'trunc(sysdate) +18.5/24',1,'trunc(sysdate)+1+6.5/24')); END;
ERROR at line 1:
ORA-06550: line 1, column 30:
PLS-00204: function or pseudo-column 'DECODE' may be used inside a SQL
statement only
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
</code>
Thanks in advanceA possible solution:
declare
v_next_varchar varchar2(30);
v_next_date date;
begin
select decode(sign(substr(to_char(sysdate,'dd/mm/yy hh24:mi'),10,2)-17),
-1,'trunc(sysdate) +18.5/24',
1,'trunc(sysdate) +1+6.5/24'
into v_next_varchar
from dual;
execute immediate 'select ' || v_next_varchar || ' from dual ' into v_next_date;
dbms_job.next_date(22, v_next_date);
commit;
end;Bye, Aron -
Help! format of decode statements with between or signs ?
Looking for an example of a decode statement with either a between/and or < > signs in the comparison field.
I have tried several variations, but none seem to work. Any help would be appreciated.
Here's a sample that doesn't work.
Select course_no, section_no, capacity, decode(capacity, (capacity < 12), Less than 12, (capacity between 13 and 15), 13-15, More than 15) from section;
Thanks in advanceHi,
There is a limitation to the Case function, as it cannot be used in the PL/SQL (atleast upto Oracle 8i). Therefore, the only option left is Decode.
If you have to compare the values like capacity < 12 then display Less than 12. You can write it using combination of other functions.
For e.g. follow the steps below:-
1)If you deduct 12 from capacity : (capacity-12) [it will give result as +ve, 0 or -ve.]
2)If you have to narrow down the values to above three options, use function sign:
SIGN(capacity-12) [will result into +1, 0 or -1]
3)Then compare the values using Decode:
DECODE(SIGN(capacity-12),-1,Less than 12,Greater than or equal to 12)
The Decode can be used inside Decode(nested Decode) in above steps to compare more than one values (range between) to get the desired result. Hope have made it clear enough. If not, please let me know.
Cheers.
Yogesh D. -
Decode Statement Inside the Case statement
Can we use Decode Statement inside a CASE Statement as show below --
It is giving an error -- Is the a better way to write with out any error
create or replace
function test (a varchar2) RETURN VARCHAR2
is
m varchar2(20);
begin
m :=
CASE
WHEN a IN (
'1009' -- (soon obsolete)
,'1010'
,'1019'
,'1051'
,'XGP'
,'XSC')
THEN (SELECT DECODE(v_lef_cd,'NAM','71','GLB','99','01') into m FROM DUAL)
-- ) THEN '01' -- UNITED STATES OF AMERICA
WHEN a IN (
'1069' -- South Africa
,'SAO' -- South Africa
,'SA' -- South Africa
) THEN '26' -- South Africa
ELSE NULL
END;
return m;
end;Hi,
You can only use DECODE in SQL statements.
Your SELECT DECODE (...) INTO statement would work anywhere a PL/SQL statement is allowed; but PL/SQL statements are not allowed within CASE expressions.
Remember, the expression that comes after THEN in a CASE expression must be a single value.
I would write a function like this using IF ... ELSIF statements. It's a little more typing than CASE, but a lot easier to code, test and maintain.
If you want to use CASE, here's one way:
... m := CASE
WHEN a IN ('1069', 'SAO', 'SA')
THEN '26' -- South Africa
WHEN a NOT IN ('1009', '1019', '1051', 'XGP', 'XSC')
OR a IS NULL
THEN NULL
WHEN v_lef_cd = 'NAM'
THEN '71'
WHEN v_lef_cd = 'GLB'
THEN '99'
ELSE '01' -- USA
END;This assumes that you have a variable v_lef_cd defined.
If you want, you can nest CASE expressions, like this:
... m := CASE
WHEN a IN ('1069', 'SAO', 'SA')
THEN '26' -- South Africa
WHEN a IN ('1009', '1019', '1051', 'XGP', 'XSC')
THEN CASE v_lef_cd
WHEN 'NAM'
THEN '71'
WHEN 'GLB'
THEN '99'
ELSE '01' -- USA
END
END;Always format your code, so you can see where the CASE expressions and each of the WHEN clauses begin and end.
When posting formatted text on this site, type these 6 characters:
(all small letters, inside curly brackets) before and after sections of formatted text, to preserve spacing. -
hi frs
how to use nullif function.
i have used like below
<?FTE_COUNT div nullif (FT_COUNT+PT_COUNT+PI_COUNT+TEMP_COUNT+I_COUNT),0)?>but not getting it.
help pls.Hi,
try <?xdofx: FTE_COUNT div decode(FT_COUNT+PT_COUNT+PI_COUNT+TEMP_COUNT+I_COUNT,0,null,FT_COUNT+PT_COUNT+PI_COUNT+TEMP_COUNT+I_COUNT)?>
Regards
Rainer -
DECODE Statement and argument limitations
Does anyone know the number of arguments that the DECODE statement will allow you to enter. I currently have 863 and it gives me an error message when i try and run the query.
Database Error - ORA-00939: too many arguments for function.
Thanks
ChrisI dont have the rights to create/edit database, just pull data from it.
Here is my attempt at the nest, but i stil get the error message about size.
DECODE(
DECODE(Point Of Sales His.End User Baan Account,'4260','Croteau; Mark','5001','Croteau; Mark','10714','Croteau; Mark','11966','Croteau; Mark','13739','Croteau; Mark','16233','Croteau; Mark','16736','Croteau; Mark','17276','Croteau; Mark','17377','Croteau; Mark','17387','Croteau; Mark','17436','Croteau; Mark','17452','Croteau; Mark','17485','Croteau; Mark','17681','Croteau; Mark','17741','Croteau; Mark','17794','Croteau; Mark','17799','Croteau; Mark','19364','Croteau; Mark','19462','Croteau; Mark','20205','Croteau; Mark','20995','Croteau; Mark','21916','Croteau; Mark','22269','Croteau; Mark','22629','Croteau; Mark','23562','Croteau; Mark','24078','Croteau; Mark','24079','Croteau; Mark','24550','Croteau; Mark','24796','Croteau; Mark','25196','Croteau; Mark','25506','Croteau; Mark','31494','Croteau; Mark','38067','Croteau; Mark','750457','Croteau; Mark'),
DECODE(Point Of Sales His.End User Baan Account,'314','Bruning; Barbara','500','Bruning; Barbara','3601','Bruning; Barbara','4142','Bruning; Barbara','4433','Bruning; Barbara','8219','Bruning; Barbara','8584','Bruning; Barbara','13839','Bruning; Barbara','15195','Bruning; Barbara','15307','Bruning; Barbara','15523','Bruning; Barbara','16394','Bruning; Barbara','16529','Bruning; Barbara','17111','Bruning; Barbara','17410','Bruning; Barbara','17471','Bruning; Barbara','19158','Bruning; Barbara','19219','Bruning; Barbara','20219','Bruning; Barbara','20308','Bruning; Barbara','20687','Bruning; Barbara','22364','Bruning; Barbara','22895','Bruning; Barbara','23411','Bruning; Barbara','23983','Bruning; Barbara','24343','Bruning; Barbara','24890','Bruning; Barbara','25828','Bruning; Barbara','25866','Bruning; Barbara','32850','Bruning; Barbara','38046','Bruning; Barbara','38048','Bruning; Barbara','38049','Bruning; Barbara','38051','Bruning; Barbara','38192','Bruning; Barbara','38237','Bruning; Barbara'),
DECODE(Point Of Sales His.End User Baan Account,'7781','Weber; Ed','8668','Weber; Ed','9016','Weber; Ed','12219','Weber; Ed','12669','Weber; Ed','13200','Weber; Ed','13529','Weber; Ed','13704','Weber; Ed','15453','Weber; Ed','16643','Weber; Ed','17127','Weber; Ed','17399','Weber; Ed','17400','Weber; Ed','17480','Weber; Ed','18064','Weber; Ed','18267','Weber; Ed','18914','Weber; Ed','20121','Weber; Ed','20177','Weber; Ed','21523','Weber; Ed','22155','Weber; Ed','22347','Weber; Ed','31405','Weber; Ed','31445','Weber; Ed','31542','Weber; Ed','31545','Weber; Ed','31696','Weber; Ed','31830','Weber; Ed','31960','Weber; Ed','32818','Weber; Ed','33111','Weber; Ed','34060','Weber; Ed','38061','Weber; Ed','38062','Weber; Ed','38063','Weber; Ed','38208','Weber; Ed','38213','Weber; Ed'),
DECODE(Point Of Sales His.End User Baan Account,'3455','Rogers; Mary Jill','6854','Rogers; Mary Jill','7277','Rogers; Mary Jill','7376','Rogers; Mary Jill','8223','Rogers; Mary Jill','8645','Rogers; Mary Jill','12063','Rogers; Mary Jill','15449','Rogers; Mary Jill','16086','Rogers; Mary Jill','16782','Rogers; Mary Jill','16940','Rogers; Mary Jill','17036','Rogers; Mary Jill','17232','Rogers; Mary Jill','17285','Rogers; Mary Jill','17316','Rogers; Mary Jill','17430','Rogers; Mary Jill','17462','Rogers; Mary Jill','17656','Rogers; Mary Jill','20015','Rogers; Mary Jill','20277','Rogers; Mary Jill','23184','Rogers; Mary Jill','23318','Rogers; Mary Jill','23387','Rogers; Mary Jill','23388','Rogers; Mary Jill','23689','Rogers; Mary Jill','23696','Rogers; Mary Jill','24157','Rogers; Mary Jill','24219','Rogers; Mary Jill','24336','Rogers; Mary Jill','24676','Rogers; Mary Jill','24681','Rogers; Mary Jill','24793','Rogers; Mary Jill','24827','Rogers; Mary Jill','25038','Rogers; Mary Jill','25245','Rogers; Mary Jill','25281','Rogers; Mary Jill','25416','Rogers; Mary Jill','25417','Rogers; Mary Jill','25418','Rogers; Mary Jill','25419','Rogers; Mary Jill','25420','Rogers; Mary Jill','25421','Rogers; Mary Jill','25422','Rogers; Mary Jill','25423','Rogers; Mary Jill','25424','Rogers; Mary Jill','25425','Rogers; Mary Jill','25426','Rogers; Mary Jill','25427','Rogers; Mary Jill','25428','Rogers; Mary Jill','25429','Rogers; Mary Jill','25430','Rogers; Mary Jill','25431','Rogers; Mary Jill','25432','Rogers; Mary Jill','25433','Rogers; Mary Jill','25434','Rogers; Mary Jill','25435','Rogers; Mary Jill','25436','Rogers; Mary Jill','25437','Rogers; Mary Jill','25438','Rogers; Mary Jill','25439','Rogers; Mary Jill','25440','Rogers; Mary Jill','25441','Rogers; Mary Jill','25442','Rogers; Mary Jill','25443','Rogers; Mary Jill','25444','Rogers; Mary Jill','25445','Rogers; Mary Jill','25446','Rogers; Mary Jill','25447','Rogers; Mary Jill','25448','Rogers; Mary Jill','25449','Rogers; Mary Jill','25450','Rogers; Mary Jill','25451','Rogers; Mary Jill','25452','Rogers; Mary Jill','25453','Rogers; Mary Jill','25454','Rogers; Mary Jill','25455','Rogers; Mary Jill','25456','Rogers; Mary Jill','25457','Rogers; Mary Jill','25458','Rogers; Mary Jill','25459','Rogers; Mary Jill','25460','Rogers; Mary Jill','25461','Rogers; Mary Jill','25462','Rogers; Mary Jill','25463','Rogers; Mary Jill','25464','Rogers; Mary Jill','25465','Rogers; Mary Jill','25466','Rogers; Mary Jill','25467','Rogers; Mary Jill','25468','Rogers; Mary Jill','25469','Rogers; Mary Jill','25470','Rogers; Mary Jill','25471','Rogers; Mary Jill','25472','Rogers; Mary Jill','25473','Rogers; Mary Jill','25474','Rogers; Mary Jill','25475','Rogers; Mary Jill','25476','Rogers; Mary Jill','25477','Rogers; Mary Jill','25478','Rogers; Mary Jill','25479','Rogers; Mary Jill','25488','Rogers; Mary Jill','25489','Rogers; Mary Jill','25522','Rogers; Mary Jill','25532','Rogers; Mary Jill','25541','Rogers; Mary Jill','25547','Rogers; Mary Jill','25570','Rogers; Mary Jill','25775','Rogers; Mary Jill','25845','Rogers; Mary Jill','25875','Rogers; Mary Jill','32164','Rogers; Mary Jill','33328','Rogers; Mary Jill','33844','Rogers; Mary Jill','38057','Rogers; Mary Jill','38060','Rogers; Mary Jill'),
DECODE(Point Of Sales His.End User Baan Account,'4188','Gallo; Peter','7520','Gallo; Peter','8371','Gallo; Peter','9524','Gallo; Peter','9647','Gallo; Peter','10768','Gallo; Peter','12788','Gallo; Peter','15248','Gallo; Peter','16641','Gallo; Peter','17284','Gallo; Peter','17330','Gallo; Peter','17331','Gallo; Peter','17332','Gallo; Peter','17333','Gallo; Peter','17334','Gallo; Peter','17335','Gallo; Peter','17336','Gallo; Peter','17347','Gallo; Peter','17431','Gallo; Peter','17598','Gallo; Peter','17763','Gallo; Peter','17801','Gallo; Peter','18529','Gallo; Peter','19071','Gallo; Peter','19328','Gallo; Peter','19572','Gallo; Peter','21003','Gallo; Peter','22975','Gallo; Peter','23548','Gallo; Peter','23562','Gallo; Peter','23985','Gallo; Peter','24088','Gallo; Peter','25665','Gallo; Peter','32145','Gallo; Peter','32905','Gallo; Peter','38053','Gallo; Peter','38059','Gallo; Peter','38070','Gallo; Peter','38071','Gallo; Peter','38072','Gallo; Peter','38200','Gallo; Peter'),
DECODE(Point Of Sales His.End User Baan Account,'142','Coady; Ed','1291','Coady; Ed','2420','Coady; Ed','7726','Coady; Ed','9334','Coady; Ed','10678','Coady; Ed','11487','Coady; Ed','12052','Coady; Ed','12223','Coady; Ed','15386','Coady; Ed','15597','Coady; Ed','16245','Coady; Ed','17277','Coady; Ed','17278','Coady; Ed','17469','Coady; Ed','17674','Coady; Ed','17675','Coady; Ed','17731','Coady; Ed','17826','Coady; Ed','18500','Coady; Ed','18791','Coady; Ed','19035','Coady; Ed','19100','Coady; Ed','19130','Coady; Ed','19131','Coady; Ed','19132','Coady; Ed','19133','Coady; Ed','19134','Coady; Ed','19135','Coady; Ed','19136','Coady; Ed','19137','Coady; Ed','19138','Coady; Ed','19139','Coady; Ed','19140','Coady; Ed','19141','Coady; Ed','19142','Coady; Ed','19143','Coady; Ed','19144','Coady; Ed','19145','Coady; Ed','19146','Coady; Ed','19147','Coady; Ed','19148','Coady; Ed','19149','Coady; Ed','19150','Coady; Ed','19151','Coady; Ed','19152','Coady; Ed','19175','Coady; Ed','19300','Coady; Ed','19533','Coady; Ed','19999','Coady; Ed','20900','Coady; Ed','21020','Coady; Ed','21053','Coady; Ed','21144','Coady; Ed','21470','Coady; Ed','21665','Coady; Ed','21720','Coady; Ed','21731','Coady; Ed','22829','Coady; Ed','22841','Coady; Ed','23457','Coady; Ed','24243','Coady; Ed','24257','Coady; Ed','24345','Coady; Ed','24383','Coady; Ed','25184','Coady; Ed','25354','Coady; Ed','25777','Coady; Ed','25865','Coady; Ed','30181','Coady; Ed','31349','Coady; Ed','38052','Coady; Ed','38224','Coady; Ed'),
DECODE(Point Of Sales His.End User Baan Account,'1106','Saale; Thomas','2726','Saale; Thomas','6840','Saale; Thomas','7785','Saale; Thomas','7834','Saale; Thomas','8464','Saale; Thomas','8843','Saale; Thomas','8897','Saale; Thomas','9074','Saale; Thomas','9809','Saale; Thomas','10259','Saale; Thomas','10301','Saale; Thomas','10313','Saale; Thomas','10314','Saale; Thomas','10604','Saale; Thomas','10662','Saale; Thomas','10788','Saale; Thomas','10789','Saale; Thomas','10790','Saale; Thomas','10791','Saale; Thomas','10792','Saale; Thomas','10793','Saale; Thomas','10794','Saale; Thomas','10795','Saale; Thomas','10796','Saale; Thomas','10798','Saale; Thomas','10799','Saale; Thomas','10800','Saale; Thomas','10801','Saale; Thomas','10802','Saale; Thomas','10803','Saale; Thomas','10804','Saale; Thomas','10805','Saale; Thomas','10806','Saale; Thomas','10807','Saale; Thomas','10808','Saale; Thomas','10809','Saale; Thomas','10810','Saale; Thomas','10811','Saale; Thomas','10812','Saale; Thomas','10813','Saale; Thomas','10814','Saale; Thomas','10815','Saale; Thomas','10816','Saale; Thomas','10817','Saale; Thomas','10818','Saale; Thomas','10819','Saale; Thomas','10820','Saale; Thomas','10821','Saale; Thomas','10822','Saale; Thomas','10823','Saale; Thomas','10824','Saale; Thomas','10825','Saale; Thomas','10826','Saale; Thomas','10827','Saale; Thomas','10828','Saale; Thomas','10829','Saale; Thomas','10830','Saale; Thomas','10831','Saale; Thomas','10832','Saale; Thomas','10833','Saale; Thomas','10834','Saale; Thomas','10835','Saale; Thomas','10836','Saale; Thomas','10837','Saale; Thomas','10838','Saale; Thomas','10839','Saale; Thomas','10840','Saale; Thomas','10841','Saale; Thomas','10842','Saale; Thomas','10843','Saale; Thomas','10845','Saale; Thomas','10846','Saale; Thomas','10853','Saale; Thomas','10854','Saale; Thomas','10855','Saale; Thomas','10856','Saale; Thomas','10858','Saale; Thomas','10859','Saale; Thomas','10860','Saale; Thomas','10906','Saale; Thomas','10916','Saale; Thomas','10960','Saale; Thomas','11012','Saale; Thomas','11420','Saale; Thomas','11723','Saale; Thomas','11872','Saale; Thomas','11939','Saale; Thomas','11940','Saale; Thomas','11941','Saale; Thomas','12650','Saale; Thomas','12657','Saale; Thomas','12717','Saale; Thomas','12749','Saale; Thomas','12756','Saale; Thomas','12792','Saale; Thomas','12847','Saale; Thomas','12969','Saale; Thomas','13063','Saale; Thomas','13323','Saale; Thomas','13413','Saale; Thomas','13433','Saale; Thomas','13475','Saale; Thomas','13493','Saale; Thomas','13754','Saale; Thomas','13859','Saale; Thomas','14204','Saale; Thomas','14612','Saale; Thomas','14615','Saale; Thomas','14748','Saale; Thomas','15147','Saale; Thomas','15149','Saale; Thomas','15473','Saale; Thomas','15551','Saale; Thomas','15613','Saale; Thomas','15659','Saale; Thomas','15872','Saale; Thomas','15891','Saale; Thomas','16360','Saale; Thomas','16837','Saale; Thomas','16849','Saale; Thomas','16909','Saale; Thomas','16981','Saale; Thomas','17048','Saale; Thomas','17153','Saale; Thomas','17402','Saale; Thomas','17833','Saale; Thomas','18095','Saale; Thomas','18226','Saale; Thomas','18342','Saale; Thomas','18900','Saale; Thomas','19331','Saale; Thomas','19651','Saale; Thomas','19667','Saale; Thomas','19850','Saale; Thomas','19856','Saale; Thomas','20054','Saale; Thomas','20069','Saale; Thomas','20120','Saale; Thomas','20454','Saale; Thomas','20753','Saale; Thomas','20758','Saale; Thomas','20765','Saale; Thomas','21860','Saale; Thomas','22062','Saale; Thomas','22548','Saale; Thomas','22772','Saale; Thomas','22966','Saale; Thomas','22972','Saale; Thomas','22989','Saale; Thomas','23623','Saale; Thomas','23816','Saale; Thomas','23817','Saale; Thomas','23893','Saale; Thomas','24014','Saale; Thomas','24022','Saale; Thomas','24122','Saale; Thomas','24158','Saale; Thomas','24179','Saale; Thomas','24248','Saale; Thomas','24329','Saale; Thomas','24338','Saale; Thomas','24366','Saale; Thomas','24481','Saale; Thomas','24517','Saale; Thomas','24611','Saale; Thomas','24618','Saale; Thomas','24816','Saale; Thomas','24820','Saale; Thomas','24880','Saale; Thomas','24924','Saale; Thomas','24925','Saale; Thomas','24936','Saale; Thomas','24985','Saale; Thomas','24998','Saale; Thomas','25191','Saale; Thomas','25326','Saale; Thomas','25327','Saale; Thomas','25598','Saale; Thomas','25821','Saale; Thomas'),
DECODE(Point Of Sales His.End User Baan Account,'620753','Saale; Thomas','620758','Saale; Thomas','620765','Saale; Thomas','623816','Saale; Thomas','623817','Saale; Thomas','624014','Saale; Thomas','624022','Saale; Thomas','624248','Saale; Thomas','624329','Saale; Thomas','624816','Saale; Thomas','624880','Saale; Thomas','625598','Saale; Thomas','899998','Saale; Thomas','E99998','Saale; Thomas','UPS001','Saale; Thomas'),
'Other') -
Hi i was trying to get the below information.
I wanted to know is it possible to use nested decode function. also is it possible to use a condition in a decoded function.
how could i frame the below mentioned information into a nested decode statement.
IF LSGD = '00000000' then TC = "NS"
IF LSGD <> '00000000' and RP = 0 and RC =0 OR RU=0 then TC ="NU"
IF LSGD <> '00000000' and RP = 0 and RC >0 then TC="RR"
If RU > 1 and INT=0, then TC="TT"
If PERC is >=66% then TC="RR"
If PERC is < 66% then TC="TT"
thanks for your helpHi Guido,
This is the case statement i have constructed. would appriciate if you could assist further to make it more accurate.
select
case when LSGD = '00000000' then 'NS'
when LSGD <> '00000000' then
case when RP=0 then case when RC=0 then 'NU' else case when RC >0 then 'RR' else 'TT' end end
else
case when RU=1 then 'NU' when RU>1 and INT=0 then 'TT' else 'RR' end
end
when PERC >=0.66 then 'RR'
when PERC < 0.66 then 'TT'
end TC
from my table
Thanks in advance -
How to replace huge decode statements with lookups to some simple code/key
I have a legacy PL/SQL application, composed of many very huge decode statements. And the most terribe one is that the guys who develops the application left the company now, leaves no documentation.
We are trying to read and understand those PL/SQL programs, and I'm asked to replace those huge decode statements with lookups to some simple code/key tables? But I have no idea about how to design such code/key tables. Is there any one who has similar experience may help me? Besides code/key tables, any idea will be welcome.
Thank you very much!Not sure what your data looks like but sometimes decode can be replaced with more appropriate functions, ie;
SQL> with t as (
select 'DAY' a, 30 b, null c, null d from dual union all
select null a, null b, 'MONTH' c, 12 from dual)
select coalesce(b,d)
from t
COALESCE(B,D)
30
12
2 rows selected.
SQL> with t as (
select 'DAY' a, 30 b, null c, 0 d from dual union all
select null a, 0 b, 'MONTH' c, 12 from dual)
select greatest(b,d)
from t
GREATEST(B,D)
30
12
2 rows selected. -
Decode statement in Select line of a View Object Query
I attempted to create a view object in expert mode with a customized query.
The query had a decode statement in the select line of the query. The view
object compiled correctly but gave an error when run.
ex: select .... decode(CrpSchools.SCHOOLS_ID,null,CrpCustSchools.SCHOOL_NAME,CrpSchools.SCHOOL_NAME) SCHOOL_VALUE, ...
from ....
where ....
The error was that school_value does not exist in the statement. I got the error when
doing a vo.executeQuery().
When I removed the decode statement everything worked correctly. Does anyone know if
the decode statement cannont be used in the select line of a query in a view object?
Or maybe I was linking the query column (SCHOOLS_ID) up to the view attribute (SCHOOL_VALUE) incorrectly in the
Attribute Mappings tab of the VO wizard?There should be no problem using a DECODE() statement, provided that you've aliases the column as you have done.
At design time, if you click on the (Test) button, does your query test ok?
Are you by chance applying a custom where clause at runtime?
If so, are you saying:
setWhereClause("yourtable.column_alias = ?";
or are you doing:
setWhereClause("column_alias = ?";
for an expert-mode query, you'll need to use the latter syntax. -
How to convert the data decoded by MJPEG Decoder MFT into RGB32
I try to play .avi file(Motion JPEG) with MJPEG Decoder MFT and
My ColorConverter MFT to convert into RGB32 by using the Media Foundation.
The output format of MJPEG Decoder MFT is YUY2.
So, I implemented My ColorConverter MFT to convert YUY2 into RGB32.
I set the topology to play .avi file and to convert into RGB32.
But I got a MEError event with ME_ARITHMETIC_OVERFLOW in
IMFMediaEvent->GetStatus(&hrStatus)); after the event MESessionTopologyStatus.
So,the file isn't started to play.
The created topology is follow.
Source-> MJPEG Decoder MFT -> My ColorConverter MFT -> EVR
Format: YUY2
RGB32
Why do the error occur in processing to convert the data decoded by MJPEG Decoder MFT
into RGB32?
Please tell me a appropriate way to convert the data decoded by MJPEG Decoder MFT
into RGB32.You've got the High Speed Data Reader.vi as a starting point. That will retrieve the binary data and plot it on a chart. From the array of sgl's created, you could then use the Write to Spreadsheet File.vi to create a comma or tab separated file. The other option is to write the data straight to Excel using ActiveX. There's a shipping example that shows how that's done as well.
-
Calling a stored proc in a decode statement
I am having a problem calling a store procedure in a SQL statement. I am using Oracle's thin driver.
I have been able to do the following:
select col1,
col2,
SOME_STORED_PROC(var1,var2,col3)
from some_table
where col3 = var3
However, when I try to call a stored procedure with-in a decode statement, the call fails. I have tested the call from a sql prompt and it works fine but it does not work when I execute the query in my Java program.
Here is an example of what I am trying to do:
select col1,
col2,
decode((select col1
from some_other_table
where col2 = var1), 'X',
SOME_STORED_PROC(var1,var2,col3),
SOME_OTHER_STORED_PROC(var2,var4,col5))
from some_table
where col3 = var3
Does anyone know if this type of call is not supported in Oracle's thin driver?
Thanks,
Cory
nullI played around with a [parallel PL/SQL launcher|http://www.williamrobertson.net/feed/2008/08/parallel-plsql-launcher-update.html] a while ago, but I wouldn't call it production-ready.
You could also [submit procedure calls in background|http://www.williamrobertson.net/feed/2005/12/job-control-object.html] using DBMS_ALERT to track completion status.
Maybe you are looking for
-
Send and symbols with soap receiver adapter
I have a integration scenario (IDOC to WebService). The web service has an action with receives 2 parameters <MaterialNumber> and <MaterialList> I have imported the wsdl file into Repository and I have define my interface. But this webservice has a p
-
JSP page error: JSPtranslate: attribute | has no value.
Hi again, I've written the JAVA class, the TLD and the JSP but when I try to provide the parameters to the TLD file in the JSP I get this error: JSPTranslate: attribute | has no value. /**** My TLD file is in a WEB_INF/tags/ directory. ***/ I've incl
-
Simple Dynamic Table followed by an empty Page
Hello, I need a dynamic table with 3 Columns + 3 Rows. The data provides an xml file. Each table must be followed by a blank page (please see the Screenshot below). Thanks and regards, Mike Please feel free to send me an example via mail to [email pr
-
Why RAW partitions are visible only on one node in RAC?
I am having 2 node RAC on Windows 2003 Server. Can anybody tell me why the RAW partitions are visible on RAC-2 but not on RAC-1. I Shutted down RAC-2, and I thought all the RAW devices will appear in RAC-1, but it didn't work, it is displaying only L
-
I cannoy download the latest version of Itunes it will not upgrade from the current version
I cannot upgrade my current version of Itunes to the current version Is there any help available?