Help for decode function
Hi all,
I want to use decode function in RTF template.
I know i can use if statement to deal with it ,but if the conditions are over 3, if statement is not good choice.
Here is the if condition statement
<?if:answer='Y'?>Yes<?end if?> <?if:answer='N'?>No<?end if?>
how can i translate this if statement to use decode function
I tried to use the statement as below, but it doesn't work.
<?xdofx:decode(:answer,Y,'YES',N,'NO')?>
using this statement i got empty in this field.
I appreciate any responds, thanks in advance.
appcat
Hi,
it should work,coz there is no xsl equivalent for this function that i have seen on blogs,
the syntax that i have got it from other xmlp blogs, sounds like you put correct syntax, try to give multiple conditions to check the result
<?xdofx:decode(’xxx’,’bbb’,’ccc’,’xxx’,
’ddd’)?>
srinuk
Similar Messages
-
Help on Decode function in Toplink
Hi,
I have a sql statement like this:
select field1, field2 from table1 where upper(field1) like 'ADELPHI%'
order by field1,
DECODE(TO_CHAR(NVL(LENGTH(TRANSLATE(field1,'A1234567890','A')),0)),'0',LPAD(field1 ,50),field1)
How would I converted this to toplink query?
I appreciate any help you guys can extend to me.I just spent about a half hour writing a response here, and the damned forum timed out on me. #$^!@$#!^!@$%.
Here is the summary:
- Using TL Expressions and EJBQL are to allow Java developers who don't necessarily know SQL to write queries and to facilitate portability/maintainability of the apps. For REALLY gnarly queries, using TL Expressions or EJBQL won't buy you this. I.e., SQL is more expressive and easier for this kind of quer, so it's not easier to use, and frankly with the code needed to support it, it won't be easier to maintain or port... Bottom line, maybe SQL is the best option here?
- If you want to experiment, search for TO_CHAR on this forum, and the decode function in the javadoc. You need to build the expressions in pieces and you can treat expressions as arguments to other expressions -- in other words, you can build an expression like builder.leftPad(50, builder.get("field1")) and use it as one of the key/values in the hashtable to the decode function (in theory).
- Don -
Need help for the Function Module 'PFL_GET_PARAMETER_INFO'
Hi Experts,
The FM 'PFL_GET_PARAMETER_INFO' returns the value for Profile Parameters for a system .
The inputs required for this FM are :
1. Parameter name : ( eg . login/min_password_lng etc. )
2 . Parameter Type
I am not sure about what the value of Parameter Type should be .
Its a mandatory field.
I have tried to search but could not find anything.
Can you please help me on this?
Thanks in Advance,
Harshit Rungta
Edited by: harshit rungta on May 27, 2011 8:15 AMWhat exactly is the use-case for this?
Many developers "c-call" the params and neglect this feature of the type - also whether it is static or dynamic. Some params are even dynamic as system profiles in one direction but static as instance parameters in the other direction when changing the value.
As you cannot create your own system profile parameters, I do not see the use-case for why you are wanting to check it in advance, because the application APIs should do this.
What you are possibly looking for is function module SUSR_GENERATE_PASSWORD in this case. It will respect "the rules" in the params.
Do not use the legacy function RSEC_GENERATE_PASSWORD directly.
Cheers,
Julius -
Need help with DECODE function
Hello,
I am trying to use default within the decode function and every time I get a missing expression. I have searched everywhere and cant figure out what I'm doing wrong. Thanks
select decode (request_id,0,'No files found', DEFAULT)Hi,
Welcome to the forum!
When you use a default value, the last argument to DECODE is the actual value you want as a default.
For example:
SELECT ename
, deptno
, DECODE ( deptno
, 30 , 'Sales'
, 'All others' -- Default value
) AS dname
FROM scott.emp
ORDER BY ename
;Output:
ENAME DEPTNO DNAME
ADAMS 20 All others
ALLEN 30 Sales
BLAKE 30 Sales
CLARK 10 All others
FORD 20 All others
JAMES 30 Sales
JONES 20 All others
KING 10 All others
MARTIN 30 Sales
MILLER 10 All others
SCOTT 20 All others
SMITH 20 All others
TURNER 30 Sales
WARD 30 Sales
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
If you can show the problem using commonly available tables (such as those in the scott schema) then you don't need to post any sample data; just the results and the explanation.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002} -
Find collective Search Help for partner function at runtime
Hi experts,
I have a screen very similar to VF05. When I enter the partner function, the corresponding field for the partner function, I want a collective search help to open.
If I enter the partner function - Employee responsible, then the search help PERM has to be called or for partner function Payer, I want the search help DEBI to be called. Can anyone let me know how can I get the related partner functions, without hardcoding for every partner function. Something similar to the VF05 report.
Warm Regards,
AbdullahHi,
Collective search helps:- Combination of elementary search helps. When we need to fetch data based on multiple selection criteriau2019s. More than one tables are Selection from multiple tables
Steps for creating collective search help.
1) Enter the search help name and click on create.
2) Choose Collective search help radio button option as the search help type.
3) Enter the search help parameters.
Note that there is no selection method to be entered for a collective search help.
4) Instead of the selection method, we enter the included search helps for the collective search help.
5)We need to assign parameters for each of the included search helps.
6) Complete the parameter assignment by clicking on the push button.
7) Collective search help offers the user to obtain F4 help using any of the included search helps.
Hope this helps u.
thanks -
Search help for partner functions in the message to get organisation unit O
hello,
Depending on the Business partner category (Organisation, Person,Group) the search help of the partner function in a message should return the corresponding partner list.
This is working fine for standard partner functions like SLFN0002 (reported by=P) SLFN0003 (support team=O). When doing a searchhelp we get a list of organisation for the "support team" and a list of users for "reported by". this is a normal behaviour.
When copying the partner function SLFN0003 into a new ZLFN0003 and including it in the partner profile of the message the search help returns all business partners of category P but should return category O. The function category 0016 (service team) is well defined for ZLFN, I guess the link to business partner category is made indirectly there but I might be wrong.
Does anyone of you experience the same behaviour ? Any idea how to correct this ?
thank you for your help
XavierHi,
Collective search helps:- Combination of elementary search helps. When we need to fetch data based on multiple selection criteriau2019s. More than one tables are Selection from multiple tables
Steps for creating collective search help.
1) Enter the search help name and click on create.
2) Choose Collective search help radio button option as the search help type.
3) Enter the search help parameters.
Note that there is no selection method to be entered for a collective search help.
4) Instead of the selection method, we enter the included search helps for the collective search help.
5)We need to assign parameters for each of the included search helps.
6) Complete the parameter assignment by clicking on the push button.
7) Collective search help offers the user to obtain F4 help using any of the included search helps.
Hope this helps u.
thanks -
Hello!!
Can anyone please help me with the decode statement
Table 1 Table2 Table3
Id Id Code
Volume Code
For each of the codes in Table3 I need to find the corresponding Volume. Can I use decode in the select statement to this,
Eg Code Volume
ABC 20
XYZ 10 etc etc.
Thankyou all in advance.Your table structure is a little unclear from your post. I am assuming that what you posted was:
Table 1
Id
Table2
Id
Code
Table3
Volume
Code You can use decode if there are only a few values for table3. For example,
SELECT table2.code,
DECODE(table2.code,'ABC',10,'XYZ',20,'UNKNOWN') volume
FROM table2
or even
SELECT code,DECODE(code,null,'NONE',
(SELECT volume FROM table3 where code=table2.code)) volume
FROM table2However, the first will break, or at least be incorrect, if anyone adds a new code/volume pair, and is tedious if you have more than a few values. The second will likely be pretty slow if there are a large number of records in table3. The best solution would be to use a simple join rather than decode. Something like:
SELECT table1.id, table2.code, table3.volume
FROM table1, table2, table3
WHERE table1.id = table2.id and
table2.code = table3.code -
Need Help for useOneAsmany function
My input structure is <Record> 1- unbounded
<header> 1-1
<Data1> 1-unbounded
<data2> 1-unbounded
<footer> 1-1
i want to create the IDOC for data1 and data2 and using the header field while creating the IDOC.So i'm using useOneAsMany for achieving this and its working fine.
But when i duplicate the <record> node I get the following error:
"Too many values in first queue in function useOneAsMany. It must have the same number of contexts as second queue."
Is it possible to use useOneAsMany when the file contains more than 1 record?or is it possible for only one record. Please help me in this
Thanks in advance
SreediviaHi,
Same problem i faced, are you using E1EDP01 node?
If yes it happens only once, don't duplicate that node.
One as Many : we have one value in the source side, but we can use that many times in the target sede in this
conditions we can use this node function.
Here it takes 3 inputs, first value represents the value to populate in the target side
second value represents howmany times the first value occur in the target side and the
third value represents where the context should change.
watch this blog for one as many node function. /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping -
Need help for Conversion Function in Oracle
Hi, Can Any One help me Please.
I need a Oracle conversion script for converting from decimal to hex. and decimal to datetime.
Thanks In Advance.Hi,
for the Hex-Number-conversion see:
[url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
What number format do you have? YYYMMDD
Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
Please describe further.
Bye
stratmo -
Help for analysis function in PRO*C
In a PRO*C code, I wrote the following parts including an analysis function:
xec sql select a, b, max(c) over ( partition by a)
into ...
from t1
but it gave me the error when compiling:
Syntax error at line 63, column 35, file test.pc:
PCC-S-02201, Encountered the symbol "(" when expecting one of the following:
, into, from,
Error at line 0, column 0 in file SM_PageDel.pc
PCC-F-02102, Fatal error while doing C preprocessing
This SQL is all right when putting it into sqlplus. My question is : in PRO*C, it doesn't allow to use analysis function?
I'm very hurry for this question. Please help me if you know. Thanks in advanced!
My msn: [email protected]Hi Mark,
Sorry for continuing on the same thread. My issue is almost related to this answer here. But i have Oracle 10.2.0.4. I get the same error when i use "PERCENT_RANK()". I tried doing the dynamic method as suggested by you in this thread. But it does not help. There are more errors for that. Please help me in solving this issue :
Here are the details :
The Pro*C code :
================================================== ========
int srccct2_insert()
EXEC SQL
select * from (
select
trad_code,
comp_code,
file_code,
insp_yymm,
poly_numb,
entr_numb,
data_code,
caus_date,
insd_code,
rule_ordr,
sex_code,
entr_age,
resd_numb,
entr_name,
hire_date,
entr_date,
work_year,
hire_grad,
datt_entr,
ijry_entr,
wkdt_entr,
base_saly,
expt_amnt,
rsrv_rato,
rsrv_amnt,
PERCENT_RANK() OVER (ORDER BY base_saly) pr
FROM SRCCCT2
where trad_code = 'N' AND
comp_code = '01' AND
insp_yymm = '200403' AND
data_code = 'B' AND
hire_grad = '2' AND
base_saly > 0)
where pr > 0.05 and pr < 0.95 and base_saly > 641840;
return SUCCESS;
================================================== ======
I am compiling it like this :
/oracle/product/10.2.0/bin/proc iname=srascs01.pc ireclen=320 oreclen=320 sqlcheck=full userid=retr/rteru maxopencursors=32 dbms=v8 char_map=varchar2 release_cursor=yes include=/oracle/product/10.2.0/precomp/public include=/ihome/hp/../common/include include=/ihome/retr/include include=/usr/include include=/ihome/hp/portlib DEFINE=HPUX
I have put the same sql statements in the sql promt and it works fine. But in Pro*C when i compile it using above options, here is the error :
================================================== ======
Pro*C/C++: Release 10.2.0.4.0 - Production on Thu Feb 25 00:57:42 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
System default option values taken from: /oracle/product/10.2.0/precomp/admin/pcscfg.cfg
Syntax error at line 192, column 28, file srascs01.pc:
Error at line 192, column 28 in file srascs01.pc
PERCENT_RANK() OVER (ORDER BY base_saly) pr
...........................1
PCC-S-02201, Encountered the symbol "(" when expecting one of the following:
, into, from,
Error at line 0, column 0 in file srascs01.pc
PCC-F-02102, Fatal error while doing C preprocessing
*** Error exit code 1
Stop.
*** Error exit code 1
Stop.
================================================== =======
If i use dynamic method, here is the error :
Syntax error at line 165, column 1, file srascs01.pc:
Error at line 165, column 1 in file srascs01.pc
"select * \
1
PCC-S-02201, Encountered the symbol ""select * \
from \
select trad_code, \
comp_c" when expecting one of the following
============================================================
Request you to help me.
-Kumar -
hii all
i am somehow unable to find a function for finding the current month
i.e. i want to find the records for the current month
plzz help me with the problem
mandarfor current month:
SELECT to_char(sysdate, 'MON') FROM dual
ex:
SELECT *
FROM table
WHERE to_char(field_date, 'MON-YYYY') = to_char(sysdate, 'MON-YYYY')
hope it helps -
I am getting ORA-00904: "ITEM_NUMBER": invalid identifier. thanks for the help
SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) item_number,
idescr short_description, idescrl long_description, iunits unit_name,
ispecyr spec_year, iobselet, item,
ROW_NUMBER () OVER (ORDER BY DECODE
(insortexp, 'item_number ASC', item_number) ASC,
DECODE (insortexp, 'short_description DESC', short_description) DESC,
DECODE (insortexp, 'long_description ASC', long_description) ASC,
DECODE (insortexp, 'unit_name DESC', unit_name) DESC,
DECODE (insortexp, 'spec_year ASC', spec_year) ASC,
item_number)
FROM itemlist
thank you for the reply. I am still getting this an error. this is the error:
PL/SQL: ORA-00904: "ISPECYR": invalid identifierCREATE OR REPLACE PACKAGE BODY trnsportitems
AS
PROCEDURE gettrnsportitems (
instartrowindex IN NUMBER,
inendrowindex IN NUMBER,
insortexp IN VARCHAR2,
outtotalrows OUT NUMBER,
outitemcur OUT myrefcur
IS
BEGIN
SELECT COUNT (*)
INTO outtotalrows
FROM itemlist;
IF (inendrowindex = -1)
THEN
OPEN outitemcur FOR
SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)
) item_number,
idescr short_description, idescrl long_description,
iunits unit_name, ispecyr spec_year, iobselet, item
FROM itemlist
ORDER BY item;
ELSE
BEGIN
OPEN outitemcur FOR
SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)
) item_number,
idescr short_description, idescrl long_description,
iunits unit_name, ispecyr spec_year, iobselet, item
FROM (SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) item_number,
idescr short_description,
idescrl long_description, iunits unit_name,
ispecyr spec_year, iobselet, item,
ROW_NUMBER () OVER
(ORDER BY DECODE (insortexp, 'item_number ASC', item) ASC,
DECODE (insortexp, 'short_description DESC', idescr) DESC,
DECODE (insortexp, 'long_description ASC', idescrl) ASC,
DECODE (insortexp, 'unit_name DESC', iunits) DESC,
DECODE (insortexp, 'spec_year ASC', ispecyr) ASC,
SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) r
FROM itemlist)
WHERE r BETWEEN instartrowindex AND inendrowindex;
END;
END IF;
END;
END;
/ -
IOS Numbers crashes very time I try to use "Help" for a function
On both my iPad and iPhone (both at latest iOs level) every time I touch the "i" to get information about a function on Numbers the app crashes.
Anyone one else experiencing this or know a fix?
II've tried closing the app, restarting powering off and restarting the devices with no result.Generally, you are more likely to get an answer if you post in the iWork for iOS forum at
https://discussions.apple.com/community/app_store/iwork_for_ios
Cheers, Tom
BTW - Your profile shows you are using iOS 6. That's not the latest iOS version. -
Need help for Count function in XSLT Mapping
Hi All,
We have a requirement in our project,to do the xslt mapping from OAGIS 9.0 to EDI XML.In the EDI XML we have a SE tag whose value is the count of the no. of complex elements that will be generated in the EDIXML file( which is the target).
Please do let me know if anybody has done this functionality in the xslt mapping.
Thanks in Advance.
Regards,
KaavyaHi,
for the Hex-Number-conversion see:
[url http://psoug.org/snippet/Convert-Hex-to-Decimal-Decimal-to-Hex_78.htm] self-defined Conversion-Functions
What number format do you have? YYYMMDD
Or is there a Date corresponding to 1 and a number n represent the date n-1 days after day 1?
Please describe further.
Bye
stratmo -
Urgent help for table function
I Have a table tab1
SQL> select * from tab1;
A B C
maqdoom 12 syed
aamer 323 army
king 343 khan
keerthi 52 kaat
I Have created an Object
CREATE TYPE object_row_type AS OBJECT1 (
name VARCHAR2(30),
lname VARCHAR2(18))
CREATE TYPE object_table_type1 AS TABLE OF object_row_type1;
I write a function such a way that
when we enter a trackinnumber it return the whole record with respective the query
CREATE OR REPLACE FUNCTION test1 (trackingnumber IN NUMBER)
RETURN object_table_type1
IS
--tracking_num NUMBER (10);
v_tab object_table_type1 := object_table_type1 ();
BEGIN
FOR cur IN (SELECT a AS NAME, c AS LNAME
FROM TAB1
WHERE b=trackingnumber)
LOOP
v_tab.EXTEND;
v_tab(v_tab.LAST) :=object_row_type1(cur.name,cur.lname);
end loop;
RETURN v_tab;
END;
every thing runs fine
But
Can an one show me
1. how to handle an exception ... when someone enters a wrong tracking number I should get some message displaying that 'its a wrong tracking number'.
thank youSQL> CREATE TYPE object_row_type AS OBJECT(
2 name VARCHAR2(30),
3 lname VARCHAR2(18));
4 /
Type created.
SQL> CREATE TYPE object_table_type AS TABLE OF object_row_type;
2
3 /
Type created.
SQL> select * from test;
A B C
maqdoom 12 syed
aamer 323 army
king 343 khan
keerthi 52 kaat
SQL> CREATE OR REPLACE FUNCTION f1 (trackingnumber IN NUMBER)
2 RETURN object_table_type
3 IS
4 cnt number := 0;
5 v_tab object_table_type := object_table_type ();
6 BEGIN
7 FOR cur IN (SELECT a AS NAME, c AS LNAME
8 FROM test
9 WHERE b=trackingnumber)
10 LOOP
11 cnt := 1;
12 v_tab.EXTEND;
13 v_tab(v_tab.LAST) :=object_row_type(cur.name,cur.lname);
14 end loop;
15 if cnt = 0 then
16 dbms_output.put_line('No data!');
17 end if;
18 RETURN v_tab;
19 END;
20 /
Function created.
SQL> set serverout on
SQL> declare
2 a object_table_type;
3 begin
4 a := f1(12);
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 declare
2 a object_table_type;
3 begin
4 a := f1(1);
5* end;
SQL> /
No data!
PL/SQL procedure successfully completed.
<br>
<br>
But you can use BULK COLLECT here..
Try it yourself..
Maybe you are looking for
-
How to get photos into photo stream?
How do you get photos from your iPhone camera roll into photo stream?
-
Desktop picture linked to other sites.
I do not have a company website yet. Instead for the time being I would like to link pictures (that I have on my desktop) of products I have in develpment to sites like LinkedIn and Twitter. If this can be done please explain how. I have a Macbook. T
-
Open tabbed panels from dropdown list option value
I have about 10 tabbed panels on my page. I created a dropdown list, <option value></option value>. I need to open the specific panel when an option is selected from the dropdown list. I know how to open tabbed panels by URL, a button, and a link on
-
In Messages, I can't get it to let me log into iMessages.
I can log into any of my app id account any where exept in messages on my mac book pro.
-
Error 2: Failure to perform LabVIEW license activation
I bought and downloaded LabVIEW student edition. When i downloaded it, it all went fine. Then when i got to the page to put in a serial #, i put the one that the download gave me, and a message popped up saying, "Error 2: Failure to perform LabVIEW L