URGENT:DECODE
I'm facing problem with this stored procedure.the decode function is not working properly.However the same select statement when compiled seperately works fine. i'm confused.Please help me out.
CREATE OR REPLACE PROCEDURE sp_sel_basis_list
(v_fund NUMBER,
R1 OUT PKG_SP_MAINT_MAIN.RF1)
AS
BEGIN
OPEN R1 FOR
SELECT TBASIS.BASISID,TBASIS.BASISCD,TBASIS.DESCRIPTION,
DECODE(TBASIS.BASISID,(SELECT DISTINCT TBASISFND.BASISID FROM TBASISFND WHERE FUNDID = v_fund AND TBASISFND.BASISID = TBASIS.BASISID ),'Y','N') SELECT_FLAG
FROM TBASIS;
END;
It would be nice if somebody can reply to this.
regards
null
TRY:
SELECT TBASIS.BASISID,
TBASIS.BASISCD,
TBASIS.DESCRIPTION,
DECODE(fnd.BASISID,NULL,
'N','Y') SELECT_FLAG
FROM TBASIS,
(SELECT DISTINCT BASISID
FROM TBASISFND
WHERE FUNDID = v_fund) fnd
WHERE TBASIS.BASISID = fnd.BASISID (+) ;
OR
SELECT T.BASISID,
T.BASISCD,
T.DESCRIPTION,
'N' SELECT_FLAG
FROM TBASIS t
WHERE NOT EXISTS
(SELECT 1
FROM TBASISFND
WHERE FUNDID = v_fund
AND BASIS_ID = t.BASIS_ID)
UNION
SELECT T.BASISID,
T.BASISCD,
T.DESCRIPTION,
'Y' SELECT_FLAG
FROM TBASIS t
WHERE EXISTS
(SELECT 1
FROM TBASISFND
WHERE FUNDID = v_fund
AND BASIS_ID = t.BASIS_ID) ;
null
Similar Messages
-
[Urgent!!] How to do quadrature decoding using DAQCard 6062E??
Hi,
I am Xiaofei, a beginner of LabVIEW. Now i am dealing with a project involving quadrature decoding by using DAQ Card 6062E and breakout board CB68LP. We need to use 2 optical encoders simutaneously, and for each encoder, we need to use 3 digital channels (A,B and Index), therefore there will be totally 6 digital channels in use. For this reason, is it still good to use the counter channel? or we'd better use 6 DIO?
I'm not sure if there is any existing VI that can help us with decoding, if there is, could you please let me know how we can find it?
If we will need to make the decoding code by ourselves, could you please give me some hint so that we can start it?
I heard that there should be an example called "How to Count.vi" that shows how to decode, however i failed to find it by using example finder, so does anyone know how to find it?
This is kinda urgent, i have to figure it out by tonight in order to keep my project rolling. So if you have any idea about it, pleeeeeeeeeease let me know! Thanks a million!!!
Regards,
XiaofeiDuplicate post.
Please do not generate a new message thread with the same question.
Keep your messages to the original post. -
hai all,
this is the query from robinson .....
I am trying to use decode function as below in PL/SQl..
DECODE(column1,a1,1,a2,2,a3,3,......a150,150,null)
i got a error as
---unhandled exception---
If this decode function is restricted to 120 values i get the
answer.
so i would like to know whether there is any restriction for the
number of arguments to be passed to the decode function.
I will be glad and grateful to receive a answer...for this query.
thanks in advance...
robinsonI'm not sure what is the limit for the decode function
arguments, but it certainly seems that you've reached it.
So, I'd recommend that you write a stored function that you will
call in your select. It should be like the following:
create
function f_decode (p in your_data_type) return your_ret_type
is
begin
if p=expr1 then
return value1;
elsif p=expr2 then
return value2;
elsif p=exprn then
return exprn;
else
return def_value;
end if;
Or, another way to handle it, even more graciously when the
number of possible values will vary pretty often may be to have
a table that you would join.
That's what I do when a have to deal with more than 10-20 values.
end; -
Decode function involving 2 fields (urgent)
Hi .. I am trying to use the decode function involving 2 fields.
The query runs but does not produce the correct results. If
anyone knows, please reply .. Usually decode function involves
one column only but I have more
than one. The situation is : If ins_code = 2 or special_code =
MMI, put a 'Y', otherwise, it's a 'N'. Does anyone know how to
put this in a decode statement? ThanksThanks, Suresh ... but I have to put this condition using the
decode statement because that's how the rest of the program is
written. It's part of the script that I have to change. The
current statement is this: decode(ins_code, '2', 'Y', 'N'). I
have to change it to ins_code =2 or special_feature = MMI.
Please reply ... thanks a lot.... -
Decode (function) VERY URGENT ! ! !
Hi Folks,
Does any one know how can i use some thing like
if a < 25 then
else
end if;
using decode function.
Thanks in advance
D'SilvaYep use Decode in conjunction with
the sign() function.
Goes something like this...
Decode( Sign( a - 25 ),0, 'EQUAL',
1, 'GREATER',
-1, 'LESS' )
Hope this helps
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by D'Silva:
Hi Folks,
Does any one know how can i use some thing like
if a < 25 then
else
end if;
using decode function.
Thanks in advance
D'Silva<HR></BLOCKQUOTE>
null -
Problem with decode function while dispaly the data ( urgent )
Hi friends ,
I want the output like this.
sample:
CLIENT CODE: 00027
PLAN CODE: 01
SSN Last Name First Name TYPE Frequency Amount
123-45-6036 Perrault Julia D M 250.00
123-45-6036 Perrault Julia D Q 400.00
CLIENT CODE: 00027
PLAN CODE: 02
SSN Last Name First Name TYPE Frequency Amount
123-45-6036 Perrault Julia D S 1000.00
123-45-7042 Testaverde Alexander D B 50.00
this is my query:
SELECT distinct pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name,
pln.clt_client_id,
DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'TYPE',rp.userid,NULL) type
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
output for above query:
PLAN_C SSN LAST_NAME FIRST_NAME CLT_C AMOUNT
FREQUENCE TYPE
01 123456036 Perrault Julia 00027 250.00
01 123456036 Perrault Julia 00027 400.00
01 123456036 Perrault Julia 00027 M
01 123456036 Perrault Julia 00027 Q
01 123456036 Perrault Julia
00027 D
02 123456036 Perrault Julia 00027 1000.00
02 123456036 Perrault Julia 00027 S
02 123456036 Perrault Julia
00027 D
02 123457042 Testaverde Alexander 00027 50.00
02 123457042 Testaverde Alexander 00027 B
02 123457042 Testaverde Alexander
00027 D
11 rows selected.
11 rows selected.
how can i get the above ouput .
i want the type,frequency,amount values in one line.
thanks for u r kind help
sriniHi Srini,
Add Max in the begining and group by at the end of statement.
Please let me know in both cases if it works or not.
thanks
for example
SELECT distinct pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name,
pln.clt_client_id,
MAX(DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'TYPE',rp.userid,NULL) type )
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
GROUP BY
pln.plan_code,
ind.ssn,
ind.last_name,
ind.first_name,
pln.clt_client_id, -
Problem with decode function ( urgent )
Hi friends ,
this is my query
SELECT DECODE(rp.account_code,'TYPE',rp.userid,NULL) type,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
getting output like this:
TYPE FREQUENCE AMOUNT
S
D
1000.00
M
D
250.00
Q
D
400.00
B
D
50.00
12 rows selected.
i want the output like this :
TYPE Frequency Amount
D M 250.00
D Q 400.00
D S 1000.00
D B 50.00
how can get the above out put.
thanks for u r kind help
sriniTry formatting your columns
col type for a4
col frequence for a4
col amount for a4
although from looking at you query, I don't understand the
output you pasted. YOu have 3 decode statments based on the
same fields?
Hi friends ,
this is my query
SELECT DECODE(rp.account_code,'TYPE',rp.userid,NULL) type,
DECODE(rp.account_code,'FREQ',rp.userid,NULL) frequence,
DECODE(rp.account_code,'AMNT',rp.userid,NULL) amount
FROM rp_extract_recon rp,
plan pln,
indicative ind
where ind.indicative_id in ( select distinct
rp1.ind_indicative_id
from rp_extract_recon rp1
where rp1.rp_extract_recon_id =
rp.rp_extract_recon_id )
and ind.clt_client_id = pln.clt_client_id
and pln.plan_id = rp.pln_plan_id
and rp.bat_batch_info_id = 14078
and rp.rp_report_type_code = 'TEST'
getting output like this:
TYPE FREQUENCE AMOUNT
S
D
1000.00
M
D
250.00
Q
D
400.00
B
D
50.00
12 rows selected.
i want the output like this :
TYPE Frequency Amount
D M 250.00
D Q 400.00
D S 1000.00
D B 50.00
how can get the above out put.
thanks for u r kind help
srini -
Urgent need: how to decode usr02
On my laptop sandbox, I can see the password in table usr02 but
in an encrypted form.
Could you tell me how to decode the password?
Thanks and points.This would lock the user.
Did you check the value of login/no_automatic_usr_sapstar?
(should be 0, otherwize the system will not recreate the sap* user)
You may also try (the last option that is avaible):
if you have another system (for example PROD),
you can over-ride the password of your users (field bcode in usr02)
from the system you know the password.
p.s
you can not copy password of diffrent user,
e.g: user A has password "ABCDE",
user B has password "ABCDE",
the values of the BCODE in usr02 would be diffrent from user A to B
although they thave the same passord,
this is because the encryption is per user,
however, user A that have the password "ABCDE"
in diffrent systems/client will have the same BCODE
(the encryption algoritem uses only the user-name to encrypt) -
Decode dans disco 3i (urgent merci)
Bonjour,
Je souhaite crier une colonne ( calcul) avec 3i utilisateur en fonction d'un montant :
decode(nom_variable,<250,1,<500,2,<750,3,4)
toutes mes valeurs sont a 4.
le test < a 250 et les autres tests ne fonctionnent pas.
comment faire pour comparer une valeur
avec des condition inferieures ou superieures
MerciRose,
Decode (nom_variable,
greatest(least(nom_variable, 250),0), 1,
greatest(least(nom_variable, 500),251), 2,
greatest(least(nom_variable, 750),749), 3,
4)
Bonne chance.
Christopher www.iloveapple.com
null -
Urgent - 4/16 binary to hexadecimal decoder
Hi...
I have to send an example from multisim to my proffesor assistant, till 28.05.2008...
I have to create a decoder the will 4/16, that will decode binary equivalent digits to hexadecimal digits...
I really have no Idea how to do this with multisim...
Can someone make an example of it or make a tutorial how to do it...
thnx a lotMultisim has a very easy learning curve, especially for something this simple. Just place the components you want, click on their pins to connect them, and you are set. If you need instructions on placing parts, use the help file. (Hit F1)
Since I can't be doing your school work for you, I'll make a deal with you. You draw up the schematic you want to build and post it, and I'll put it together in multisim. If you weren't introduced to boolean algebra before being given this assignment, then you might be ill-prepared for this. Just stick to the basics: you have AND gates and you know how those work, so just use AND gates to take the inverted and non-inverted binary inputs and give a certain output for a given binary sequence, just like the example your assistant gave you.
Ryan R.
R&D -
Urgent Help needed with a Decode
Hi, I am trying to decode a field twice... I have two different query which I need to combine. I need to display if it has RBB, VALUE is 'Y', IF it is blank or different value value is 'N'
first query:
select distinct a.emplid, (DECODE (NVL ( b.SRVC, 'RBB'), 'RBB', 'N','Y') --If it has service line value RBB 'Y' OR if it does not have RBB
from prog a, srvci b make it 'N'
where a.emplid = b.emplid(+)
The result is
emplid srvc
00001 Y
00002 N
00008 Y
second query:
select distinct a.emplid, (DECODE (NVL ( b.SRVC, ' '), ' ', 'N','Y') --If it has service line 'Y' OR if it does not have any service line make
from prog a, srvci b it 'N'
where a.emplid = b.emplid(+)
The result is
emplid srvc
00001 Y
00002 N
00008 Y
00009 N
AFTER ALL, I need to display if it has RBB, VALUE is 'Y', IF it is blank or different value value is 'N'
Thanks you the helpSheri,
Post your table strcuture enclosed between \ to preserve formatting and/or your exact query.
\your code here
\Regards -
Please help with jce 1.2.1 encoding/decoding problem (urgent)
Hello,
env: jce 1.2.1,java 1.3,webstart. Server (Sun),client webstart
PBE encryption
The encryption done on client side, but problems become on some machines encryption comes diferent, we can not find where the problem is (encoding or locale seting)
please help
any help welcome
Nerijus Jasinskassoure atached:
Provider sunJce = new com.sun.crypto.provider.SunJCE();
Security.addProvider(sunJce);
pbeParamSpec = new PBEParameterSpec(salt, count);
pbeKeySpec = new PBEKeySpec(password);
keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec);
Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES");
pbeCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec);
byte[] cleartext = (new String(password)).getBytes();
ciphertext = pbeCipher.doFinal(cleartext); -
DECODE Function In Reports 3.0
Hi,
When I use the decode function in a query (Reports 3.0.5.8.0) I receive an error message "Bind Variable Does Not Exist" (ORA-1006). When I remove the decode function from the query, the query compiles fine. All table and column references are existing.
Also, the same query runs perfectly fine from SQL*Plus. The OS is Win 2000, SP2
Any idea if this is a bug? Is there any way out? Do get back as this is very urgent.
The database is Oracle 8i Ent, 8.1.7 on AIX 4.3
The query is as follows:
SELECT NAM_CMP , COD_CMP , COD_CMP_REG ,
DECODE(FLG_CMP_SHP,'Y','S/',' /') || DECODE(FLG_CMP_AGT,'Y','A/',' /') || DECODE(FLG_CMP_CNE,'Y','C',' ') TYPE ,
DES_ADD_STT , DES_ADD_PLC , DES_ADD_STA , DES_ADD_POS , COD_CTY , COD_cou_iso ,
DAT_LST_AST , DAT_LST_UPD,
cod_dcl_box_num, decode(cod_imp_chg_way,'C','CASH','CREDIT') cod_imp_chg_way,
decode(cod_imp_cre_way,'W','WEEKLY','F','FIFTEEN DAYS','M','MONTHLY', NULL) cod_imp_cre_way,
decode(flg_imp_prn_inv, 'N', null, flg_imp_prn_inv) flg_imp_prn_inv,
cod_bro_box_num, decode(cod_exp_chg_way,'C','CASH','CREDIT') cod_exp_chg_way,
decode(cod_exp_cre_way,'W','WEEKLY','F','FIFTEEN DAYS','M','MONTHLY', NULL) cod_exp_cre_way,
decode(flg_exp_prn_inv, 'N', null, flg_exp_prn_inv) flg_exp_prn_inv
FROM CMP
where dat_can is nullTry TO_CHAR(NULL) instead of NULL in all DECODE functions.
For example:
decode(cod_imp_cre_way,'W','WEEKLY','F','FIFTEEN DAYS','M','MONTHLY', TO_CHAR(NULL))
instead of:
decode(cod_imp_cre_way,'W','WEEKLY','F','FIFTEEN DAYS','M','MONTHLY', NULL). -
Hello All,
I have just started working in PL/SQL,
I need some help on 1 urgent issue.
i have a table lets say which has structure and values like below:
ID Data Key Data Value
1 Firstname X
2 Lastname Y
3 Middlename Z
but my query shd return me data having firstname ,middlenale and last name as column names and lvalues like lsited below:
Firstname Middlename Lastname
X Y Z
Please help and i really appreciate for your time and help!!!!!!!!!!
Thanks and RegardsUrgent? I don't think so.
However, as others have mentioned, what groups the items together so that the relationship is known between them?
SQL> ed
Wrote file afiedt.buf
1 with t as (select 1 as id, 'Firstname' as data_key, 'Fred' as data_val from dual union all
2 select 2, 'Surname', 'Bloggs' from dual union all
3 select 3, 'Middlename', 'J' from dual union all
4 select 4, 'Firstname', 'John' from dual union all
5 select 5, 'Surname', 'Doe' from dual union all
6 select 6, 'Middlename', 'D' from dual)
7 --
8 select id-decode(data_key,'Surname',1,'Middlename',2,0) as id
9 ,max(decode(data_key,'Firstname',data_val)) as Firstname
10 ,max(decode(data_key,'Middlename',data_val)) as Middlename
11 ,max(decode(data_key,'Surname',data_val)) as Surname
12 from t
13* group by id-decode(data_key,'Surname',1,'Middlename',2,0)
SQL> /
ID FIRSTN MIDDLE SURNAM
1 Fred J Bloggs
4 John D Doe
SQL>This example assumes that a Firstname, Surname and Middlename appear in that order with sequential ID's, such that the ID for Surname is always 1 more than the ID for it's associated Forename and the ID for Middlename is always 2 more than the associated Forename. -
VERY URGENT!! How to Pass a "% " symbol from form to Report
Hi
I am using oracle 10g and passing a symbol "%" as a parameter to the report from a form. But it shows error as follows:
REP-52006: Failed to decode the specified URL PARAMETER1=%.
But it is working when it runs in the Report directly.
Then Why we can't pass the symbol "%" to the report from form.
Please reply me as soon as possible. IT IS VERY URGENT !!Hi,
Try using a lexical parameter(&parm_1) for a string of values or a bind parameter(:parm_1) for a single value
Thanks,
Kimosabe
Maybe you are looking for
-
I want to update my contacts on my IPad and transfer it to my IPhone4. I tried backing up to ICloud (plugged in) but it didn't work. Anyone have any suggestions?
-
IPhoto 6 Not ready for primetime
I've had it with iPhoto 6! The program seems to have been released before it was ready. . . I've had numerous problems that have caused me to lose work and have made my entire system seem unstable (hello spinning beach ball!). The first problems occu
-
How to revert back from external display mode to laptop display mode?
Hi, I'm new to this community. I'm not sure if this is where I should be posting my questions. Anyway, I accidentally pressed fn + f2, which switched my laptop into external display mode (I'm pretty sure), and the screen is now very narrow and small.
-
PSE does not open any image nor it is possible to open a new file
Hello, having installed Photoshop Elements 13 for the first time on my Windows 7 Ultimate (64 Bit) computer it is a big disappointment. I cannot open any image. It does not matter whether it is on a network share or local disk. Have no deinstalled th
-
Lr 5.3 working with Mavericks 10.9
I have a Macbook pro that works with Lr 5.3 and an iMac 3 that does not import photos from any source?