The execution of a function in the procedure, passed as parameter string
Hello
He must create a function, pass the name of the function to a procedure, and then run this function in the procedure.
For example:
Hello from the FUNCTION to CREATE or REPLACE
RETURN NUMBER
IS
BEGIN
RETURN 23;
END;
/
CREATE OR REPLACE PROCEDURE pro_fun (v_fun VARCHAR2, v_cal OUT NUMBER)
IS
BEGIN
v_cal: = exec v_fun; <-error on this line
END;
/
Now my plsql block annonymous where I'm passing function as sting of procedure:
DECLARE
VARCHAR2 (30) v1.
NUMBER of v2;
BEGIN
v1: = "Hello";
pro_fun (v1, v2);
DBMS_OUTPUT. Put_line ('VALUE IS' | v2);
END;
/
pro_fun (v1, v2);
*
ERROR on line 6:
ORA-06550: line 6, column 1:
PLS-00905: object SCOTT.PRO_FUN is not valid
ORA-06550: line 6, column 1:
PL/SQL: Statement ignored
How below line of procedure must be written to perform this function.
v_cal: = exec v_fun;
Try something like this:
create or replace function forum_hello return number
is
Start
Back to 123;
end forum_hello;
/
create or replace procedure forum_call_function (function_name_in in varchar2)
is
number of l_returnvalue;
Start
run immediately "begin: l: = ' |" function_name_in |'; end;' using l_returnvalue;
dbms_output.put_line (l_returnvalue);
end;
/
exec forum_call_function ('forum_hello')
Sincere greetings,
Patrick Barel
Tags: Database
Similar Questions
-
SQL that passes to the procedure as a parameter query
I'm trying to accomplish what seems so simple and yet I can't do things. I want to pass a sql query via a parameter to a procedure. In this procedure, I want to loop through the results and create options for a selection list. I tried to use EXECUTE IMMEDIATELY, sliders, SYS_REFCURSOR, etc, but nothing seems to be quite right. Any ideas on how to achieve this? Thank you!
PROCEDURE Dropdown
(
nam IN VARCHAR2,
qry IN VARCHAR2,
)
IS
html VARCHAR2(1000);
BEGIN
html := '<select id="test" name="test">';
/* ?? */
html := html || '<option value="' || val || '">' || descrip ||'</option>';
html := html || '</select>';
htp.p(html);
END Dropdown;A variation would be to use DBMS_SQL to ANALYZE and DESCRIBE the results.
In this way, you can check to make sure that you have found a SELECT statement that returns only 2 columns.
MK
-
The procedure with parameter output from test object type
I have the sub object created with spec and body type.
I need to test the procedure seen ino parameter object type.
could you please help me test the procedure!
create or replace type typ_obj_test as object ( a_date date, a_type varchar2(10), a_status varchar2(2), descr varchar2(10), a_id number(10), constructor function typ_obj_test(a_date date ,a_type varchar2 default null ,a_status varchar2 default null ,descr varchar2 default null ,a_id number default null) return self as result ); / create or replace type body typ_obj_test is constructor function typ_obj_test(a_date date ,a_type varchar2 default null ,a_status varchar2 default null ,descr varchar2 default null ,a_id number default null) return self as result is v_test varchar2(1); v_id number(10); begin self.a_date := a_date; self.a_type := a_type; self.a_status := a_status; self.descr := descr; self.a_id := a_id; return; end; end; / create or replace procedure p_obj_test(p_obj_param in out typ_obj_test) is begin dbms_output.put_line('Checking the object type' || p_obj_param.a_date || '@' || p_obj_param.a_type || '@' || p_obj_param.a_status || '@' || p_obj_param.descr || '@' || p_obj_param.a_id); end; /
You seem to be missing a table that could hold the object. See the next topic, especially the line # 43:
Connected to: Oracle Database 11g Release 11.2.0.3.0 - 64bit Production SQL> create or replace type typ_obj_test as object 2 ( 3 a_date date, 4 a_type varchar2(10), 5 a_status varchar2(2), 6 descr varchar2(10), 7 a_id number(10), 8 constructor function typ_obj_test(a_date date 9 ,a_type varchar2 default null 10 ,a_status varchar2 default null 11 ,descr varchar2 default null 12 ,a_id number default null) return self as result 13 ); 14 / Type created. SQL> create or replace type body typ_obj_test is 2 constructor function typ_obj_test(a_date date 3 ,a_type varchar2 default null 4 ,a_status varchar2 default null 5 ,descr varchar2 default null 6 ,a_id number default null) return self as result is 7 v_test varchar2(1); 8 v_id number(10); 9 begin 10 self.a_date := a_date; 11 self.a_type := a_type; 12 self.a_status := a_status; 13 self.descr := descr; 14 self.a_id := a_id; 15 return; 16 end; 17 end; 18 / Type body created. -- Create a Nested table type array of above object type SQL> create or replace type nt_typ_obj_test as table of typ_obj_test; 2 / Type created. -- Keep in out parameter's type as the nested table type -- modified the proc to do loop so that multiple records can be passed via object type SQL> create or replace procedure p_obj_test(p_obj_param in out nt_typ_obj_test) is 2 begin 3 for i in p_obj_param.first..p_obj_param.last 4 loop 5 dbms_output.put_line('Checking the object type' || p_obj_param(i).a_date || '@' || p_obj_param(i).a_type || '@' || p_obj_param(i).a_status || '@' || 6 p_obj_param(i).descr || '@' || p_obj_param(i).a_id); 7 end loop; 8 end; 9 / Procedure created. --Call the procedure SQL> set serveroutput on SQL> declare 2 i_nt_typ nt_typ_obj_test ; 3 begin 4 i_nt_typ:=nt_typ_obj_test(typ_obj_test(sysdate,'A','Y','Descr',23),typ_obj_test(sysdate,'X','Z','ewe',55)); 5 p_obj_test(i_nt_typ); 6 end; 7 / Checking the object type26-MAR-15@A@Y@Descr@23 Checking the object type26-MAR-15@X@Z@ewe@55 PL/SQL procedure successfully completed. SQL>
-
What is the setting of State regarding the procedures of the Oracle
You seem like a good place to ask.
explain the term "Parameter Status" regarding the procedures for Oracle? I am a student rehearsal-review and can't answer
from what I understand this has nothing to do with the procedures
a report parameter indicates the overall percentage of a work complete "DataPump.*-
You're right, 'Parameter Status' nothing to do with procedures, unless it's a real parameter called status defined (used) in a particular procedure.However, the 'status' column in table _OBJECTS all THEwill show if a procedure is "VALID" or "INVALID" according to whether it compiled without error (s).
Good luck! : p
+ -
How to display the parameter string registered by DBMS_XMLINDEX?
This is probably a stupid question, but I can't seem to find any function to display the setting of a parameter string that was recorded by DBMX_XMLINDEX. REGISTERPARAMETER.
For example,.
If I have:
How to display the value of 'indexParam' after creation?BEGIN DBMX_XMLINDEX.REGISTERPARAMETER('indexParam', 'xxxxxxxx'); END; /
SQL> set long 1000 SQL> SQL> select paramstr 2 from xdb.xdb$xidx_param_t 3 where param_name = 'MYINDEXPARAM' 4 ; PARAMSTR -------------------------------------------------------------------------------- PATH TABLE po_ptab PATH ID INDEX po_pidx ORDER KEY INDEX po_oidx VALUE INDEX po_vidx PATHS(NAMESPACE MAPPING(xmlns:p="http://www.example.com/IPO")) GROUP MASTERGROUP XMLTABLE PO_TAB ('/p:PurchaseOrder' COLUMNS REFERENCE VARCHAR2(30) PATH 'p:Reference', REQUESTOR VARCHAR2(30) PATH 'p:Requestor' ) GROUP ITEMGROUP XMLTABLE ITEMGROUP_TAB ('/p:PurchaseOrder/p:LineItems/p:LineItem' COLUMNS LINENUMBER NUMBER(38) PATH '@p:ItemNumber', QUANTITY NUMBER(38) PATH '@p:Quantity', DESCRIPTION VARCHAR2(256) PATH 'p:Description')
After you add it to an index, you can also view the content in USER_XML_INDEXES. PARAMETERS (XML format).
-
I created a procedure running during the mapping fails but I am facing this error
ODI-1226: Error_log_procedure step fails after 1 attempt.
ODI-1232: the execution of the procedure error_log_procedure failed.
ODI-1246: the logical schema has not been defined for error_log_procedure.
at oracle.odi.runtime.agent.execution.AbstractSessionTask.getCollectDwgConnectConnection(AbstractSessionTask.java:754)
at oracle.odi.runtime.agent.execution.AbstractSessionTask.getCollectDwgConnectConnection(AbstractSessionTask.java:730)
at oracle.odi.runtime.agent.execution.SessionTask.getExecutor(SessionTask.java:239)
at oracle.odi.runtime.agent.execution.SessionTask.processTask(SessionTask.java:152)
at oracle.odi.runtime.agent.execution.SessionTask.doExecuteTask(SessionTask.java:111)
at oracle.odi.runtime.agent.execution.AbstractSessionTask.execute(AbstractSessionTask.java:864)
to oracle.odi.runtime.agent.execution.SessionExecutor$ SerialTrain.runTasks (SessionExecutor.java:2024)
at oracle.odi.runtime.agent.execution.SessionExecutor.executeSession(SessionExecutor.java:562)
to oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$ 1.doAction(TaskExecutorAgentRequestProcessor.java:718)
to oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$ 1.doAction(TaskExecutorAgentRequestProcessor.java:611)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:203)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.doProcessStartAgentTask(TaskExecutorAgentRequestProcessor.java:800)
to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$ 1400 (StartSessRequestProcessor.java:74)
to oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$ StartSessTask.doExecute (StartSessRequestProcessor.java:702)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:180)
to oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$ 2.run(DefaultAgentTaskExecutor.java:108)
to java.util.concurrent.Executors$ RunnableAdapter.call (Executors.java:471)
at oracle.odi.runtime.agent.execution.job.OdiJob.call(OdiJob.java:73)
at oracle.odi.runtime.agent.execution.job.OdiJob.call(OdiJob.java:73)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Navigate to the ODI object with the name error_log_procedure , which I assume is an ODI procedure. On the target tab (and if this source) make sure that you have specified a logical schema in the appropriate drop-down box
-
Should I compile the whole package in order to compile in a function, or a procedure inside?
Thank you
Yes.
-
How to find the last time that the execution of the procedure and by whom?
Hi all
Can be found as the last run and the procedure by which the user in the dictionary of data or something else?
Thanks in advance.
At least that audit you, you can probably not.
If the goal is a particular stored procedure, you can maintain a work table so he can follow the execution time, audit owner etc.
Concerning
Biju
-
Opt for the PROCEDURE or FUNCTION
Hi allI wonder if someone tell me that when will I go to the
PROCEDURE
orFUNCTION?.. I did research and I think if we have to perform some sequence of statements then we use procedure and if we need to perform some calculation then we create function. In addition, When we need to assign function return value into variable. Appreciate you valuable suggestion... Many Thanks
Hello
An important distinction is that only functions can be called from SQL statements.
SOM restrictions apply. If a function is called by a SQL statement, this function does not perform any DML (for example, INSERT), or call any other function or procedure that does it. If a function is called by a SQL statement, you should not have any OUT or IN OUT arguments.
How do you intend to use the procedure or function? Give specific examples of things you can do in PL/SQL, and then people can give you accurate answers.
-
Variable binding in the procedure and function
Hello
I started reading ORACLE 11 g R2 PL/SQL programming doc and I'm stuck to bind the variable. I just copied the example in the books and found error-
First of all, I wrote the procedure below and compiled with - success
Then I wrote below function and also compiled successfully-CREATE OR REPLACE PROCEDURE FORMAT_STRING ( string_in IN OUT VARCHAR2) AS BEGIN string_in := '[' || string_in || ']'; END FORMAT_STRING;
Later, I wrote the code below in the SQL Editor and found the ORA-00900 error. Please help me to understand.create or replace function join_strings (str1 varchar2, str2 varchar2) return varchar2 is begin return str1||' '||str2||'.'; end;
Maoulidavariable session_var varchar2(200) call join_strings ('I Love','you') into :session_var; call format_string(:session_var);
Later, I wrote the code below in the SQL Editor and found the ORA-00900 error. Please help me to understand.
variable session_var varchar2(200) call join_strings ('I Love','you') into :session_var; call format_string(:session_var);
If you want to do it in PL/SQL, you can use an anonymous PL/SQL block like that.
set serveroutput on declare session_var varchar2(200); begin session_var := join_strings ('I Love','you'); format_string(session_var); dbms_output.put_line(session_var); end; /
If you want to run directly in SQL Plus you can do
var session_var varchar2 exec :session_var := join_strings ('I Love','you') exec format_string(:session_var) print session_var
-
Can we call the procedure inside the function?
Hello
Can we call the procedure inside the function?
Thank you
Brij845712 wrote:
Can we call the procedure inside the function?
Strange question to ask.
Yes. This is the standard behavior in most (if not all) procedural and object oriented languages.
A procedure, function or a method is a unit of code.
You can call one of the other units. Units can call themselves (recursion). Technically, this means simply by pushing the battery current (to save the stack of the current device memory), the call to the new unit and then popping up battery when control is returned to the unity of the appellant.
There are very few exceptions to this. The only one that comes to mind programming languages I've used through the years, is natural 1 - could not call a new unit of code to replace the existing one in memory. If no call-and-return was possible.
Exactly what did you ask this question? Some newcomers to confused Oracle SQL and PL/SQL - two different languages aside server. And then also mistaken for PL/SQL client command vocabulary of SQL * more.
You will need to make sure that understand the basics of programming (applies to most current programming languages) and Oracle concepts.
-
403 Forbidden error of execution of the procedures of the URL of the browser stored
I am currently trying to run a simple stored procedure (ea.hello_world, where "ea" is the pattern and "hello_world" is the name of the procedure) a URL from the browser, but am getting a 403 Forbidden - error message "you don't have permission to access /pls/apex/ea.hello_world on this server. I use APEX 3.2 with Oracle 11 g and mod_plsql and gave the steps of apex_public_user. Any thoughts on what I am doing wrong?
Here is the process I have used so far:
Create the "Hello_World" procedure in the "EA: schema
create or replace
procedure hello_world
is
Start
HTP. Print ("'Hello World!");
end;
I then successfully granted to run the apex_public_user procedure:
Grant execute on ea.hello_world to apex_public_user;
Then, I tried to call the stored procedure from the browser using the following syntax:
http:// < Server >: < port > / pls/apex/< schema >. < Procedure & gt;
I also experimented with the use of a public synonym and the configuration of the wwv_flow_epg_include_mod_local, but I do not think that the function s relevant since I'm using mod_plsql and not the embedded pl/sql gateway.Hello
If you have below the line in dads.conf, then wwv_flow_epg_include_mod_local sets
PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
Try:
Create public synonymCREATE PUBLIC SYNONYM hello_world FOR ea.hello_world;
Grant privilege to execute procedure to the public
GRANT execute on hello_world to public;
Then change the APEX_030200.wwv_flow_epg_include_mod_local function
CREATE OR REPLACE FUNCTION APEX_030200.wwv_flow_epg_include_mod_local( PROCEDURE_NAME IN VARCHAR2) RETURN BOOLEAN IS BEGIN IF UPPER(procedure_name) IN ( UPPER('hello_world')) THEN RETURN TRUE; ELSE RETURN FALSE; END IF; END; /
Then try
http://: /pls/apex/hello_world If you can now run your procedure in URL, you can then low and e.g. grant execute procedure to the user of DAD.
Kind regards
Jarihttp://dbswh.webhop.NET/dbswh/f?p=blog:Home:0
Published by: jarola on December 6, 2011 16:20
Published by: jarola on December 6, 2011 16:24
typo in the name of the function
-
execution time of the procedure
Hello
I'm working on the Conversion project, there are 7 different procedures that execute one after the other. It takes nearly 17 hours to complete one conversion.
My question is how can I find out what procedure and/or SQL takes maximum time so that I can fix it. We used dynmaic sql strongly to INSERT/CHANGE/REMOVE.
We use Oracle 9i.
I tried to use v$ session_longops but there are so many tiny Jules Destrooper in the procedure, which lasts less than 6 seconds to run, v$ session_longops does not display any result.
Thank youDBMS_APPLICATION_INFO.SET_MODULE( module_name => 'Proc1', action_name => 'Start'); DBMS_APPLICATION_INFO.set_action(action_name => 'Just Started');
Sandy
Published by: Sandy310 on July 27, 2011 14:42You can try to create a table to record the execution time of each procedure...
For example:-table of log´s
create table executation_log (obj_name varchar2 (120),)
VARCHAR2 (120) of the event.
time_execute timestamp);-log´s procedure
create or replace procedure prc_log (p_obj_name in varchar2,
p_event in varchar2)
ispragma autonomous_transaction;
Start
insert into executation_log (obj_name, event, time_execute)
values(p_obj_name,p_event,SYSTIMESTAMP);end prc_log
declare
Start
-call the log´s procedure
prc_log (p_obj_name-online 'frist_object',
p_event-online 'start');-call your drifter
frist_object;-After the procedure of log´s you call compare the process start and end
prc_log (p_obj_name-online 'frist_object',
p_event-online "finish");-new
prc_log (p_obj_name-online 'second_object',
p_event-online 'start');second_object;
-call once again, once again, once again
prc_log (p_obj_name-online 'second_object',
p_event-online "finish");end;
-Drifter, then select table log´s
Select *.
of e executation_log
order of e.time_executeThank you...
-
General question about the procedures and functions
Hello!
I know, I can define and use a function within a procedure. But can I set up and use a procedure inside a procedure?
Thank you!Hello
But can I define and use a procedure inside a procedure?
HMMM... was it so difficult to test this?
CREATE OR REPLACE PROCEDURE xy_main AS PROCEDURE xy_sub IS BEGIN NULL; END; BEGIN xy_sub; END;
Or you actually meant the procedure inside a function
It's also not difficult :)CREATE OR REPLACE FUNCTION func_xy_main RETURN NUMBER IS PROCEDURE xy_sub IS BEGIN NULL; END; BEGIN xy_sub; RETURN(1); END;
See you soon!
Bobin -
How to query the DDL lock functions or stored procedures and packages?
Hello!
The subject says it all: how to display existing DDL locks on the functions or stored procedures and packages?
While running a procedure, it cannot be deleted or replaced, so there must be a DDL lock on it. The information does not seem to be in V$ LOCK or V$ LOCKED_OBJECTS.
Thank you!
Marcus
Published by: David on November 21, 2009 15:43Hello
You have the DBA_DDL_LOCKS view.
Best regards
Jean Valentine
Maybe you are looking for
-
HP Pavilion dv7-6c95dx - do not pick up the Samsung 840 Evo SSD for clean installation
Hello Laptop model: HP Pavilion dv7-6c95dx I bought a new Samsung 840 Evo 500 GB SSD and going on to replace the main HARD drive. Tried to install Windows 7 Ultimate on it using the USB bootable Win 7, it loads the installation and starts ok and then
-
USB thermometer works in Hyperterminal &; MAX, but not in my VI
I have USB (Omega TJ - USB) thermometer. I contacted with her success in Hyperterminal. When I try with MAX, it usually starts working after the second attempt to read/write. But even if I put the termchar 0xD and termchar_en to True, I still have
-
How can I restore my docs, photos and music to back up an external hard drive?
I had to reset my Dell Dimension E521 to factory settings. Before I did, I copied all my files, photos and music on a portable hard drive Western Digital. How can I get my files, photo and music restored to my PC? I tried to copy it to the PC, but
-
Customizations of text entry cursor prevent text selection
I use construction plus late 4.4 available on a compact Z1, (even if it's the same on 4.3). I note that Sony has added a customization where a magnifying glass appears when you move a text cursor. The problem with this implementation is that magnifyi
-
My son me locked out of my HP laptop, how can I reset the machine operating system Windows 8.