Procedure runs package Help
HelloI need to get familiar with the procedures and packages if I put in place the code below in a procedure to run a package, when to use the DBMS_OUTPUT procedure. Put_line to display that returns the package.
Finally the package returns lines of our ColdFusion Oracle database.
Could someone please help me get it going, and maybe I'll see where I am in foul territory? I think I'm close or across the universe.
Thanks in advance for your help,
Lou
PROCEDURE
create or replace
PROCEDURE test2
is
TYPE my_cursor is REF CURSOR;
BEGIN
test1_pack.test1_proc(:my_cursor);
LOOP
NULL;
-DBMS_OUTPUT. Put_line(my_c.col1 || my_c.col2);
END LOOP;
END test2;
PACKAGE
create or replace
package test1_pack as
TYPE test1_cursor IS REF CURSOR;
PROCEDURE test1_proc)
p_cursor in THE test1_cursor);
end test1_pack;
PACKAGE BODY
create or replace
package body test1_pack as
PROCEDURE test1_proc)
p_cursor in THE test1_cursor) as
Start
OPEN FOR P_cursor
SELECT * FROM
(SELECT 'Is' today AS "COL1", TO_CHAR (SYSDATE) AS 'COL2' FROM DUAL
UNION ALL
SELECT 'April', ' crazy! OF THE DOUBLE
);
end test1_proc;
end test1_pack;
Hello
Try this:
CREATE OR REPLACE PROCEDURE test2 IS
TYPE my_cursor IS REF CURSOR;
v_cursor my_cursor;
v_col1 VARCHAR2(100);
v_col2 VARCHAR2(100);
BEGIN
test1_pack.test1_proc(v_cursor);
LOOP
FETCH v_cursor
INTO v_col1, v_col2;
EXIT WHEN v_cursor%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_col1 || v_col2);
END LOOP;
CLOSE v_cursor;
END test2;
/
Kind regards
Tags: Database
Similar Questions
-
When I try to install an update to iTunes on my Windows 7 computer I get the following message: "there is a problem with this Windows
Installation package. A program required for this install to complete could not be run. "Help, please.Hello..
Try this support article > If you see an error message "Windows package install" when you try to uninstall iTunes from your PC
-
ORA-06508, procedure cannot call the procedure of package
I have a large stored procedure that calls a package (procedure) that manages a number of procedures to determine whether the process can continue or not. (It checks authorization of the student to enroll in a class). We have a web process calling the stored procedure, and that works fine. What does not work, is a call to the package. Oracle returned ORA-06508: PL? SQL: could not find program unit called.
I have included instructions for debugging, so I know that it is the specific call to a procedure in the package fails with ORA-06508. Thinking it's perhaps something in the package, I inserted a debug statement as the first line in the procedure called in the package. (Debugging instructions call a procedure inserts of rows in a table of debugging with independent validation).
When I log in the user account with sqlplus and run a test, everything works fine. But when the web process is running under the same user, the process fails to call the procedure of package and fails with ORA-06508.
It seems as if the web process runs with the rights of the appellant, or a role is not granted.
Can someone help me understand what the problem is?
offered hv, I appreciate your comments.
We solved the problem: remove the package that couldn't be cited, then re-create. That's all!
Apparently, something in the database was tangled upward. The server recently had problems with disk space, then it might have been related to that. But we'll never know for sure.
The stored procedure and packaging (procedures) which he called were owned by the same schema, and there is no mechanism that I can find to prevent one of the other appellant. But that was the case - Oracle threw the ORA-06508 exception when the stored procedure called the package procedure.
I replaced the stored procedure and package several times fine-tuning debugging code, but this has not fixed the problem.
Finally let it drop and then re-create the package, it's which solved the problem.
Regarding requests to view the code, there is no way that I could reproduce the problem, since the error that occurred was against the permissions and rules which packages run and the procedures of the Oracle. Thanks for all the tips and suggestions.
-
How to move the functions and procedures of packages in a schema?
Hello
I have less than the needs for a work at home and my question is if anyone can point me in the right direction to find documentation that can help me solve below. Any information will be appreciated. Thank you.
Write procedures and functions (included or not in packets) as .txt or .sql scripts. Once they have been launched in Developer SQL they should, in addition, the functions and procedures of packages in the current schema. If the current schema contains only 2 packages, pac1 (p11, p12 procedures and functions f11, f12, f13) and pac2 (contains the p21 following procedures, p22, p23 and f21 and functions f21 (case of overload), running the scripts produce the following effects:)
- Procedures p11, p12, p21, p22, p23, and f11, f12 and f13 functions will be created in the current schema.
- PAC2 will contain 2 instances of the function of overload-f21; they will be kept in the package, without be created in the current schema. If all overloaded procedures/functions will be kept in their original packaging
- If pac1 contains variables, cursors, and public types, keep us only the details of the package (and remove the body); usually if the packages contain no overloaded functions or procedures the body will be removed and if no variable, cursors, types of public then we will remove the header.
- If in the triggers, procedures and functions we will call procedures/functions packages (procedures and functions moved into the current schema) they reference will need to be updated (via editing the body or recompilation) for example if pa1.p12 will be replaced with p12.
- Scripts must have numbers in the next series (01... n) and the characters that explain the content.
My only advice would be to remember that these are public forums and if YOU can find them, therefore cannot your instructors.
In addition, those are horrible procedure names and function
This mission seems to be around to overload the pl/sql objects and... prioritize a research on Oracle documentation around overhead and legacy
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28371/adobjplsql.htm#i21148 -
Hi all
We try to add new proposal for a salary of some employees from form August 1, 2015 (the Date of the beginning of employee)
There is no existing salary proposal doesn't exist for these employees.
We get below error.
ORA-01422: exact fetch returns more than the requested number of rows in the hr_maintain_proposal_swi procedure insert_salary_proposal package
Help, please.
Thank you
Tarun
Hi John,.
If it helps, take a look at the following note:
ORA-01422 exact Fetch returns more than number of lines requested in Hr_maintain_proposal_swi (Doc ID 1673527.1)
Kind regards
Rajen
-
Updated APEX collection error ORA-04044: procedure, function, package, type
Hi all
I am trying to update the APEX MEMBER of the COLLECTION and encounter errors:
1 error has occurred
ORA-06550: line 9, column 8: PL/SQL: ORA-04044: procedure, function, package or type is not allowed here ORA-06550: line 7, column 3: PL/SQL: statement ignored
The PLSQL code are as below
DECLARE
entire x;
v_date_started VARCHAR2 (255);
v_date_finished VARCHAR2 (255);
BEGIN
SELECT c.seq_id
X
OF APEX_COLLECTION c
WHERE collection_name = "PHASE_COLLECTION."
AND c001 =: P41_MPM_ID
and rownum = 1;
v_date_started: =: P41_DATE_STARTED;
v_date_finished: =: P41_DATE_FINISHED;
APEX_COLLECTION. () UPDATE_MEMBER
p_collection_name = > 'PHASE_COLLECTION '.
, p_seq = > x
, p_c004 = > v_date_started
, P_c005 = > v_date_finished
);
END;
The process will take place after SUBMIT and validation.
The code I used to add a colletion APEX will work perfectly and is as below
-Initialization Collection PHASE_COLLECTION
BEGIN
IF THIS ISN'T APEX_COLLECTION. COLLECTION_EXISTS('PHASE_COLLECTION') THEN
APEX_COLLECTION. CREATE_COLLECTION ('PHASE_COLLECTION');
ON THE OTHER
APEX_COLLECTION. TRUNCATE_COLLECTION ('PHASE_COLLECTION');
END IF;
-Add members to the COLLECTION PHASE of table PHASE_MEMBERSHIP
IF: P41_MPM_ENG_ID IS NOT NULL THEN
FOR x IN (SELECT mpm_id, mpm_eng_id, phase_number, date_started, date_finished, date_created
OF phase_membership
WHERE mpm_eng_id =: P41_MPM_ENG_ID
AND active = 1
ORDER BY date_created)
LOOP
APEX_COLLECTION. ADD_MEMBER
(p_collection_name = > 'PHASE_COLLECTION')
, p_c001 = > x.MPM_ID
, p_c002 = > x.MPM_ENG_ID
, p_c003 = > x.PHASE_NUMBER
, p_c004 = > x.DATE_STARTED
, p_c005 = > x.DATE_FINISHED
, p_c006 = > x.DATE_CREATED
);
END LOOP;
END IF;
EXCEPTION
WHILE OTHERS THEN
Logger.Error (p_message_text = > SQLERRM)
, p_message_code = > SQLCODE
, p_stack_trace = > dbms_utility.format_error_backtrace
);
LIFT;
END;
What I tried to use APEX_COLLETION to check the overlap between the date_range.
The requirement is just to display a warning if the user adds a record to the new phase or update record of current phase may overlap between the order of phase together.
Table PHASE_MEMBERSHIP script is
CREATE TABLE 'PHASE_MEMBERSHIP '.
(
ACTIVATE THE "MPM_ID" NUMBER NOT NULL,
ACTIVATE THE "MPM_ENG_ID" NUMBER NOT NULL,
ACTIVATE THE "PHASE_NUMBER" NUMBER (2.0) NOT NULL,
"DATE_STARTED" DATE NOT NULL ACTIVATE.
DATE OF THE "DATE_FINISHED."
'NOTES' VARCHAR2 (2000 BYTE),
'DATE_CREATED' DATE NOT NULL ACTIVATE.
ACTIVATE THE 'CREATED_BY' VARCHAR2 (20 BYTE) NOT NULL,
NUMBER (2.0) 'ACTIVE' DEFAULT 1 ACTIVATE NOT NULL)
So, basically, I want to fill the documents associated with a particular to a collection of APEX called PHASE_COLLECTION MPM_ENG_ID.
Then when the user specify date_started and date_finished, it will update/insert the APEX collection first.
Then the rank based on audit collection date
http://www.Oracle-base.com/articles/Misc/overlapping-date-ranges.php
then display the warning to ask the user to confirm message.
But then I'm stuck at the step of updating COLLECTION of APEX.
If anyone has any ideas on what is wrong, please help.
Thanks in advance.
AnnYour syntx error line number should give you the trick - it is not a member of the update, rather the SQL - you are referring to apex_collection, not apex_collections view dictionary.
Scott
-
Calling a procedure of package with only Date setting
Hi all
Please, help me to call a procedure of package with Date from the sql command prompt parameter.
ArifCheck the procedure below.
SQL> ed Wrote file afiedt.buf 1 create or replace procedure procdate (p_date_in date) 2 is 3 p_date_out date; 4 begin 5 p_date_out := add_months(p_date_in,6); 6 dbms_output.put_line(p_date_out); 7* end; SQL> / Procedure created. SQL> exec procdate('01-JAN-2010'); 01-JUL-10 PL/SQL procedure successfully completed. SQL> exec procdate(to_date('01/01/2010','DD-MM-YYYY')); 01-JUL-10 PL/SQL procedure successfully completed. SQL> exec procdate('31-DEC-2010'); 30-JUN-11 PL/SQL procedure successfully completed.
-
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 -
Re: Run packages of DB oracle OBIEE
Hello
Hope everything goes well. I was just wondering how do you run Oracle DB OBIEE packages? How can I say package.procedure or package.function EXEC?
Thanks in advance,
SamHello..
Hope that you said... use package.procedure or package.function to evaluate function...
OR
If you go physical layer... and try to create the new table physical...
Select the type of Table as Select and try to call your function package here...
Sorry to say, I didn't work on this... but try and report...
See my post Re: calling stored procedure for the Conversion of Date ... to... understand what some what.Thank you & best regards
Kishore GuggillaPublished by: Kishore Guggilla, December 17, 2008 12:07
-
Cannot install itunes for windows - error: Apple Application Support is required to run Itunes Helper. Uninstall and reinstall (as I did twice)
For general advice, see troubleshooting problems with iTunes for Windows updates.
The steps described in the second case are a guide to remove everything related to iTunes and then rebuild what is often a good starting point, unless the symptoms indicate a more specific approach.
Review the other boxes and other support documents list to the bottom of the page, in case one of them applies.
More information area has direct links with the current and recent buildings if you have problems to download, must revert to an older version or want to try the version of iTunes for Windows (64-bit-for old video cards) as a workaround for problems with installation or operation, or compatibility with QuickTime software or a third party.
Backups of your library and device should be affected by these measures but there are links to backup and recovery advice there.
TT2
-
Impossible to run Packages using Agent
Hello
When I try to run packages using Agent that is located on another machine it gives the following error.
' * ' unable to selected executethe logical agent is not assosciated to a physical agent in the desired context. » *
java.util.NoSuchElementException
in java.util.AbstractList$ Itr.next (AbstractList.java:350)
at com.sunopsis.graphical.dialog.SnpsDialogExecution.getAgent(SnpsDialogExecution.java:1436)
at com.sunopsis.graphical.dialog.SnpsDialogExecution.doScenarioExecuter(SnpsDialogExecution.java:1104)
at oracle.odi.ui.action.SnpsPopupActionExecuteHandler.actionPerformed(SnpsPopupActionExecuteHandler.java:64)
at oracle.odi.ui.SnpsActionControler.handleEvent(SnpsActionControler.java:75)
at oracle.ide.controller.IdeAction.performAction(IdeAction.java:529)
at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:884)
at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:501)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
in javax.swing.AbstractButton$ Handler.actionPerformed (AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
in javax.swing.plaf.basic.BasicMenuItemUI$ Handler.mouseReleased (BasicMenuItemUI.java:850)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)Hello Manu,
Check your agent with test connection and take a look at your context when executing time he asks the context and the agent.
If you have agents and contexts various choice name please correct logical agent linked to the context...
in this case also you not able to find the solution, and then got to the topology manager---> go to the logical architecture and open your agent, see your logical name of the agent in different contexts, please check like that under the physical schema window in contexts also.
Kind regards
Surya. -
run a certain procedure in package
Good day to all,
I have a package with 8 procedures,
based on the parameter num (1 to 8)
I want to run one of them.
I think of If... else or case statement...
is there an another posiibilities.
Thank youHello
903537 wrote:
... I think of If... else or case statement...
is there an another posiibilities.None of which makes no sense. Use CASES.
-
Alarm procedure runs at startup
Hello
I created an alarm that monitors a calculated channel. The upper limit of the alarms is 5. There is no lower limit. If the alarm procedure is called that sets a flag. It works very well. But if I deploy the project the flag is already set at the opening of the workspace, even if the condition is not reached. It seems that the procedure is called on startup. This isn't my start-up procedure. In my startup procedure, the indicator is reset to 0.
I read: unexpected running procedures
and my startup procedure is now an end stage, but the situation has not changed.
I use VS 2011.
Frank
Your installer works great, I use a PC host.
I started to remove my installation so you sent it when all of a sudden, it worked. The problem is related to my calculated channel.
This is the formula: abs ([Variable 0] - [Variable 1]) Variable 0 from a simulation model and variable 1 is a channel of the user.
It seems to me like a timing problem of a certain type (model value init not ready or false).
My solution is to set the initial state of the alarm for disabled and wait a bit before I turn it in my startup routine. For now it works.
Thank you very much for your help!
-
How to use the record type as a parameter IN PL/SQL procedure or package
Hi people,
I need help on the record as the OUT parameter type. I am able to get out a single line as a parameter, but not getting do not idea how to get a multi ranks as output parameter.
I have the code that works very well for a single line. Please see CODE1.
But when I try to get several lines, I'm failing to do. Please see the CODE2. I get the error of compilation as
Error report:
ORA-06550: line 11, column 35:
PLS-00487: Invalid reference to the variable "P_NAME.
ORA-06550: line 11, column 1:
PL/SQL: Statement ignored
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
Any help or a sample execution of script would be really useful.
Thanks in advance.
YZ
--------------------------CODE1------------------------------------------
-------------------------Package Spec-------------------------------
CREATE OR REPLACE
PACKAGE xx_sample_pkg as
--
Xx_sample_table_rectype RECORD TYPE IS
(p_name varchar2 (40))
number of p_emp_id
);
PROCEDURE xx_sample_prc (xx_sample_rec1, OUT xx_sample_table_rectype);
END xx_sample_pkg;
------------------------------Package Body------------------------
create or replace
PACKAGE xx_sample_pkg AS BODY
--
PROCEDURE xx_sample_prc (xx_sample_rec1 OUT xx_sample_table_rectype) IS
BEGIN
SELECT ename, empno
IN xx_sample_rec1
FROM scott.emp
WHERE ename = 'SMITH ';.
END xx_sample_prc;
END xx_sample_pkg;
-------------------------------------------Execute----------------------
DECLARE
l_rec_type xx_sample_pkg.xx_sample_table_rectype;
BEGIN
dbms_output.put_line ('xx_sample_prc appeal');
xx_sample_pkg.xx_sample_prc (l_rec_type);
dbms_output.put_line ('YZ' | l_rec_type.p_name |') '|| l_rec_type.p_emp_id);
END;
---------------------------------------------------------------
-------------------------CODE2-------------------------------------------
-------------------------Package Spec-------------------------------
CREATE OR REPLACE
PACKAGE xx_sample_pkg as
--
Xx_sample_table_rectype RECORD TYPE IS
(p_name varchar2 (40))
number of p_emp_id
);
PROCEDURE xx_sample_prc (xx_sample_rec1, OUT xx_sample_table_rectype);
END xx_sample_pkg;
------------------------------Package Body------------------------
create or replace
PACKAGE xx_sample_pkg AS BODY
--
PROCEDURE xx_sample_prc (xx_sample_rec1 OUT xx_sample_table_rectype) IS
BEGIN
SELECT ename, empno
IN xx_sample_rec1
FROM scott.emp;
END xx_sample_prc;
END xx_sample_pkg;
-------------------------------------------Execute----------------------
DECLARE
l_rec_type xx_sample_pkg.xx_sample_table_rectype;
BEGIN
dbms_output.put_line ('xx_sample_prc appeal');
xx_sample_pkg.xx_sample_prc (l_rec_type);
for l_rec in 1.l_rec_type.p_name.count
loop
dbms_output.put_line ('YZ' | l_rec_type.p_name (l_rec) |) » '|| l_rec_type.p_emp_id (l_rec));
end loop;
end;
---------------------------------------------------------------
bb8c573a-6ca3-4d7c-90ed-e55c2df67201 wrote:
But now, my question would be why the record type could not be used? My understanding is missing some concept between use of type type array collection record vs. Please specify.
Do not confuse the folder with the collection.
SY.
-
Cursor of procedure statement package
Hi am facing these issues, I'm too close to the problem to understand. Pl help
\procedure addRox(p_reg_type_id in number, p_offender_id in number,p_sentence_end_date in date, p_registration_date in date,p_end_registration_date in date, p_aggravated in varchar2,p_habitual in varchar2, p_comments in varchar2, p_status in varchar2 DEFAULT null , p_OFFENSE_CODE in number) is cursor tierNum is select max(c.tier) from sor_offense o, sor_offense_code c where o.offender_id = p_offender_id and o.offense_code = c.CODE_ID and o.state = 30658 and upper(o.status) = 'ACTIVE'; tier number; vEndRegDate registration_offender_xref.END_REGISTRATION_DATE%type default null; begin open tierNum; Fetch tierNum into tier; if tierNum%NotFound then tier := Null; end if; Close tierNum; if tier is not null then if(p_sentence_end_date is null) then -- sentenceEndDate is null if tier = 1 then vEndRegDate := add_months(p_registration_date - 1,180); end if; if tier = 2 then vEndRegDate := add_months(p_registration_date - 1,300); end if; if tier = 3 then vEndRegDate := Null; end if; else -- sentence_end_date is not null if tier = 1 then vEndRegDate := add_months(p_sentence_end_date - 1,180); end if; if tier = 2 then vEndRegDate := add_months(p_sentence_end_date - 1,300); end if; if tier = 3 then vEndRegDate := Null; end if; end if; end if; insert into registration_offender_xref (reg_type_id, offender_id, status,sentence_end_date, registration_date,end_registration_date,aggravated,habitual,status_date, comments) values (p_reg_type_id, p_offender_id, 'Active',p_sentence_end_date, p_registration_date,vEndRegDate,p_aggravated,p_habitual,sysdate, p_comments); -- commit; exception when others then DBMS_OUTPUT.PUT_LINE('ERR in '||sqlerrm); end addRox;
Error:error (4.12): PLS-00323: subprogram or cursor "ADD_ABC" is declared in a package specification and must be defined in the package bodySomeone advised me two or three days back, the cursor is ineffective, you should try to do stuff in sql itself. This isn't the exact solution to the question above. But works for me.
THUS, instead of cursor selects variables in the body of proc.Thank you
Maybe you are looking for
-
How to download using mobile data instead of a Wi - Fi connection
Dear Sir. I use iPhone 6s. I would like to ask for your help as to how I could use mobile data to download for the software updates. There was always a prompt message to inform that I could download when connected to a Wi - Fi network. Hoping to hear
-
Cannot access the websites of google on ipad
I have an iPad 2 and can go in safari, but can not enter in all of the proposed web sites, nothing happens.
-
My back up is more than 2 months at the start of my new phone?
WWhen from near the top of my new iPhone 6 back to the top of my previous phone is over 2 months old?
-
I can't do anything because it says that I need the administrative password I did 3 bad and received the code of 55198210
-
Method of interpolation in 3-d charts
Hello Please, what is the interpolation method used in 3-d for the generation of smooth surface charts? Thank you