Decode null with function call
Hi
Is it possible to use decode in select for the below scenario, if so what is the correct syntax
IF function one returns null I want to call display the value from function 2 in decode statement.
Regards
anna
Hi, Anna,
I would use COALESCE for that:
COALESCE (a1, a2, a3, ...)returns the first of its arguments (there can be as few as 2, and probably at least 100) that is not NULL.
If you need help, post some sample data (CREATE TABLE and INSERT statements), function code, and the results that you want from that data.
Similar Messages
-
UnsatisfiedLinkError with function call
Hi,
I am using JNI to make native function calls from Java.
I use
System.loadLibrary("myLibName");
to load my library, and that works without a problem.
I can use this library without any problems from a simple test app I wrote. However, I get an UnsatisfiedLinkError when I try and integrate with the rest of my applicaton. I am 100% certain that function is defined correctly in both Java and C++.
The only difference I can think of between my real application (which does not work) and my test application (which does work) is that in my real application, the object that makes use of the class that contains all my native methods is cloned before it makes any calls to my native code.
What can cause an UnsatisfiedLinkError if my System.loadLibrary() is correct, and my function definitions are also correct?
Thanks!
Eliott
Edited by: EliottH on Mar 1, 2010 12:17 PMIn case my post needs any clarification, here is some sample code that demonstrates what I am doing:
//An instance of this class gets cloned before any native function calls are made!
public class SomeClass implements Cloneable {
JniClass jniclass;
SomeClass() {
jniclass = new JniClass();
//This returns an UnsatisfiedLinkError when called
public void func() {
jniclass.nativeFunc1();
public void clone() {
//Something....
public class JniClass {
public native void nativeFunc1();
static {
System.loadLibrary("myLibName");
}Edited by: EliottH on Mar 1, 2010 1:00 PM -
Overriding sub-report queries in CF8 with function calls
There is not enough information in the documentation about
overriding sub-report queries using functions. I can not figure out
how the function call is to be passed.
Here is the page and quote from the livedocs:
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_r-s_07.html
"Note: You cannot specify a subreport query that depends on
arguments from the master report. Instead, you can define a CFML
function or CFC method that returns the subreport query given the
arguments from the master report. ColdFusion calls this code when
it executes the subreport."
If I send over just the function call as a string it throws
an error that it must be a query. If I evaluate it with # then it
appears to make the call once before creating the report and uses
the same query for the sub-report for every single master report
record.
My example report is simple. Retrieve a query of contacts
records. The contact records have a state field which is the
parameter for the sub-report. The sub-report performs a query and
presents related information.
I am trying to optimize this by pre-processing the queries
for each state into memory, then pass a function that is to be used
to get the correct sub-report query from memory.
I have tried all variations that I can think of with no
success. If I try to pass variables to the function that exist in
the report, such as query and param, errors are thrown. I can only
access variables already created earlier in my code which makes me
think that the function is being evaluated once in the cfqueryparam
tag. I can not find a way to delay evaluation so that it is
evaluated for each call to the sub-report instead.I'm following the instructions laid out in the livedocs for
advanced queries with CFML :
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=reportBuilder_17.html
However the Report Builder won't save the CFML I enter.
Everytime I go back to the Advanced query there are just blank
query tags. Most of the time it doesn't even show that any changes
were made to the report at all. The little asterisks does not
appear next to the report name tab which indicates if there are
unsaved changes. At some point I got it to save some code but it
had a mistake and I couldn't get it to save the corrected code.
This is very frustrating. I'm putting in a bug report for at
least the saving of CFML in the advanced query section. -
Personal recruitment How to do new measure with function call Update IT4000
Hi out there and happy new year to forum,
i want to update to implement a recruitment measure (Transaction PB40). I did it already with batch input, but i guess it's much more comfortable to do with funtion module, bapi or calsses.
After choosing the measure, the infogroup will be processed. So i guess, i just have to use the corresponding function modules to update the infotypes in a given sequence. is this suggestion right?
What are these function modules? How to update f.e. IT4000? Does anyone has a coding snippet?
Is it HR_INFOTYPE_OPERATION?
In our Infogroup there are also customer specific infotypes f.e. 9***. Can I use the sap standard function modules for "own implemented" infotypes?
I also appreciate an abap oo pattern or any similar....
Best regards,
TAndy Goris wrote:
But I don't think that it's possible to hire an application completly with function modules (there is no PERNR in the beginning so I would keep the BIM).
The applicants already exists in system, i just want to implement a measure with exact one click!
Otherwise there is a BAPI for applicant_create.
I'm not very expierienced focussing the implementation in pa-recruiting. I'm really looking for a good documentation or anything like that f.e. sap press.
Andy Goris wrote:
... but why would you use the old recruiting database? This is hardly used anymore.
What are the alternatives to it. (I'm not looking forward to upgrade releases or using wd4a or webgui). we are on ecc 6.0 There is already a lot of z-coding in recruitment. We are also using an self implemented e-recruiting approach
Edited by: Timo Ehl on Jan 3, 2012 2:30 PM -
Getting NULL with function in the select Query
Hi all,
SELECT
,a.TRANSACTIONAL_CURR_CODE
--,gl.CONVERSION_RATE
,get_rate(a.transactional_curr_code,NVL(gsob.attribute1,gsob.currency_code),a.conversion_type_code,TRUNC(a.ordered_date)) CONVERSION_RATE
FROM
oe_order_headers_all a,
oe_order_lines_all b,
gl_sets_of_books gsob
--gl_daily_rates gl
WHERE 1=1
and a.header_id = b.header_id
--and from_currency = 'USD' --a.transactional_curr_code
--and conversion_type = 'Corporate' --a.CONVERSION_TYPE_CODE
--and conversion_date = '23-APR-12' --a.ORDERED_DATE
and a.header_id =1234;
With commented above Line
0.749400479616307
NULL ---->Why i am getting NULL , i have a Value (0.07809)
18.521
Without comment above Code(Hardcoded Code or Commented Line)
18.521
0.749400479616307
0.07809
select transactional_curr_code,ORDERED_DATE from oe_order_headers_all
where header_id=1234
o/p:-
USD '23-APR-12'
select CONVERSION_RATE from gl_daily_rates
where from_currency = 'USD' --transactional_curr_code
and conversion_type = 'Corporate' --CONVERSION_TYPE_CODE
and conversion_date = '23-APR-12' --ORDERED_DATE
--and to_currency = 'USD'
CONVERSION_RATE
18.521
0.749400479616307
0.07809
select gsob.attribute1,gsob.currency_code from gl_sets_of_books
where SET_OF_BOOKS_ID=1
gsob.attribute1 gsob.currency_code
USD USDHi ,
Same as below code in the Function
select CONVERSION_RATE from gl_daily_rates
where from_currency = 'USD' --transactional_curr_code
and conversion_type = 'Corporate' --CONVERSION_TYPE_CODE
and conversion_date = '23-APR-12' --ORDERED_DATE
and to_currency = 'USD' -
Problem with function call from sql when using distinct
I have the following problem.
SELECT DISTINCT colA from tabA where my_function(colB) = 'TRUE'
This statement will return a handfull of results from a table with 70k + records. The function takes about 0.5 secs to execute.
How do i force the optimizer to do the select distinct first then execute the function on the results rather than execute the function for every single line first?
Thanks in advance
KeithLet's compare some of those methods:
michaels> CREATE OR REPLACE FUNCTION my_function (tr VARCHAR2)
RETURN VARCHAR2
AS
BEGIN
DBMS_APPLICATION_INFO.set_client_info (SYS_CONTEXT ('userenv','client_info') + 1);
IF LOWER (tr) LIKE '%name%'
THEN
RETURN 'TRUE';
ELSE
RETURN 'FALSE';
END IF;
END my_function;
Function created.
michaels> CREATE TABLE taba AS SELECT object_id cola ,object_name colb FROM all_arguments
Table created.
michaels> SELECT COUNT(*) FROM taba
COUNT(*)
78786
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> SELECT DISTINCT colA from tabA where my_function(colB) = 'TRUE'
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
78786
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> SELECT DISTINCT cola FROM (SELECT ROWNUM r, t.* FROM (SELECT DISTINCT cola, colb FROM taba) t)
WHERE my_function (colb) = 'TRUE'
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
14225
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> SELECT DISTINCT cola FROM taba WHERE (SELECT my_function (colb) FROM DUAL) = 'TRUE'
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
14281
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> SELECT DISTINCT cola FROM taba WHERE EXISTS (SELECT ROWNUM FROM dual WHERE my_function (colb) = 'TRUE')
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
13913
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> WITH temp AS
(SELECT DISTINCT colA, colB FROM tabA)
SELECT DISTINCT colA FROM temp WHERE my_function(colB) = 'TRUE'
167 rows selected.
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
78786
michaels> EXEC dbms_application_info.set_client_info(0)
michaels> WITH temp AS
(SELECT colB, my_function(colB) func FROM (SELECT DISTINCT colB FROM tabA))
SELECT DISTINCT colA FROM tabA a, temp t WHERE a.colB = t.colB AND t.func = 'TRUE'
michaels> SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
CI
78786 The combination with exists, rownum and dual gives the least calls to the function. -
Sqlldr WHEN clause with function call ?
I have a requirement to load data from a file with each row being checked for good data.
But that check is wrapped inside a function, as it is somewhat complex.
So I woul like to load the data with a WHEN clause like this
WHEN ( "CHECK_IF_GOOD(:field1, :field2,.. )" = '1' )
But sqlldr compains that column CHECK_IF_GOOD(:field1, :field2,.. ) is not present in tableA
Obviously sqlldr thought CHECK_IF_GOOD(:field1, :field2, ) to be a column name.
Is there any work around for this problemThe quotes and colons are not shown in the documentation for the when clause.
http://download.oracle.com/docs/cd/B14117_01/server.101/b10825/ldr_control_file.htm#i1005657
I do not know if you can invoke your own function in the Loader operation. -
Java.util.regex and replacing patterns with function calls
Hi everyone,
I'm in terrible need for help.
Any advice is much appreciated.
I have the following sentence in a file. The sequence of numbers is actually a
date in seconds since 1970. I need to identify the 9 or 10 sequence of numbers
send that to a method that will transate the numbers into a date in a string format.
Then replace it in the file.
Here is an example:
"My name is Peter. Please 1020421277 help me figure this out 108062327. "
using the following block I can convert it to this
"My name is Peter. Please | help me figure this out |. "
[block]
Pattern p = Pattern.compile("[0-9]{9,10}+");
Matcher m = p.matcher("");
String aLine = null;
while((aLine = in.readLine()) != null) {
m.reset(aLine);
String result = m.replaceAll("|");
out.write(result);
out.newLine();
[end block]
So I need to change the above block so that my sentence looks like this.
"My name is Peter. Please 05/03/2002 10:21:17 help me figure this out 06/04/1973 17:18:47. "
The method that converts the numbers into a date is not of a concern because I already have
the code to do that.
If anyone has suggestion, please let me know.
Thanks in advance.
Peter
[email protected]Never mind, I was able to figure it out....
Common2 cm = new Common2();
Pattern p = Pattern.compile("[0-9]{9,10}+");
Matcher m = p.matcher("");
m = p.matcher(s1);
while ((found = m.find())) {
String replaceStr = m.group();
System.out.print("\tReplaceString is: " + replaceStr);
replaceStr = cm.get_date(replaceStr);
System.out.println("\t\tConverted to: " + replaceStr);
m.appendReplacement(buf,replaceStr);
m.appendTail(buf);
----------------- The get_date method in Common2 looked like this ------------------------------
public String get_date(String myString)
String s;
long lsecs = Long.parseLong(myString);
lsecs = lsecs * 1000; // its now milliseconds.
// Determine default calendar and then the offset to GMT.
Calendar localCalendar = Calendar.getInstance();
int offset = localCalendar.get(Calendar.DST_OFFSET) + localCalendar.get
(Calendar.ZONE_OFFSET);
// Take the number of milliseconds subtract the gmtoffset
Date GMTdate = new Date(lsecs - offset);
// Format date
Format myformat;
myformat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss a z ");
s = myformat.format(GMTdate);
return s;
Peter -
Problem using function call in WHERE part of a Report's SQL query
I tried doing some searches on this, but couldn't find anything. I'm trying to run something similar to the following query in my report, but keep getting a "Query cannot be parsed within the Builder" error:
SELECT function1(TABLE2.ID) A
FROM TABLE1, TABLE2
WHERE TABLE1.ID = TABLE2.ID AND
TABLE1.NAME = 'BLAH' AND
TABLE2.DATE > SYSTIMESTAMP AND
(function2(TABLE2.ID) = 'YES' OR
function3(:USER_ID) = 'YES')
ORDER BY TABLE1.NAMEWhy won't this work? I can take out the 2 lines with function calls from the WHERE clause, and it works, so I'm assuming that APEX doesn't like something about my function calls. I know the functions are valid and work properly, because I tested them independently. Can anyone see what the problem is? Thanks!Here's the actual query:
SELECT BUILD_EXT_RES_LIST(EXT_FILE.ID) A
FROM EXT_FILE_RES, EXT_FILE
WHERE EXT_FILE_RES.ON_OWNER_PROFILE = 'Y' AND
EXT_FILE.OWNER_ID = :PROFILE AND
EXT_FILE.ID = EXT_FILE_RES.EXT_ID AND
(RES_SUBSCRIBER_YN(EXT_FILE.ID,:CURR_ID) = 'YES' OR
ADMINYESNO(:CURR_ID,:PROFILE) = 'YES')
ORDER BY EXT_FILE.FILE_NAMEAnd here's the actual error message:
1 error has occurred
Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00904: "SER_IS_ADMINYESNO": invalid identifier -
I am experiencing this error with one of our cluster environment. Can anyone help me in this issue.
The Cluster Service function call 'ClusterResourceControl' failed with error code '1008(An attempt was made to reference a token that does not exist.)' while verifying the file path. Verify that your failover cluster is configured properly.
Thanks,
Venu S.
Venugopal S ----------------------------------------------------------- Please click the Mark as Answer button if a post solves your problem!Hi Venu S,
Based on my research, you might encounter a known issue, please try the hotfix in this KB:
http://support.microsoft.com/kb/928385
Meanwhile since there is less information about this issue, before further investigation, please provide us the following information:
The version of Windows Server you are using
The result of SELECT @@VERSION
The scenario when you get this error
If anything is unclear, please let me know.
Regards,
Tom Li -
RFC hangs with a call to function module SSFC_PARSE_CERTIFICATE
Hello ,
We are working on BI 7.0 SP9 .
When we try to test the RFC connection from the WAS Abap to the portal ( WAS JAVA ) using SM59 , the test is hanging but we can read in the bottom of the screen 'Connexion bcv51sf2... OK' !!!
The test connection works sometimes .
But when its not working , with the debug mode , I can see that the program SAPLSSFG/LSSFGU19 is hanging in the function module SSF_GET_PARAMETER with a call to the function SSFC_PARSE_CERTIFICATE
CALL FUNCTION 'SSFC_PARSE_CERTIFICATE'
EXPORTING
CERTIFICATE = PABCERT
IMPORTING
SUBJECT = STR_PROFILEID
EXCEPTIONS
SSF_KRN_ERROR = 1
SSF_KRN_NOMEMORY = 2
SSF_KRN_NOSSFLIB = 3
SSF_KRN_INVALID_PAR = 4
OTHERS = 5.
ENDIF.
ENDIF.
ENDFUNCTION.
The variable STR_PROFILEID has the value of the field ID of the table SSF_PSE_H
STR_PROFILEID =CN=QWO, OU=XXXXX, O=YYYY, C=FR
Due to this error , we cant transport BI Web templates because at the end of the import in the method execution of the transport there is a call to the portal with the RFC. And the transport is hanging
Thanks in advance for you help .
Happy new year. Milan.Hi Frank ,
See below the result of the test :
Test for function group SSFG
Function module SSF_GET_PARAMETER
Export parameters
Value
APPFOUND
<SYST>
SSFTOOLKIT
SAPSECULIB
STR_FORMAT
PKCS7
STR_PAB
/usr/sap/QWO/DVEBMGS01/sec/SAPSYS.pse
STR_PAB_PASSWORD
STR_PROFILEID
CN=QWO, OU=XXXX, O=YYYY, C=FR
STR_PROFILE
/usr/sap/QWO/DVEBMGS01/sec/SAPSYS.pse
STR_PROFILEPW
STR_HASHALG
SHA1
STR_ENCRALG
DES-CBC
B_INCCERTS
X
B_DETACHED
B_DISTRIB
X
But my problem now , it's that 1 of the 2 RFC is working fine and the other one after 1 good rfc test , is hanging now at the end of the function 'CONVERSION_EXIT_ISOLA_OUTPUT' line 14 !!!
See below the ABAP stack just before the hanging .
1 FUNCTION CONVERSION_EXIT_ISOLA_OUTPUT.
2 *"----
3 ""Lokale Schnittstelle:
4 *" IMPORTING
5 *" VALUE(INPUT)
6 *" EXPORTING
7 *" VALUE(OUTPUT)
8 *"----
9 OUTPUT = SAVE_INPUT(1) = INPUT.
10 CHECK SAVE_INPUT(1) NA ' *'.
11 SELECT SINGLE * FROM T002 WHERE SPRAS = INPUT.
12 CHECK SY-SUBRC = 0.
13 OUTPUT = T002-LAISO.
14 ENDFUNCTION.
Stack Dep Event type Event Program Include Line
10 FUNCTION CONVERSION_EXIT_ISOLA_OUTPUT SAPLLANG LLANGU04 14
9 FORM CONVERSION_EXIT SAPCNVE SAPCNVE 107
8 EVENT SYSTEM-EXIT SAPLDSYA <SYSINI> 20
7 FUNCTION DOKU_OBJECT_EXIST SAPLDSYA LDSYAU09 43
6 FORM FILL_EXCL_TAB RSDBRUNT RSDBRUNT 5.664
5 FORM %_INIT_PBO_LAST RSDBRUNT RSDBRUNT 4.061
4 FORM INIT_PBO RSDBRUNT RSDBRUNT 3.666
3 FORM %_INIT_PBO_NEW RSRFCPIN RSRFCPIN 496
2 MODULE (PBO) %_INIT_PBO RSRFCPIN RSRFCPIN 496
1 EVENT SYSTEM-EXIT RSRFCPIN <SYSINI> 20
As i said in the first post , the RFC test is hanging sometimes but now it seems that it's not hanging everytime at the same line of the abap code , if i can trust the debugger !
...and after another RFC test , now all the RFC to the portal are working ...
It seems that when it's hanging , it's at the end of the functions ( SYSTEM_CALLSTACK
or CONVERSION_EXIT_ISOLA_OUTPUT or SSF_GET_PARAMETER ) .
A memory or OS problem ?
Best Regards. Milan. -
iTunes crashes when doing a power search. I get a Microsoft Visual C Runtime Library Error message: Program C:\Program Files (x86)\iTunes\iTunes.exe R6025. Pure virtual functional call. If I select ok, Windows 7 pops up with iTunes has stopped working and then it shuts iTunes down. Anyone else every have this issue. Any ideas on a fix?
Thanks,For general advice see Troubleshooting issues with iTunes for Windows updates.
The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down page in case one of them applies.
Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
tt2 -
Function Module to create Delivery with JIT Calls
Hi SAP Guru's,
We are working on SAP 4.6C version.
I am looking for a function module to create delivery with JIT Calls.
We are currently using the SAP standard function module "SHP_VL10_DELIVERY_CREATE" to create Delivery with JIT Calls. Each JIT Calls has apx 60-80 materials in it and each material refers to a unique Scheduling Agreement. This function module is taking very long time in production server to create delivery, it does not take much time in dev or quality server.
We have JITV setting profile (For Sold To Party and Partner Description Profile) set as RELACE (to summarize the line items in JIT Call).
Is there another function module that we can use to create delivery with JIT Calls?
Thanks in Advance,
AmitHi there,
There is no such function module.
Regards
Sanju -
Package/procedure/function calls done with in a package
Hi Experts,
Can anybody suggest me the table/ a query to find the package/procedure/function calls (with in the same db or remote) done with in a package.
It would be great if we can provide a tree like structure of the objects being called/used.
btw.. dba_dependencies will provide me the info about the global procedures only not the local ones used with in the package body.
Appreciate your time..
Thanks
Manjumanjukn wrote:
Hi Experts,
Can anybody suggest me the table/ a query to find the package/procedure/function calls (with in the same db or remote) done with in a package.
It would be great if we can provide a tree like structure of the objects being called/used.
btw.. dba_dependencies will provide me the info about the global procedures only not the local ones used with in the package body.
Appreciate your time..What database version do you have?
11g I think provides some sort of fine grained dependency information which can detail packages, but prior to 11g you can only get dependencies on the database objects themselves of which functions/procedures within a package are not, as the package itself is the object.
I don't think there's any easy way to find out from any tables or views and I think third party tools would have to parse the code to determine such things themselves, so that may be one of your only options. -
Function call in SAP GUI with errors
Dear All,
When i am calling FM of Comports using OLE Integration i got " Function call in SAP GUI with errors" error
now my front end version is 6.40. how to solved this problem.
In my Function Module i am creating object like this
CREATE OBJECT O_OBJ 'MSCOMMLib.MSComm.1'.
IF SY-SUBRC <> 0.
RAISE NO_CREATE_OBJECT.
ENDIF.
it raised the sy-subrc = 2 this error is "Function call in SAP GUI with errors"
send to me how to handle this error.
Thank,
Vijay.gHi Vijay,
We are facing the same issue.
Interestingly
From program's code only we are facing this issue.
If we display the program and Execute (Direct processing), it is working fine.
Can you please share how you resolved this issue.
Thanks
Sreedhar
Maybe you are looking for
-
Images shrink in Viewer but not in Designer
I had Dynamically linked pictures that were created with CR 8.5. This required me to have an OLE server (old microsoft editor). I uploaded the picture to the database in an image file and now when I try to diplay the pictures it diplays it as a tiny
-
the service i was using server went down for a couple of hurs but ever since it came back up i cant find it in the itunes store anymore so my subscribers cannot get the new show. i tried re submiting the feed but itunes says they already have it here
-
How do I print a list of previous purchases?
I pulled up my purchase history in Itunes 11.0.4.4, and chose file>print, but all I got was a printout of the accounts screen, not the purchases. Is there a way to print out a detailed list of the purchases? Paul.
-
Retaining links when deleting multiple files
Hi there, I need to delete a lot of files from a project, but I don't want to lose the links to those topics in other files. If I delete a single file, Robohelp HTML displays a dialog box that gives the option to keep references to that file in other
-
Bapi for TRANSACTION CODE CO15
Dear all, Any BAPI available for creat production order confirmation (T.CODE = CO15) Regards Das