Return value from function within package
Hi,
There is a function within a pl/sql package that I am trying to get data from. The problem is that the data returned can be up to 32,767 chars (varchar2 limit).
It accepts 3 input parameters and returns on varchar2.
The only way I can get it to work is using this syntax:
==================================
variable hold varchar2(4000);
call TrigCodeGenerator.GenerateCode(VALUE1', 'VALUE2','VALUE3') into :hold;
print hold;
=====================================
However, if the data returned is greater than 4000 then I get this error:
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 1
I can't increase the size of the variable (hold) as there seems to be a limitation on this type of variable.
Also, I am running this in sql plus worksheet. Will it limit the display of the data (assuming, that someone can get the whole 32,767 chars displayed back) ?
Thanks in advance,
Ned
Never mind,
I declared the variable hold as clob and set the long and longchunksize parameters to 100,000 and it seems to work.
Similar Messages
-
Error getting return value from function
Hello
I'm getting a error calling a function with ODP.NET from C#
Code:
OracleCommand oraCom = new OracleCommand("NORMALIZACION.nif",oraCon);
oraCom.CommandType = CommandType.StoredProcedure;
OracleParameter param1 = new OracleParameter("numnif",OracleDbType.Varchar2);
param1.Value= "73667866A";
param1.Direction = ParameterDirection.Input;
OracleParameter param2 = new OracleParameter("nif",OracleDbType.Varchar2);
param2.Size = 10; //FIXME line
param2.Direction = ParameterDirection.ReturnValue;
oraCom.Parameters.Add(param1);
oraCom.Parameters.Add(param2);
oraCom.ExecuteNonQuery();
nif_norm = oraCom.Parameters["nif"].Value.ToString();
if i write the FIXME line i get a error (ORA-06502) complaining about the size, no matter the value i wrote.
If i don't write the FIXME line, it works but nif_norm is always empty, although the function i call is a single return 'Hello';
Where am I wrong??
Any help, examples with varchar2 as return value???
BTW: the same code with the MS provider for Oracle works fine.Good point -- i shall do so.
What I think I'm missing, in my quest for ODP.NET competence, is a solid set of example code. I've searched around and found various fragements here and there, but when it comes to data access from .NET there must surely be some finitie set of possibilities (if we can discount bad practices like building dynamic SQL statements without bind variables).
For example, possibly in increasing order of complexity ...
* Read a single value from a SQL statement ... "select emp_name from emp where rownum < 2"
* Read a single value by passing in a parameter ... "select emp_name from emp where user_id = :?"
* read multiple values ... "select emp_name from emp where user_id in (:?,:?)"
* execute a stored procedure with no in or out parameters
* retreive a value from a function with no parameters
* pass a parameter to a stored procedure
* read an out parameter from a stored procedure
Then work with in and out ref cursors, blobs, whatever.
Thoughts? -
How to get the returned value from Functions with Callable statement?
I was glad to find that stored procedures can be invoke with Java class code by the object of Callable statement like :
String stmt = "BEGIN departments_pkg.do_select(?,?,?); END;";
and getting the output variables by
populateAttribute(DEPARTMENTNAME,st.getString(2),true,false);
But i would like to get values returned from FUNCTION other than stored procedure, how can i achieve it? Thanks a lot!Here is my code
PROCESS BEFORE OUTPUT.
MODULE STATUS_1202.
MODULE subscreen_find.
CALL SUBSCREEN SUBSEARCH INCLUDING sy-cprog dynnr.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_1202.
CALL SUBSCREEN SUBSEARCH.
MODULE subscreen_find.
case sy-ucomm.
when 'SELECTED'. "fcode
case 'ZSKILL_SEARCH'. "data element
when '01'. " value range
dynnr = 0110.
when '02'.
dynnr = 0111.
endcase.
endcase.
ENDMODULE.
kindly tell me what is wrong
Edited by: Raji Thomas on Feb 8, 2010 10:20 AM -
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. -
Remote Object - not able to get the returned value from java method
Hi ,
I am developing one sample flex aplication that connects to the java code and displays the returned value from the
java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
lastResult is giving null . I am able to see the sysout messages in server console.
I am using flex 3.2 and blazeds server and java 1.5
Here is the code what I have written.
<?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
<mx:Script><![CDATA[
import mx.controls.Alert;
import mx.binding.utils.ChangeWatcher;
import mx.rpc.events.ResultEvent;
import mx.messaging.*;
import mx.messaging.channels.*
public function initApp():void {
var cs:ChannelSet = new ChannelSet();
var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf"); cs.addChannel(customChannel);
remoteObj.channelSet = cs;
public function writeToConsole():void { remoteObj.writeToConsole(
"hello from Flash client");
var returnedVal:String = remoteObj.setName().lastResult; Alert.show(returnedVal);
//[Bindable]
// private var returnedVal:String;
]]>
</mx:Script>
<mx:RemoteObject id="remoteObj" destination="sro" />
<mx:Form width="437" height="281">
<mx:FormItem>
</mx:FormItem>
<mx:Button label="Write To Server Console" click="writeToConsole()"/>
</mx:Form>
</mx:WindowedApplication>
Java code
public
public SimpleRemoteObject(){
super(); }
class SimpleRemoteObject {
public void writeToConsole(String msg) { System.out.println("SimpleRemoteObject.write: " + msg); }
public String setName(){ System.
out.println("Name changed in Java");
return "Name changed in Java";
And I have configured destination in remote-config.xml
<destination id="sro">
<properties>
<source>SimpleRemoteObject</source>
<scope>application</scope>
</properties>
</destination>
Please help me .You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
In this you define what you wish to do.
More importantly in the remote object you need to define which method you wish to call using the method class like this
<mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1" >
<Method name="javaMethodName" result="r2" fault="f2"/>
<mx:RemoteObject>
r2 is the function where you get the result back from java and can use it to send the alert. -
How to get return values from stored procedure to ssis packge?
Hi,
I need returnn values from my stored procedure to ssis package -
My procedure look like and ssis package .Kindly help me to oget returnn value to my ssis package
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [TSC]
-- Add the parameters for the stored procedure here
@P_STAGE VARCHAR(2000)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
--SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
truncate table [INPUTS];
INSERT
INTO
[INPUTS_BASE]
SELECT
[COLUMN]
FROM [INPUTS];
RETURN
END
and i am trying to get the return value from execute sql task and shown below
and i am taking my returnn value to result set variableYou need to have either OUTPUT parameters or use RETURN statement to return a value in stored procedures. RETURN can only return integer values whereas OUTPUT parameters can be of any type
First modify your procedure to define return value or OUTPUT parameter based on requirement
for details see
http://www.sqlteam.com/article/stored-procedures-returning-data
Once that is done in SSIS call sp from Execute SQL Task and in parameter mapping tabe shown above add required parameters and map them to variables created in SSIS and select Direction as Output or Return Value based on what option you used in your
procedure.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Subprocess 33 was not successful. Master cannot read return value from S 33
Hi All,
We are on BI 7.0 SP 19.
We have submitted a planning sequence in the background with automatic packaging.
The planning sequence has two steps:
Step 1. Z_PLNG_FUNCTION1
Step 2. Z_PLNG_FUNCTION2
As per automatic packaging, the system chose 0ACCOUNT for packaging.
When submitted, each step has been submitted to 30 packages as 30 subprocesses.
For Step 1, the log shows that All subprocesses executed.
For Step 2, the log shows that the subprocess 33 and 58 failed, which means subprocess #3, and # 28 for the step 2 as the subprocess is numbered in the log in combination with step 1.
The messages in the log for the failed subprocesses are as follows:
@5C\QError@ Subprocess 33 was not successful
@5C\QError@ Master cannot read return value from subprocess 33
@5C\QError@ Subprocess 58 was not successful
@5C\QError@ Master cannot read return value from subprocess 58
Our question is on how to find the exact cause of the subprocess failure.
I tried to look for the details on the error messages, they have been not helpful.
What is meant by 'Master cannot read return value from subprocess' and how to get the exact cause of the failure?
Thanks in advance,
Best Regards,
- ShashiShashi,
implement the following notes and check again:1368659, 1525723, 1532061.
Regards,
Marc
SAP Techology RIG -
We ran across some code in one of our classes that calls a private method. That method returns an object, but the code calling that method does not capture it. What happens to the return value in a case like this? I would have thought that to be a syntax error.
Example:
myMethod(myObject, i); // Call to myMethod without capturing its return value.
private myObject myMethod(MyObject myObject, int i) {
return myObject;
}What happens to the return value from myMethod?(void) f(arg1, ..., argN); There's no
provision in Java to allow you express that same
intention.
What?!?!?public void f(arg1, ...,
argN);
In the C code, function f was defined as having a non-void return type.
The statement
(void) f(arg1, ..., argN);shows the caller is knowing ignoring that returned value. -
Capture Return Value from Contextual Events Subscriber Method
Hi
I was wondering if anyone knew whether you could capture the return value from a method exposed as a subscriber for a contextual event?
Requirement: We have 2 bounded task flows (parent-child) with the child task flow embedded as a region in a view activity in the parent task flow. Based on an action in the parent task flow we raise a contextual event which calls an application module method exposed as a data control within the child task flow. We need to be able to capture the return value from the method on the managed bean.
Example method within child task flow application module:
public String contextualEventSub(){
Return "Y";
So here we would like to capture String value when the event is raised by the event producer (parent task flow action).
Within the Event Map on the page definition of the parent task flow view activity it is possible to set parameters to pass to the subscriber but it’s not obvious where you can capture the return value.
Many thanks!
Technology:
ADF 11.1.1.7 – ADFbc with ADF task flows and page fragmentsCheck this URL it may help you
One size doesn't fit all: JDev 11g: Programmatic Contextual Events -
How to get return value from java and read by other application?
i want to read return value from java and the other application read it.
for example:
public class test_return {
test_return(){
public int check(){
return 1;
public static void main(String args[]){
new test_return().check();
}from that class i make as jar file. How to read the return value (1) by other application?
thx..If your installer is requiring some process it invokes to return a particular value on failure, then the installer is seriously broken. There are a bazillion commands your installer could invoke, and any of them could fail, which in turn could invalidate the entire install process, and any of them could return any value on failure. The only value that's consistent (in my experience) is that zero means success and non-zero means failure, with specific non-zero values being different in different programs.
About the only control you have over the JVM's exit code is that if your main method completes without throwing an exception, the JVM will have an exit code of 0, and if main throws an exception (either explicitly or by not catching one thrown from below), it will be non-zero. I'm not even sure if that's guaranteed, but I would guess that's the case.
EDIT: I'm kind of full of crap here. If you're writing the Java code, you can call System.exit(whatever). But nonetheless, if your installer requires certain exit codes from any app--java or otherwise--you have a problem.
Edited by: jverd on Oct 29, 2009 1:27 AM -
How to get return value from Java runtime.getRuntime.exec?
I'm running shell commands from an Oracle db (11gr2) on aix.
But, I would like to get a return value from a shell comand... like you get with "echo $?"
I use a code like
CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
import java.io.*;
public class Host {
public static int executeCommand(String command) {
int retval=0;
try {
String[] finalCommand;
finalCommand = new String[3];
finalCommand[0] = "/bin/sh";
finalCommand[1] = "-c";
finalCommand[2] = command;
final Process pr = Runtime.getRuntime().exec(finalCommand);
pr.waitFor();
catch (Exception ex) {
System.out.println(ex.getLocalizedMessage());
retval=-1;
return retval;
/but I do not get a return value... because I don't know how to get return value..
Edited by: user9158455 on 22-Sep-2010 07:33Hi,
Have your tried pr.exitValue() ?
I think you also need a finally block that destroys the subprocess
Regards
Peter -
How to get the return values from a web page
Hi all :
how to get the return values from a web page ? I mean how pass values betwen webflow and web page ?
thank you very much
Edited by: jingying Sony on Apr 15, 2010 6:15 AM
Edited by: jingying Sony on Apr 15, 2010 6:18 AMHi,
What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
Regards,
Karri -
Child package cannot read param value from parent ssis package
Hi all,
I think I must be crazy !! i have a big problem in my ssis project .
i have more than 40 package one parent and 39 childs
i use configuration method to get variable values from parent to child packages and it work well .. but when i copy my ssis project
to the production server i face the following problem .. childs package didn't read the variables values from the parent package
i revised the configuration many times i can't find any missing !!
any help please ...
Thanks,Do not copy the packages from the projet to the production server, but you must generate the manifest installation including your configuration, and deploy them.
Note : not forget to include the configuration.
To learn more about how to install the package :
Lesson 1:
http://msdn.microsoft.com/en-us/library/ms365332(v=sql.105).aspx
Lesson 2 :
http://msdn.microsoft.com/en-us/library/ms365329(v=sql.105).aspx
Lesson 3 :
http://msdn.microsoft.com/en-us/library/ms365321(v=sql.105).aspx -
How to Sort by the length of the returned value from a query.
Hi,
I was wondering if it is possible to sort by the length of the returned value from a query?
For example if I want to get a list of people with the name 'Samuel', I would like to short by how short the length of the whole name is.
Sort by length of the name in SQL
Samuel Syda
Samuel Indranaka
Samuel Johnsons
Samuel Longhenderson
Thank you.Hi,
Sorting is done by an ORDER BY clause at the end of the main query.
In most cases, you can ORDER BY any expression, even f it is not in the SELECT clause. In this case, it sounds like you just need:
ORDER BY LENGTH (name_column)
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
Post your query, using an ORDER BY clause like the one above, and point out where that query is producing the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
RE: (forte-users) Reading return value from Javaprogram
when using the RunCommand method you can specify the an error file:
task.part.os.RunCommand(command = l_tdCommandLine,
isSynchronous = TRUE,
inputFile = Nil,
outputFile = Nil,
errorFile = l_ErrorFile.GetLocalName(TRUE));
BEGIN
l_ErrorFile.Open(SP_AM_READ);
EXCEPTION
WHEN Ex: FileResourceException DO
l_ErrorFile = NIL;
task.ErrorMgr.Clear();
END;
IF l_ErrorFile <> NIL THEN
l_tdFileContents : TextData = New();
l_ErrorFile.ReadText(l_tdFileContents);
l_ErrorFile.Close();
END IF;
Have you java program output the return value to the standard IO. This way
you will have an error file that you can read from Forte.
ka
-----Original Message-----
From: Anthony D [mailto:saigonxyahoo.com]
Sent: Tuesday, September 12, 2000 7:49 AM
To: forte-userslists.xpedior.com
Subject: (forte-users) Reading return value from Java program
Hi,
Does anyone know whether Forte application can
read a return value from a Java program?
I'm using the RunCmd method to invoke the Java
program. I'd like to read the return value from the
Java program. How do I go about doing it?
Any suggestion will be appriciated.
Thanks
AD
http://mail.yahoo.com/
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.comwhen using the RunCommand method you can specify the an error file:
task.part.os.RunCommand(command = l_tdCommandLine,
isSynchronous = TRUE,
inputFile = Nil,
outputFile = Nil,
errorFile = l_ErrorFile.GetLocalName(TRUE));
BEGIN
l_ErrorFile.Open(SP_AM_READ);
EXCEPTION
WHEN Ex: FileResourceException DO
l_ErrorFile = NIL;
task.ErrorMgr.Clear();
END;
IF l_ErrorFile <> NIL THEN
l_tdFileContents : TextData = New();
l_ErrorFile.ReadText(l_tdFileContents);
l_ErrorFile.Close();
END IF;
Have you java program output the return value to the standard IO. This way
you will have an error file that you can read from Forte.
ka
-----Original Message-----
From: Anthony D [mailto:saigonxyahoo.com]
Sent: Tuesday, September 12, 2000 7:49 AM
To: forte-userslists.xpedior.com
Subject: (forte-users) Reading return value from Java program
Hi,
Does anyone know whether Forte application can
read a return value from a Java program?
I'm using the RunCmd method to invoke the Java
program. I'd like to read the return value from the
Java program. How do I go about doing it?
Any suggestion will be appriciated.
Thanks
AD
http://mail.yahoo.com/
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com
Maybe you are looking for
-
Sys. Pref pane crashes on iTunes Artwork screensaver after iTunes update
Hello, I recently updated iTunes to version 12.0.1.26. Before the update my screensaver worked fine (using the iTunes artwork screensaver). After the update however, it no longer works (all other screensavers work fine). System Preferences crashes as
-
How do I pin a firefox page to Win 7 taskbar?
I was able to pin my Yahoo e-mail account to the Win 7 task bar. After a Firefox update this disappeared. How do I reestablish this access.
-
Prevent Info Rec creation?
Is it possible to prevent the creation of an Info Rec when a P.O. is created? If so, how?
-
They can't hear me and I can't hear them. Any ideas?
I have replaced my Iphone 4S and still having speaker issues. They can't hear me and i can't hear them! Any help. Just about ready to return phone.
-
Hello All, I'm working on an iMovie '11 project consisting of an assortment of short-length clips (most between 2-10s) and each time I try and move the portion I selected from the event menu, the select box disappears and I am not able to transfer it