Lookup return value string as Function
The only way which I know of is to define mapping parameters with the IsExprVar flag checked; then you can provide each individual business rule for one session run, source all records which have to be processed by this particular business rule and process them, and repeat the whole process until all business rules have been used. Regards,Nico
Hi,I have a requirement to load close to 100 files. Each files has different business rules. Business Rules are saved in tableI'm planning to create one stage mapping and use the lookup to read the business rule apply them, but INFA is treating the look up return values as string and not as function.. Is there a way to make INFA treat them as function Eg: Business Rule : col1|| col2 INFA load them as "col1||col2", instead of subsituting col1 value Thanks
Similar Messages
-
Problem loading images from a return value of a function
hello, I write because I uin problem in loading images from a return value of a function.
I created a database with a field "image" of type string, where I put the physical address of the image. I have written like this: {__DIR__ }foto.jpg
Place the code, so you understand better
function imageViewImage(): javafx.scene.image.Image {
connetti();
lass.forName(driverName);
con = DriverManager.getConnection(url,user,"");
stmt = con.createStatement();
var richiesta:String = "SELECT image from viaggio WHERE id_viaggio=7";
rs1 = stmt.executeQuery(richiesta);
var result :String;
rs1.next();
risultato = rs1.getString("image");
JOptionPane.showMessageDialog(null, result);
var imagez = Image{
url:"{result}";
return imagez;
The image is in the source code package
First I connect to the database, run the query and I take the contents of the image.
Can anyone help me?
Is right to put in the database {__DIR__} foto.jpg or do I put only foto.jpg?Hello unkus_nob,
I would rather suggest you to save only filename of that image like "foto.jpg" in database. And just concat it with the String variable containing "{__DIR__}".
Actually the javafx compiler converts the {__DIR__} to the existing class directory path something like : "jar:file:/..../".
var currentDir ="{__DIR__}";
risultato = "{currentDir}{rs1.getString("immagine"})";
var image = Image{
url:risultato
return image;--NARAYAN G. -
Getting Return values from RFC function call with visual basic
Hi,
I am creating a sample app to connect to a SAP system which call its RFC functions created with ABAP. It was known that the function will return more than 1 return values.
SAP Function name ==> "ZFMTP_RFC_GET_RESULT"
Export parameters (to SAP):
- Student Name [char 10] ==> "STUNAME"
- Student ID [char 20] ==> "STUID"
Return values (From SAP):
- Results [char 10] ==> "RESULT"
- Remarks [char 200] ==> "REMARKS"
i have managed to get sample codes for connecting and call a RFC function with vb but they only get a return value. How do i retrieve multiple return values like the above function "RESULT" and "REMARKS"?
Here's my vb code to accessing the function
Dim R3 As Object
Dim FBFunc As Object
Dim returnFunc As Boolean
Dim connected As Boolean
R3 = CreateObject("SAP.Functions")
R3.Connection.Client = "000"
R3.Connection.User = "BCUSER"
R3.Connection.Password = "minisap"
R3.Connection.Language = "DE"
R3.Connection.System = "dtsystem"
R3.Connection.Applicationserver = "xxx.xxx.xxx.xxx"
connected = R3.Connection.Logon(0, True)
If connected <> True Then
MsgBox("Unable to connect to SAP")
End If
FBFunc = R3.add("ZFMTP_RFC_GET_RESULT")
FBFunc.exports("STUNAME") = "Jonny"
FBFunc.exports("STUID") = "12345"
returnFunc = FBFunc.Call() <<== How do i get the return value? or RESULT and REMARKS of the RFC Function?
thanks alot.
Edited by: Eugene Tan on Mar 4, 2008 7:17 AMHi Gregor,
Thanks for the link....i am having some doubts with the codes, hope you can clarify them for me if you know the codes..
Below is the code snippet.
Set impReturn = CHPASS_FN.Imports("RETURN") <<=== is RETURN the standard keyword to get a return object?
expPassword.Value = currpass
expNewPass.Value = newpass
expFillRet.Value = "1"
''' Call change password function
If CHPASS_FN.Call = True Then
outFile.Write (", Called Function")
Message = impReturn("MESSAGE") <<==== So if i have 3 return values..i just replace with the return value variable names?
outFile.WriteLine " : " & Message
Else
outFile.Write (", Call to function failed")
End If
thanks alot...all your help is very appreciated. -
How to Access the Return Value of a Function
Hi,
How do I access the return value when calling an Oracle function from .NET using Oracle.DataAccess.Client? The function returns an integer of 0, 1 or 99.
Dim db_command_oracle As New OracleCommand()
db_command_oracle.Connection = db_connection_oracle
db_command_oracle.CommandType = CommandType.StoredProcedure
db_command_oracle.CommandText = "swsarsi.import_appointments"
Dim ret_value As New OracleParameter()
ret_value.OracleDbType = OracleDbType.Int32
ret_value.Direction = ParameterDirection.ReturnValue
ret_value.Size = 2
ret_value.OracleDbType = OracleDbType.Int32
db_command_oracle.Parameters.Add(ret_value)
Dim IN_student_id As New OracleParameter()
IN_student_id.OracleDbType = OracleDbType.Varchar2
IN_student_id.Direction = ParameterDirection.Input
IN_student_id.Size = 10
IN_student_id.Value = student_id
db_command_oracle.Parameters.Add(IN_student_id)
db_command_oracle.ExecuteNonQuery()
messagebox.show(ret_value) ?????Your ODP.NET code looks correct. What error are you seeing?
One thing that will definitely generate an error is that .NET message boxes require that strings be displayed. ret_value is a parameter object. You need to access its value and convert it to a string. At a minimum, you need to change that. -
Hi ,
I use Oracle 10g and forms10g.
I have written a db packaged function such as:
function fnc_ipologismos_xiliometron(code_poleis_apo_var in varchar2,code_poleis_pros_var in varchar2)
return number
is
apostasi_var ref_apostaseis_poleon.apostasi%type;
onomasia_pol_apo_var ref_poleis.onomasia%type;
onomasia_pol_pros_var ref_poleis.onomasia%type;
begin
begin
select onomasia into onomasia_pol_apo_var
from ref_poleis
where code_poleis=code_poleis_apo_var;
end;
begin
select onomasia into onomasia_pol_pros_var
from ref_poleis
where code_poleis=code_poleis_pros_var;
end;
begin
select apostasi into apostasi_var
from ref_apostaseis_poleon
where code_poleis_apo=code_poleis_apo_var and code_poleis_pros=code_poleis_pros_var;
exception
when no_data_found
then
apostasi_var:=0;
return apostasi_var;
raise_application_error(-20015,'a message');
--return apostasi_var;
end; return apostasi_var;
end;The problem is that when the exception written above (in bold) returns 0 and exits the function.... whereas i want this value to be returned as well as the message in the raise_application_error....
I call this function in WHEN-VALIDATE-ITEM of a block item... such as:
if pkg_mod3_general.fnc_ipologismos_xiliometron
(:mod3_entoli_metakinisis.code_poleis_apo_type_id,:mod3_entoli_metakinisis.code_poleis_type_id)=0
and :mod3_entoli_metakinisis.seq_code_meso_metakin_type_id=2
then
raise form_trigger_failure;
end if; When the above condition is true then no message is displayed and the cursor sticks to the item(as the raise_application_error in the db packaged function is after the exit of the function) and when the condition is false then no message is displayed again ... as expected.....
How is it get the desired result.....- get the message from the raise_application_error and the function returns 0.....?????
Many thanks,
Simonyou cannot RETURN and RAISE a function.
RETURN ends the function immediately
RAISE ends the program unit and jumps in the EXCEPTION-Handler, if it exists. Else the function ends -
Problem with return value of stored function
Hi,
I've made a stored function that insert a new row in a table and return the primary key (see at the end of the message the function script).
In VS 2005 with Visual basic, using the designer, I've created a dataset containing a tableAdapter to be able to use the Pl/SQL function.
My problem is I can't get the proper return value. The VB code below works without error except that I get 0 as value.
What's wrong?
Cheers,
Sebastien
VB code
Dim myAddSession As New ICISDataSetTableAdapters.AddSessionTableAdapter
Dim intSessionId As Integer
intSessionId = myAddSession.ADD_SESSION(tbxUsername.Text, _
tempFolder.Substring(tempFolder.LastIndexOf("\") + 1), _
"toto", Environment.GetEnvironmentVariable("COMPUTERNAME"), _
myLevelAccess.icisUserId, myLevelAccess.levelId)
The debugger tells me that the ADD_SESSION function return value is Object.
add_session PL/SQL script:
CREATE OR REPLACE FUNCTION ICISSEC.add_session (
orausername IN icis_session.ora_user_name%TYPE,
ctxsessionid IN icis_session.ctx_session_id%TYPE,
ctxsessionname IN icis_session.ctx_session_name%TYPE,
ctxservername IN icis_session.ctx_server_name%TYPE,
icisuserid IN icis_session.icis_user_id%TYPE,
startlevelid IN icis_session.start_lvl_id%TYPE
RETURN icis_session.ICIS_SESSION_ID%TYPE
IS
tmpvar icis_session.ICIS_SESSION_ID%TYPE;
BEGIN
INSERT INTO icis_session
(ora_user_name, ctx_session_id, ctx_server_name,
icis_user_id, start_lvl_id, ctx_session_name
VALUES (orausername, ctxsessionid, ctxservername,
icisuserid, startlevelid, ctxsessionname
RETURNING icis_session_id
INTO tmpvar;
COMMIT;
RETURN tmpvar;
EXCEPTION
WHEN OTHERS
THEN
RAISE;
END add_session;naama wrote:
that if a value is null to convert it to 0 ? . i mean in the part of the declaration of parameter
Nope, can't do that in the signature. You'll need to handle that by validating the passed parameters at the start of the function.
It's simple enough. In your case you might just as well test for NULL and fail the function like this:
FUNCTION date_post_message(
user_lock_in IN NUMBER,
form_type_in IN NUMBER DEFAULT 0 ,
date_in IN DATE)
RETURN BOOLEAN
IS
v_num NUMBER(1);
BEGIN
dbms_output.put_line('Value of parameters : user_lock_in : '||user_lock_in || ' : form_type_in : '||form_type_in||' : date_in : '||date_in );
IF user_lock_in = 1 THEN
RETURN FALSE;
END IF;
IF form_type_in IS NULL THEN
RETURN FALSE;
ELSIF form_type_in NOT IN (1,2) THEN
RETURN FALSE;
END IF;
RETURN TRUE;
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN FALSE;
END;In other use cases I would declare a local variable and process it like this:
IF form_type_in IS NULL THEN
l_form_type := 0;
ELSE
l_form_type := form_type_in;
END IF;Obviously the code should use the local variable rather than the parameter.
Validating the values passed in parameters at the start of a function is good practice. If you really want to go to town, read about Design By Contract.
Cheers, APC
Edited by: APC on Nov 9, 2011 1:36 PM
Added example, as requested by OP -
Returning unicode string through function argument.
Hi all,
I have following function written in a C++ dll. I need to be able to call it from Java using JNI. This function expects to receive a buffer pointed by wchar_t * of "int len" length. It will copy write some text in to this buffer and i need to be able to get this updated Unicode string in Java code. please let me know how to write Java code to call this function.
int getWString(wchar *ch, int len)
wcsncpy( ch, L"Hello unicode world", len);
return 1; // no error
}Best Regards
Noman KhanYou can't.
You have to write some C "wrapper" code that meets the java interface, and have it call the C function and handle the return.
Java doesn't do output parameters, especially wchar_t* s. -
Returning values from JNI functions to Java
I have a JNI function which returns a "jstring" to the calling Java function.
I need also to return 2 byte values.
Can I return them all...? if so, how?I have a JNI function which returns a "jstring" to the
calling Java function.
I need also to return 2 byte values.
Can I return them all...? if so, how?"Also"? Then you do the same thing as if you were returning two different types in java only code, you wrap it in an object. -
How to display the return value of a function in a text field
Hi,
I have 2 textfields in a page.
i> Empno
ii> Salary
The requirement is,
i. Enter an Employee No.
ii. On click of the 'SUBMIT' button a process would be executed which calls a function (or procedure with out parameter) which returns the Salary of the given Employee.
iii. Need to display the salary to the 2nd textfield (Salary).
Here is my process:
i. If procedure call-- :P2_X is a page text field and out parameter.
begin
Pri_test_PROC(:P2_EMPNO,:P2_X);
end;ii. If Function call --
begin
:P2_X:=Pri_test_PROC(:P2_EMPNO);
end;
Issue:
The process is not getting executed and returning the process error message.
Could anyone please give me a pointer, how to overcome the issue. Or if this is not the right way, then what is the work around.
Regards
AntaraAntara,
1. Clue about the error - yes, when I see the error message.
2. What happens if you try to create a procedure like this:
CREATE OR REPLACE PROCEDURE fetch_sal (in_emp IN NUMBER, out_sal OUT NUMBER)
IS
BEGIN
FOR c IN (SELECT sal
FROM emp
WHERE empno = in_emp)
LOOP
out_sal := c.sal;
END LOOP;
END;and then run this in SQL Plus:
DECLARE
v_sal VARCHAR2 (20);
BEGIN
fetch_sal (7839, v_sal);
DBMS_OUTPUT.put_line (v_sal);
END;What do you get displayed?
Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Return value from database function taking a lot more time than the query
Hi guys,
I have a Query that does a call to a database function. The function takes in a few parameters and returns a Date. Now, the query within the function takes barely .05 seconds. However, doing a select get_join_dates from dual is taking almost 6 seconds for each call.
Here is the Query:
select s.student_id, s.student_name, s.organization_code
from student s
where s.student_id = :p_student_id
and s.student_enrollment_date = get_join_dates( :p_year,
:p_month,
:p_student_id,
s.organization_code );And here is the database function. The select inside this function barely takes 0.05 seconds per call. This function gets called 3 times in my case as there are 3 records in the org_body table for this student.
create or replace function
get_join_dates( p_yyyy in org_body.fiscal_yyyy%type,
p_month in org_body.fiscal_mm%type,
p_student_id in student.student_id%type,
p_organization_code in org_body.organization_code%type) return date as
t_enrollment_date date;
cursor cur_latest_enrollment_date is
select max(enrollment_date)
from org_body
where fiscal_yyyy = p_yyyy
and fiscal_mm = p_month
and student_id = p_student_id
and organization_code = p_organization_code;
BEGIN
open cur_latest_enrollment_date ;
fetch cur_latest_enrollment_date into t_enrollment_date;
close cur_latest_enrollment_date ;
return t_enrollment_date;
exception
when others then
null;
end;owever, when I run the following statement below, it takes close to 6 seconds to retrieve a record. In turn, my Query is becoming really slow and taking almost 35 seconds. Imagine that with more records.
select get_join_dates( 2010, '01', '2167543', 'PSYCH01' ) from dual;If I run my query with this condition below, it takes 0.5 seconds.
select s.student_id, s.student_name, s.organization_code
from student s
where s.student_id = :p_student_id
and s.student_enrollment_date = '01-JAN-10'Any ideas would be greatly appreciated.Any reason why you are doing this with the stored function?
You could just do this with SQL. Embed the query in the function as a subquery in your initial query from STUDENT.
select s.student_id, s.student_name, s.organization_code
from student s
where s.student_id = :p_student_id
and s.student_enrollment_date =
(select max(enrollment_date)
from org_body
where fiscal_yyyy = :p_year
and fiscal_mm = :p_month
and student_id = s.student_id
and organization_code = s.organization_code);Why your function is not performing: I cannot say that with the information you have provided.
Maybe sqltrace a call and see what the reason is. -
Trouble referencing return values of a Function in Stored Procedure
Hello all,
I have the following Function and Stored Procedure (simplified for this post). The error I am getting is in the SELECT, WHERE clause of the UPDATE command. My function is returning a sys_refcursor and I am trying to reference column names but keep getting the error
ORA-00904: "PUBLISHEDDOCVERSIONID": invalid identifier
What am I doing wrong?
Function
CREATE OR REPLACE FUNCTION &HKDB_Schema_Name..QueryKnowdeDocVersion(aKGID int)
RETURN sys_refcursor
IS
aCur sys_refcursor;
BEGIN
OPEN aCur FOR
SELECT pkd.KnowdeID as "PublishedKnowdeID", pkd.DocumentID as "PublishedDocID", pkd.VersionID as "PublishedDocVersionID"
FROM KnowdeDocument pkd
WHERE pkd.KGID = aKGID;
RETURN aCur;
END;Stored Procedure
UPDATE KnowdeDocument
SET DocumentID = (SELECT PublishedDocID FROM (SELECT QueryKnowdeDocVersion(aKGID, aPublishedKGID, aTextVersionID) FROM DUAL)
WHERE PublishedKnowdeID = KnowdeDocument.KnowdeID
AND PublishedDocID = KnowdeDocument.DocumentID
AND ((PublishedDocVersionID is NULL and KnowdeDocument.VersionID is NULL) OR (PublishedDocVersionID is not NULL AND
PublishedDocVersionID = KnowdeDocument.VersionID)))Regards,
TobyHi redeye,
Your select is from:
(select queryknowdedocversion(akgid
,apublishedkgid
,atextversionid)
from dual)This has no publisheddocversionid. Unfortunately I cannot figure out what you are trying to do with that ref_cursor.
Edit:
Or perhaps publisheddocversionid is a column in KnowdeDocument? Could this be case sensitive as well? (Bad idea to use quotations when naming things)
Regards
Peter
Edited by: Peter on Aug 24, 2009 3:39 AM -
Accessing function's return value
Hi there. I have created several pl/sql procedures and functions that I can run as standalone programs and I have no problem integrating them into my java code also. However I cannot access the return value of any created function from my java code. The functions appear to execute correctly because when I deliberately enter an invalid select statement I get the errors I expect to get for that instance nad if I enter a valid select statement in the function the program executes correctly but I still cannot access the function's return value. My java code where I execute the pl/sql function is as follows:
CallableStatement p = cont.conn.prepareCall("{call ? := Hellen.FUNC}");
p.setString(1, "z006"); //hellen.FUNC = function name
p.execute();
How do I access the return value of my function?
Do I need to get a ResultSet?
My function is as follows:
function func
return varchar
is tester varchar(4);
BEGIN
select cfcc_code into tester from hellen.test1 where test1.cfcc_code = 'A21';
return tester;
END;
Any help will be gratefully received, JoeYou need to do something like
p.registerOutParameter(1, java.lang.String);
p.execute();
String result = p.getString(1);Cheers, APC -
Assigning return value of a javascript function to a variable
hi.
I have a javascript function which returns string.
I wanna assing return value of that function to variable.
for example:
<script>
funtion writeMe()
var ex;
ex="try"
return ex;
</script>
Then in body of JSP page. I wanna do something like:
<% String st;%>
Now I wanna assign the value that returned from writeMe function ("try") to st string.like:
<%st= writeMe();%>. but of course it doesn't work. how can I do that?thnx. but actually what I want to do is sending some values produced by javascript to a barchart object. is it impossible too?
I mean my script function returns something like "100, 200, 300". I wanna pass that values to barchart. when I want to add aplet tag to jsp code instead of writing:
<param name="s1_value" value="100,200,300">
I want to write somethin like:
<param name="s1_value" value="myscriptfunction()">
is it possible in JSP? I saw an example like this in asp. it was like:
<param name="sampleLabels" value="<%call func1()>">. but in JSP it seems like call tag doesn't work. Is it possible in JSP? -
Unable to retreive the return value of pl/sql function using DB Adapter
Dear Experts,
I am using DB Adapter in my BPEL Process. Using DB Adapter I am invoking a PL / SQL function. I am able to send two input parameters for the pl/sql function. But I dont know how to retrieve the return value from the function. Please suggest me.
Thanks,
RajeshYes I am returning a value from PL/SQL function.
Please see the code segments below,
FUNCTION "TD_INSERT" (a TDINIT_TYPE, stops TDDETAIL_TABLE )
RETURN VARCHAR2
AS
td_no Number;
td_id Number;
stop TDDETAILFULL_TYPE;
length number;
BEGIN
insert into TD_INIT values( ----passing all the values here --------- );
select max(tdno) into td_no from TD_INIT ;
length := stops.count;
for i in 1.. length loop
stop := stops(i);
insert into TD_DETAIL_FULL values(
td_no, ------- );
end loop;
commit;
RETURN td_no;
END;
Thanks,
Rajesh -
How to create and execute a function whose return value is a table
hi folks ,
i would like know how to create and execute a function whose return value is a table ,
am new to pl/sql ,
my statement for the function is
SELECT ct.credential_code, c.expiration_date
FROM certifications c, credential_types ct
WHERE ct.crdnt_id = c.crdnt_id
AND c.person_id = person_id;
i would like to have the result of the above query as return value for the function.
Thanks in advance ,
Ashok.chi Ps ,
Can you please do small sample ,
that would help me in clear understanding
thanks in advance
ashok.c
Maybe you are looking for
-
I cannot get Firefox to even open on my Mac desktop. It crashes every time I try to use it and it will not even allow me to send a report. Some sites I need to visit caution me not to use Safari, but that Firefox is safe. If I cannot even get it to o
-
Interactive report gives an error only for a specific user
An interactive report based on a very complicated select gives an error only when a specific user is logged on. The error is: ORA-00932: inconsistent datatypes: expected - got CLOB. For other users logging using this page it works fine. Authenticatio
-
Having trouble updating to 11.1 on my iPhone 5 and I can't download any music from iTunes to my iPhone because it says I don't have 11.1? How can I update iTunes on iPhone?
-
How to link GL Account with Cost element category
Hi, I have to generate a report by querying tables SKA1,SKB1,SKAT and CSKB. Step 1.Firstly I have queried SKA1, step 2. for the obtained SAKNR(GL Accounts) from step 1,I have queried SKB1 table step 3. For the obtained SAKNR from step2, I have querie
-
Can I suspend texting and calls on my daughter's phone except for account members?
I'd like to put my daughter's phone out of action except for other family members on our account. That way she can't use the phone to distract herself from homework, etc. but she can still reach the family members on our account if she must due to e