How to perform a function with out parameter dynamically?
I have a function:
FUNCTION to CREATE or REPLACE testdyn1 (in_1 NUMBER, OUT out_1)
RETURN VARCHAR2 IS
BEGIN
out_1: = in_1 + to_number (to_char (SYSDATE, 'ss'));
RETURN ' Ok! ' || TO_CHAR (SYSDATE, 'ss');
END;
How to call it dynamically? I did this:
declare
number of v_in: = 3;
number of v_out;
v_ret varchar2 (100);
v_st varchar2 (4000);
Start
v_st: = ' START: v_ret: = testdyn1 (: v_in,: v_out); END;';
EXECUTE IMMEDIATE v_st USING v_in, OUT v_out, v_ret;
dbms_output.put_line ('v_out =' | v_out |) ' / ' || 'v_ret =' | v_ret);
end;
I get the error:
ORA-06536: IN bind variable end to a position
ORA-06512: at line 8 level
BluShadow wrote:
My question would be why on Earth, you call a function dynamically?
Dynamic SQL is bad enough... but dynamic PL/SQL is just a matter of trouble.
If an application is designed properly so you know the name of the function and the parameters passed, while there should be no reason to call it dynamically.
Whenever someone starts mentioning the dynamic code, the first thing that you should always say is "Stop!" What are you trying to do? "and look at why you eventually go that route.
Good point. But the problem is the client (which is our customer) is instructing us to do. So we can't complain.
Finally, I was able to do.
Here is the code:
FUNCTION to CREATE or REPLACE testdyn1 (in_1 NUMBER, out_1 OUT VARCHAR2)
IS BACK PLS_INTEGER
BEGIN
out_1: = to_char (to_number (in_1) + to_number (to_char (SYSDATE, 'ss')));
RETURN in_1 | TO_NUMBER (to_char (SYSDATE, 'ss'));
END;
____________________________________
declare
v_ret_val pls_integer;
v_out varchar2 (1000);
v_stmt varchar2 (4000);
number of v_in: = 1;
Start
v_stmt: = ' START: 1: = testdyn1 (: 2: 3); END;';
EXECUTE IMMEDIATE v_stmt help to v_ret_val into v_in, at v_out;
dbms_output.put_line(v_ret_val ||) ' / ' || v_out);
end;
126 / 27
PL/SQL procedure successfully completed
Tags: Database
Similar Questions
-
How to perform a function with parameter date as input?
Hello
I have a function named fun1 (v_fun in date), including the date as an input parameter, and it returns a number. I created the function successfully. But I couldn't run this function in sqlplus. How to move the dates? Can someone help me in this regard.Hello
V11081985 wrote:
Hello
I have a function named fun1 (v_fun in date), including the date as an input parameter, and it returns a number. I created the function successfully. But I couldn't run this function in sqlplus.It is difficult for me to say what you're doing wrong when I don't know what you're doing. After a full test script that people can run to recreate the problem and test their ideas. Include a definition of function, CREATE TABLE and INSERT statements for one of your own tables (if necessary) and the results you want from this data, as well as your query.
How to move the dates? Can someone help me in this regard.
You can call the function like this:
SELECT fun1 (hiredate) AS fun1_results FROM scott.emp ;
-
How to get after effect with out having to pay permanently?
How to get after effect with out having to pay permanently?
-
How can I call a function with a parameter?
Hey guys, I am trying to perform a function within a loop function and I am running into a problem. Whenever I run the program it gives me this error: 1136: Incorrect number of arguments. 1 expected. However, I can't add the parameter because the function that I'm running is an event. Here is the code:
package
{
import flash.display.Stage;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.display.MovieClip;
import flash.events.MouseEvent;
SerializableAttribute public class extends MovieClip Hero
{
public var stageRef:Stage;
public var health: Number = 6;
public var speed: number = 3;
public var leftPressed:Boolean = false;
public var rightPressed:Boolean = false;
public var upPressed:Boolean = false;
public var downPressed:Boolean = false;
public void Hero()
{
stage.addEventListener (KeyboardEvent.KEY_DOWN, keyPressed);
stage.addEventListener (Event.ENTER_FRAME, loop, false, 0, true);
}
public void loop(E:Event):void
{
keyPressed();
{if (leftPressed)}
x = speed;
} else {if (rightPressed)
Speed x +=;
}
{if (upPressed)}
y = speed;
} else {if (downPressed)
y += speed;
}
}
public void keyPressed(event:KeyboardEvent)
{
If (event.keyCode is Keyboard.LEFT)
{
leftPressed = true;
} else {}
leftPressed = false;
}
If (event.keyCode is Keyboard.RIGHT)
{
upPressed = true;
} else {}
upPressed = false;
}
If (event.keyCode is Keyboard.UP)
{
rightPressed = true;
} else {}
rightPressed = false;
}
If (event.keyCode is Keyboard.DOWN)
{
downPressed = true;
} else {}
downPressed = false;
}
}
}
}
The function definition using what follows, and it should work with and without passing the argument
public void loop(E:Event=null):void
-
How to run a procedure created dynamically with out parameter
Hi guys,.
a friend I need to run a procedure whose name will change dynamically and this procedure is with 2 out parameter. I need to capture the value of these 2 output settings, here I m giving my code too...
declare
int v_emp_id: = 100013;
p_reg_off varchar (5): = "R";
int p_user_id: = 6;
v_status varchar (200);
v_message varchar (200);
v_Formula varchar (100);
int v_number: = 1;
Start
v_Formula: = 'call testsp_ | v_number | ' ('| v_emp_id |', "'| p_reg_off |") «, » || p_user_id | v_status, v_message)';
DBMS_OUTPUT. Put_line (v_Formula);
immediately run v_Formula;
end;
and my procedure structure is like this
CREATE OR REPLACE PROCEDURE testsp_1
(
p_emp_id INT,
p_reg_off TANK,
p_user_id INT,
p_status OUT NOCOPY INT,
p_message OUT NOCOPY VARCHAR2
)
AS
Start
end;
Please help me...Hello
You must use the "USING" clause to execute dynamic sql with parameter out.
Example: http://download-west.oracle.com/docs/cd/B28359_01/appdev.111/b28370/dynamic.htm
Arun-
-
How to handle a function with struct return of dll?
I have a dll 'SCTSCTL_OPEN' function returns a structure like
typedef struct _sctsctl_t {}
HANDLE hDevice;
unsigned char ctl [2];
unsigned long necessarily;
unsigned long data_diff;
HANDLE IsrThread;
HANDLE IsrEventHandle;
PVOID can't;
void (* Manager) (struct _sctsctl_t * board, int intvec);
} * sctsctl_t;SCTS_API sctsctl_t __stdcall SCTSCTL_OPEN (DWORD instance);
I have imported this dll with LabVIEW and vi returns an unsigned long integer shown as follows.
How to make a comeback with structure? Any help would be appreicated.
Kind regards
Adam
LV 8.5.1
Normally I would be tempted to do a wrapper function and call it with LV LV. handles structure not so naturally.
-
How to perform a function and return the result in a variable of liaison
Hello
I'm trying to calculate the sum of the salaries of all persons with a particular using a function JOB_ID TOTAL_INCOME (v_job_id).
create or replace function total_income
+ (v_job_id in VARCHAR2) +.
Number IS BACK
v_total number (6);
cursor get_sal is
Select the pay of employees
where job_id = v_job_id;
BEGIN
v_total: = 0;
for emp in get_sal
loop
v_total: = v_total emp.salary; +.
end loop;
dbms_output.put_line (' Total salary ' | v_job_id |' is: ' | v_total);
Return v_total;
END;
Now I woud like to perform this function and assign the value returned in a variable binding test_sal
test_sal variable number (6)
SELECT total_income ('AD_VP') in: test_sal FROM DUAL;
dbms_output.put_line (' Sal Total :'||: test_sal);
This returns the errors below:
SELECT total_income ('AD_VP') in: test_sal FROM DUAL
*+
Error on line 0
ORA-01036: illegal variable name/number
dbms_output.put_line (' Sal Total :'||: test_sal);
Error on line 3
ORA-00900: invalid SQL statement
Could someone help me what could be the problem? Thanks for your time...Hi Kiran and welcome to the forum,
You mix SQL and PL/SQL
It's the way in which SQL:
SQL> SELECT total_income('AD_VP') FROM DUAL; TOTAL_INCOME('AD_VP') --------------------- 123 1 row selected.
It comes to PL/SQL in SQL * more
SQL> variable test_sal number SQL> execute :test_sal := total_income('AD_VP') PL/SQL procedure successfully completed. SQL> exec dbms_output.put_line('Total Sal:'||:test_sal) Total Sal:123 PL/SQL procedure successfully completed
Concerning
Peter -
performs a function with one parent at the end of a child.swf
question: how to call a function which is within a parent.swf of a child external swf (Loader class)?
In my menu.swf, there is a child (Loader class) of a content.swf that is loaded below on the race. Then when a button is clicked, it returns a string that contains the name of the content file to load then, then launches a final function on the child who made an outro animation.
function buttonClick(event:MouseEvent):void
{
nextContent = event.target.name + ".swf";
MovieClip (newContent.contentLoaderInfo.content) .endSequence ();
}
------------------------------------------
After the final sequence has performed in the ccontent.swf I need to know how to make a call to a function in the menu.swf so that I can load the nextContentMovieClip (parent.parent) work, then?
-
How to do a function with the same argument multiple times and return values in the variables?
The problem I have is that I have created a function that is really kind of database. Basically, a bunch of:
If (a.value == 'number') {}
b.value = "this expression."
}
Inside of the shape are 2 drop-down lists that return numeric values I want to process through this function and the value of return inside separate variables.
var a = this.getField ("OPE003. EVEN.1.MIP");
MIP (a);
var Result1 = Mip();
I tried to smash * a * to treat the second field
a = this.getField ("OPE003. EVEN.2.MIP");
MIP (a);
var Result2 = Mip();
Result1 and result2 are placed in an array, joined as a string.
In doing so, I always get the last treatment twice more than the final result.
Can I use a function as a batch processor that way?
You're right, I changed the code to what you said, but how to pass another value by my function so I can get Result1 and Result2?
is it
var a = this.getField ("OPE003. EVEN.1.MIP");
var b = this.getField ("OPE003. EVEN.2.MIP");
Result1 var = Mip (a);
var Result2 = Mip (b);
var c = new Array [performance(1), result2]
-
How to call the function with arguments varray.
Hello
I've got function like this:
How can I build this function call (nvarchar data type is necessary) using the only pl/sql and can do with pure as sql select double f();?CREATE OR REPLACE TYPE VARR_VARCHAR AS VARRAY(256) OF NVARCHAR2(500) / CREATE OR REPLACE TYPE E_VARR_VARCHAR AS VARRAY(256) OF nVARCHAR2(4096) / FUNCTION find_id( p_id IN VARCHAR2, p_special_columns IN varr_varchar, p_special_values IN e_varr_varchar, ) RETURN VARCHAR2;
I'm on 9.2.0.8.
Concerning
GregGSelect find_id (p_id, VARR_VARCHAR('1','2','3'), e_varr_varchar('1','2','3')) of double;
-sty.
-
How to open a page with a parameter?
Hello
1. I have a page 1 and page 2.
On page 1, there are two elements of text field.
#1. input field
#2. output field
2. I call a stored procedure triggered by a button "submit" and set the output value of the stored procedure in the output field.
3. I want to open a page 2 with the result field returned by a stored procedure.
the value of the result of page field 1 is a primary key of page 2.
I'm not an APEX developer full time. I have no problem with the #1 and #2 steps. But no idea how do with step #3.
And when the result field is a certain value as "ERROR with validation of the input value", I don't want to open the page 2.
Can someone show me how do?
Thank you
JonDaegu-Oracle wrote:
1. I have a page 1 and page 2.
On page 1, there are two elements of text field.
#1. input field
#2. output field
2. I call a stored procedure triggered by a button "submit" and set the output value of the stored procedure in the output field.
3. I want to open a page 2 with the result field returned by a stored procedure.
the value of the result of page field 1 is a primary key of page 2.
I'm not an APEX developer full time. I have no problem with the #1 and #2 steps. But no idea how do with step #3.
And when the result field is a certain value as "ERROR with validation of the input value", I don't want to open the page 2.
Can someone show me how do?
Create a conditional branch on page 1:
Point of connection: To present: after treatment (after calculation, Validation and treatment)
Branch of Type: Branch to the Page or URL
Direction of the target: This Application page
Page: 2
The value of these items:
With these values:
(use a substitution of static text reference: &P1_ITEM_NAME.
)When you press the button:
Condition of Type: PL/SQL expression
Expression 1: :
(use a variable binding reference:not like 'ERROR%' :P1_ITEM_NAME
)Conditions and the branches are important concepts and you should familiarize yourself with them regardless of your level of involvement with APEX.
-
What subprogramme should we prefer to return multiple values with OUT parameter?
Hello
I worked on the procedures and functions, and aware of their differences. Today I have an interview question that - suppose I don't have return multiple values through a subroutine and I want nor run any what DML within this subprogramme and I want to use this subprogramme in the SQL query. What subprogramme I would prefer - "Operating Mode" or "Function" and why?
In my view, both can be used in this case, but want to see your views and opinions.
Kind regards
Sachin jerbi
In terms of software engineering, if you claim something that you expect to "return" something (a value or values) then you use a function. If you call something to "do" something, and then you use a procedure.
THE settings are not good practices in many cases and should not strictly considered "return" of values. Instead, they are assigned values in the code and generally act as pointers to the original variable/structure that was passed as a parameter (the actual internals of Oracle don't quite do it, but in principle this is what they do).
A return value (or structure) of a function is basically push in the battery to the point that the RETURN statement is issued, and then the code calling the stack appears to assign it to a variable or placeholder, it should go in.
If it seems a little difference between procedures and functions to some people, it is recommended to use functions for obtaining values and procedures to do things, in most cases. It is not just "syntactic sugar", as mentioned above.
-
How can I start Firefox with a parameter passed html file
I want to leave Windows (7), passing a local html file name as a parameter to use this html page for the start page of Firefox. There is no help or documentation on the parameters of start (a major deficit oversight or program)
It should work in a .cmd or .bat file.
start "" "C:\Program Files (x86)\Mozilla Firefox\Firefox.exe" "C:\Users\DES\Documents\MSData\HTML\GPD.shtml"
-
How to call a function with parameters in jsf managed Bean
Hello
1. I created a Bean managed to manage chains of jsf to 11.1.1.7 WebCenter spaces:
public class ManageStrings {}
/ * Converts all characters in a string to uppercase. */
public String getToUpperCase (String str) {}
Dim retVal = str.toUpperCase ();
Return retVal;
}
}
2. I registered managed Bean:
" < managed-bean id ="swc_3"xmlns =" http://xmlns.Oracle.com/ADF/controller "> "
< id managed-bean-name = "swc_2" > tools < / managed-bean-name >
< managed-bean-class id = "swc_1" > cat.badalona.webcenter.utilities.ManageStrings < / managed-bean-class >
< managed-bean-scope id = "swc_4" > backingBean < / managed-bean-scope >
< / managed-bean >
3 to code jsf, I tried different options, but they do not work
" < = xmlns:af af:outputText ' http://xmlns.Oracle.com/ADF/faces/rich "value="#{backingBeanScope.utilities.getToUpperCase['hello']}"/ > "
...
" < = xmlns:af af:outputText ' http://xmlns.Oracle.com/ADF/faces/rich "value="#{backingBeanScope.utilities.toUpperCase['hello']}"/ > "
..
" < = xmlns:af af:outputText ' http://xmlns.Oracle.com/ADF/faces/rich "value =" #{backingBeanScope.utilities.getToUpperCase ('hello')} "" / >
What I am doing wrong?
Thaks in advance
Hello Carles,
I did it with the content presenter where I need to pass the ID of the component selected in backing bean. Please try below option
Now add following code in your binding
Private RichOutputText outputText1;
then the getter for this outputtext set.
and in your action method to read the value of the output text.
Hope this helps with your problem.
Thank you
Amey
-
How to create the event with the parameter schematically
Hello
I created the button schematically, I want to pass the parameter for this event.
And I must capture this setting in LICS pls help someone.
OASB OASubmitButtonBean = (OASubmitButtonBean) pageContext.getWebBeanFactory () .createWebBean (pageContext, "BUTTON_SUBMIT");
oasb.setID ("ZoomBtn");
oasb.setUINodeName ("ZoomBtn");
oasb.setEvent ("Zoomeve");
oasb.setText ("zoom");
webBean.addIndexedChild (oasb);
OASubmitButtonBean zoomBt = (OAButtonBean) webBean.findChildRecursive ("ZoomBtn");
If (zoomBt! = null) {}
Hashtable paramsWithBinds = new Hashtable (2);
paramsWithBinds.put ("PoHeaderId", new OADataBoundValueFireActionURL (webBean (OAWebBeanData),
"{$PoHeaderId}"));
FireAction = firePartialAction
OAWebBeanUtils. getFireActionForSubmit (zoomBtn, "openCustRefDetForm", null, paramsWithBinds, true, true);
zoomBtn.setAttributeValue (PRIMARY_CLIENT_ACTION_ATTR, firePartialAction);
}
But it gives the following error.
- Error (50.9): method getFireActionForSubmit (oracle.apps.fnd.framework.webui.beans.nav.OAButtonBean, java.lang.String, null, com.sun.java.util.collections.Hashtable, boolean, boolean) could not be found in the oracle.apps.fnd.framework.webui.OAWebBeanUtils class
Dilip salvation,
Thanks for your replay instance it works fine.
Good answer,
Instead of
import com.sun.java.util.collections.Hashtable;
We have to import
import java.util.Hashtable;
Kind regards
Sangu
Maybe you are looking for
-
How can I use MacBook Pro as an external display?
I have an apple TV with HDMI and I was wondering how I can use my MacBook Pro (2015) as a screen for the apple TV? They would be connected. HDMI
-
Hi all I have a terrible problem with my audio and I'm not sure at 100% it out exactly. But basically my sound is constantly make little sounds of cracking and pause every time that I do everything that requires computing power. Whenever this isn't t
-
Send variables in macromedia flash
Hello I would like to send a variable in macromedia flash. I explain my problem. I created a flash in which I send a word in a variable called lol and I read this varibale in another variable called say. But in labview I don't know how I can send thi
-
HDX-18 t maintenance and repair manual?
Hello, newbie here again. I guess HP published a manual of Ma & for their Pavilion HDX series - 18 t of laptop computers. I can't locate one to be on the site of HP or many other sites that I searched. Anyone know where I could possibly find this
-
HP Officejet Pro 810: Print misaligned
The printer has started printing with a margin of 2cm from the left, and the text flows so towards the right side. It is a network (USB) printer and in this case each station. I reinstalled the latest driver from HP, but still the problem persists. I