Calling a procedure
HelloI am trying to call a procedure in a different package and I get the following error:
ORA-06508: PL/SQL: called program unit is not found
I executed the following command to see if the procedure that I'm calling is INVALID:
SELECT object_name, object_type, created, last_ddl_time, status from user_objects where status! = 'VALID ';
I don't see my invalid procedure. Any other reason why my procedure is unable to find the other package procedure.
My code is as follows:
CREATE or REPLACE PACKAGE BODY DEV2.email_p as
PROCEDURE to send)
pSender VARCHAR2,
precipients VARCHAR2,
CCP VARCHAR2,
-pbcc VARCHAR2,
psubject VARCHAR2,
pMessage VARCHAR2,
pnumattach NUMBER,
pnoteid NUMBER)
IS
p_blob BLOB;
p_filename VARCHAR2 (200);
p_filetype VARCHAR2 (200);
p_noteid NUMBER;
p_date VARCHAR2 (200);
p_currSeq NUMBER;
NUMBER of p_currSeq2;
utl_smtp conn. CONNECTION;
I have SEVERAL;
j NUMBER;
Len NUMBER;
Temp NUMBER;
p_bcc VARCHAR2 (500);
BEGIN
IF pnumattach > = 1
THEN
-THIS IS WHERE I GET THE ERROR MESSAGE. MY PROCEDURE IS UNABLE to CALL SEND_EMAIL_HELPER.begin_mail
Conn: = SEND_EMAIL_HELPER.begin_mail)
sender = > psender,.
recipients = > precipients,
subject = > psubject,
mime_type = > send_email_helper. MULTIPART_MIME_TYPE);
() SEND_EMAIL_HELPER.attach_text
Conn = > conn,.
data = > pmessage,.
mime_type = > ' text/html');
j: = 1;
Temp: = pnumattach;
p_currSeq2: = 0;
Blob_data SELECT ON accessory FROM p_blob WHERE attachment_pk = 685;
SELECT file_name ON accessory FROM p_filename WHERE attachment_pk = 685;
Mime_type SELECT ON accessory FROM p_filetype WHERE attachment_pk = 685;
() SEND_EMAIL_HELPER.begin_attachment
Conn = > conn,.
mime_type = > p_filetype,
Online = > TRUE,
filename = > p_filename,.
transfer_enc = > 'base64');
i: = 1;
Len: = DBMS_LOB.getLength (p_blob);
WHILE (I < len)
LOOP
IF (i + SEND_EMAIL_HELPER. MAX_BASE64_LINE_WIDTH < len) THEN
UTL_SMTP. Write_Raw_Data (conn,
UTL_ENCODE. Base64_Encode)
DBMS_LOB. SUBSTR (p_blob, SEND_EMAIL_HELPER. MAX_BASE64_LINE_WIDTH, i)));
ON THE OTHER
UTL_SMTP. Write_Raw_Data (conn,
UTL_ENCODE. Base64_Encode)
DBMS_LOB. SUBSTR(p_blob,_(Len-i) + 1, i)));
END IF;
UTL_SMTP. Write_data (conn, UTL_TCP. CRLF);
i: = i + SEND_EMAIL_HELPER. MAX_BASE64_LINE_WIDTH;
SEND_EMAIL_HELPER.end_attachment (conn = > conn);
END LOOP;
SEND_EMAIL_HELPER.end_mail (conn = > conn);
ON THE OTHER
BEGIN
p_bcc: = NULL;
UTL_MAIL. Send (psender, precipients, CCP, ", psubject, pmessage);
EXCEPTION
WHILE OTHERS THEN
Insert in sampletable (empname) values ("is there a problem");
END;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
INSERT into sampleTable (empname) values (p_currSeq2);
ns.returnError ('EMAIL_P.send - 001', substr(sqlerrm,1,500));
WHILE OTHERS THEN
INSERT into sampleTable (empname) values ("another error");
ns.returnError ('EMAIL_P.send - 002', substr(sqlerrm,1,500));
END send;
Looks like you're fails on the connection to the smtp server. It is not the call to begin_mail which is a failure, but the call of utl_smtp.open_connection which is probably called by the begin_session function that calls the begin_mail function.
If begin_session in your package is defined as follows:
FUNCTION begin_session RETURN utl_smtp.connection IS
conn utl_smtp.connection;
BEGIN
-- open SMTP connection
conn := utl_smtp.open_connection(smtp_host, smtp_port);
utl_smtp.helo(conn, smtp_domain);
RETURN conn;
END;
What is the value of the smtp_domain variable?
In the DEMO_MAIL package that it is declared in the package spec, so I'm expecting something similar is declared in your spec package as well. If this value is null, you must set first before opening your connection:
SEND_EMAIL_HELPER.smgp_domain := 'yourdomain.dom';
Tags: Database
Similar Questions
-
Hi friends I want to know how to call a procedure that has values arrary as parameter?
I have a procedure as shown below, and I am using oracle 11g.
create or replace procedure procedureName (v_hospital_id in NUMBER,
v_process_id VARR_VARRY,
v_cnt OUT NUMBER);
Now, how to call this procedure from PLSQL. If v_process_id values ('abc123', 'xyz234', 'sfs234')
Please present the definition of VARR_VARRY
If it's a simple table of varchar2.
declare
v_cnt NUMBER;
Start
procedureName (1, VARR_VARRY('abc123','xyz234','sfs234'), v_cnt);
end;
-
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.
-
call a procedure of package DB type complicated if the type defined in the package itself
Hello world
I use jdev 11.1.1.7.0
I defined a package of data with a procedure and internal two types as follows:
Create Or Replace Package Db_Package As Type rec Is Record(Rec_Type Varchar2(10), Rec_Desc varchar2(10) ); Type recordList Is Table Of rec; Procedure Test_Procedure(p_out out recordList); END db_package;
evil
I want to call this procedure in the module of the application. I know how to call a procedure or function db AM,
but in this case that I've defined two types in the package itself and I use one of these types as to the procedure output parameter, I had a problem.
below is the example of code to call the db procedure, but it does not work because the plsqlBlock.registerOutParameter () setting will not
CallableStatement plsqlBlock = null; String statement = "Begin DB_PACKAGE.Test_Procedure(:1); END;"; try { plsqlBlock = getDBTransaction().createCallableStatement(statement, 0); plsqlBlock.registerOutParameter(1, OracleTypes.ARRAY);// it doesn't work plsqlBlock.executeUpdate(); Object object = plsqlBlock.getObject(1); } catch (Exception e) { e.printStackTrace(); }
I know that if I set the types of packets (rec, recordList) as types of oracle (instead of setting in the packaging itself) so I can call the procedure with success, in this case I should use below:
plsqlBlock.registerOutParameter(1, OracleTypes.ARRAY,"Recordlist");
but I wonder how you can call a procedure from the package if the types defined in the package itself.
Kind regards
Habib
JDBC supports the types of oracle level package only from 12 c database and jdbc driver ojdbc7 (which requires java 7).
Dario
-
How to call the procedure on the page of the ofa
Hi all
I have a button.when I click this button need to call the procedure and should return the values.i tried with below code.am is error.i am passing two parameters to the procedure.please suggest me where I made a mistake in the code.
code in am
-------------
public String calprorate (String laseid, String billingid)
{
OADBTransaction oadbtransaction = (OADBTransaction) getTransaction ();
OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl) getTransaction ();
String retValues;
System.out.println ("number:" + laseid);
StringBuffer str = new StringBuffer();
Str.Append ("BEGIN");
Str.Append (LEASE_PRORATE_PKG ".") LEASE_PRORATE_PROC1 (»);
Str.Append ("p_lease_id = >: 1");
Str.Append ("p_billing_id = >: 2");
Str.Append ("P_PRORATE = >: 3");
System.out.println ("params");
Str.Append (»); «) ;
Str.Append ("END");
System.out.println ("End");
OracleCallableStatement oraclecallablestatement =
(OracleCallableStatement) oadbtransaction.createCallableStatement (str.toString (), 1);
System.out.println ("Oracle");
try {}
oraclecallablestatement.setString(1,laseid);
oraclecallablestatement.setString(2,billingid);
oraclecallablestatement.setInt (1, Integer.parseInt (laseid));
oraclecallablestatement.setInt (2, Integer.parseInt (billingid));
System.out.println ("param");
oraclecallablestatement.registerOutParameter (3, Types.VARCHAR);
System.out.println("3");
oraclecallablestatement. Execute();
System.out.println ("exe");
retValues = oraclecallablestatement.getString (3);
}
catch (System.Exception e)
{
System.out.println ("delivery");
throw OAException.wrapperException (e);
}
Return retValues;
System.out.println ("End");
}
code co:
-------------
If (pageContext.getParameter ("Calc")! = null) {}
Vo1 OAViewObject = (OAViewObject) am.findViewObject ("AddonBillingVO");
System.out.println ("VO");
{if(VO1!=null)}
CNT int = vo1.getRowCount ();
System.out.println ("count:" + cnt);
If (cnt > 0)
{
RowSetIterator rs = vo1.createRowSetIterator("empIterator");
System.out.println ("EMP");
If (rs! = null)
{
While (rs.hasNext ())
{
AddonBillingVORowImpl line = rs.next ((AddonBillingVORowImpl));
System.out.println ("impl");
If (line! = null)
{
String laseid = row.getAttribute("LeaseId").toString ();
System.out.println (laseid);
String billingid = row.getAttribute("AddonBillingId").toString ();
[Serializable] param = {}
laseid, billingid
};
String newupc = (String) am.invokeMethod ("calprorate", param);
}
}
Khalil.
You can paste your spec procedure here?
Also see: Oracle tips of Johny: OAF: sample code to call the PL/SQL of OA Framework procedure
-
Case function can be used as a parameter when calling a procedure, please notify
The daily procedure is called with the parameter 3 following one of the parameters using a function box between them as shown below.
Daily_Ins (c1.p_mtrid, c1.p_UOM CASE WHEN "KWH" THEN 1 ELSIF 'KW' THEN 2 END, v_dateHold);
In my opinion, using decode is illegal, so I think that I cannot say something like :
Daily_Ins (c1.p_mtrid, ( decode c1.p_UOM, "KWH", 1 'KW', 2), v_dateHold);
I think I just found something on the net
SQL > DECLARE
2 wages NUMBER: = 20000;
3 employee_id NUMBER: 36325 =;
4
5 PROCEDURE give_bonus (emp_id in NUMBER, bonus_amt number) IS
6 BEGIN
7 DBMS_OUTPUT. Put_line (emp_id);
8 DBMS_OUTPUT. Put_line (bonus_amt);
9 END;
10
BEGIN 11
12 give_bonus (employe_id,
13 CASES
14 salary when > = 10000 AND salary<=20000 then="">=20000>
15. WHAT salary > 20000 AND salary<= 40000="" then="">=>
16. WHAT > 40000 salary THEN 500
17 0 OTHERWISE
18 END);
END 19;
20.
PL/SQL procedure successfully completed.
-
How to call the procedure type table
Hi I have the below requirement
Created in the sub table type
CREATE or REPLACE the TYPE char_type IS the TABLE OF VARCHAR2 (4000);
create or replace procedure test_proc_type (p_type char_type) is
Start
I'm looping 1.p_type.count
dbms_output.put_line (p_type (i));
end loop;
end;
How to call the procedure with parameter as a type!
SQL> create or replace type char_type as table of varchar2(4000) 2 / Type created. SQL> create or replace procedure test_proc_type (p_type char_type) 2 is 3 begin 4 for i in 1..p_type.count loop 5 dbms_output.put_line (p_type(i) ) ; 6 end loop; 7 end; 8 / Procedure created. SQL> set serveroutput on SQL> SQL> exec test_proc_type(char_type('A','B','C','D','E')) A B C D E PL/SQL procedure successfully completed. SQL>
-
Hello
I need help to call a procedure within a package.
I have an ABC package in which I have 3 X Y and Z I procedures I need to call the procedure procedure Y X that belongs to the same package.
Thanks in advance
I have an ABC package in which I have 3 X Y and Z I procedures I need to call the procedure procedure Y X that belongs to the same package.
This forum, as the title suggests, is for developer Sql questions only and NOT for questions of SQL or PL/SQL.
If this is not related to Sql Developer then please mark ANSWERED and repost it in SQL and PL/SQL forum
https://community.Oracle.com/community/Developer/English/oracle_database/sql_and_pl_sql
During the validation you must provide your name and full version.
You must also explain why even need help because procedure X can call just procedure Y directly since they are in the same package.
For an Oracle DB, see documentation and examples of ' packages of PL/SQL to help "in the doc of the PL/SQL language
http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/packages.htm#CIHIJECJ
-
NullPointerException when calling stored procedure
I have the stored procedure
create or replace PROCEDURE GREETING_PROC
(
TEXT_PARAM IN VARCHAR2
MSG_TEXT VARCHAR2 OUT
) AS
BEGIN
MSG_TEXT: = "Hello" | TEXT_PARAM;
END;
My stored procedure call method
public class UserBean {}
public UserBean() {}
Super();
}
Public Shared Sub main (String [] args) {}
UserBean userBean = new UserBean();
userBean.callP ();
userBean.callStoreProcedure ();
}
public void callStoreProcedure() {}
CallableStatement st = null;
SysUser SysUserEOImpl = new SysUserEOImpl();
try {}
String sql = "BEGIN GREETING_PROC (: TEXT_PARAM,: MSG_TEXT); END; « ;
St = sysUser.getDBTransaction () .createCallableStatement (sql, sysUser.getDBTransaction (). DEFAULT VALUE);
st.setObject ("TEXT_PARAM", "Scoot");
st.registerOutParameter ("MSG_TEXT", Types.VARCHAR);
St.Execute ();
System.out.println ((String) St.GetObject ("MSG_TEXT"));
} catch (SQLException e) {}
throw new Aexception.getLocalizedMessage (e);
}
}
then I got an exception:
Exception in thread "main" java.lang.NullPointerException
at cic.opsi.model.bean.UserBean.callStoreProcedure(UserBean.java:35)
at cic.opsi.model.bean.UserBean.main(UserBean.java:27)
Hello
What statemet is UserBean.java:35)?
Second, create a new SysUserEOImpl()!
If you want to call stored proc, put the java code calling stored proc in ViewRowImpl/ViewObjectImpl/ApplicationModuleImpl and export this code in the customer interface. Then put this method in the pageDef as
a call him as an OperationBinding Zeeshan Baig blog: the PL/SQL procedure call and function in the Oracle ADF application
Extending the functionality of the components Business
ADF/OFA for Oracle Techies: ADF call stored procedure with Out parameters
Latest Oracle technology: call Store procedures for Oracle ADF Application
-
How to call a procedure with parameter SYS_REFCURSOR OUT
Hello
With the help of Oracle 11 g R2.
I would like to know if it is possible to display the results of a SYS_REFCURSOR in a query. For example, if I had the following stored procedure
create or replace procedure testprocedure (result OUT sys_refcursor) as begin open result for select 1 from dual union all select 2 from dual; end;
I want to call this procedure similar to how a query is called and executed. Like this
Select * from testprocedure
I have seen lots of examples on the web that show how it is possible to loop through the results of a sys_refcursor inside an anonymous block and display the results using dbms_output.putline, but this isn't the method I'm looking for.
Read this: PL/SQL 101: understanding Ref Cursor
You're wrong if you think a ref cursor is a result set of data that you can query from.
-
calling a procedure in the loop
I just want to know one thing:
I call a procedure with the following parameters
DECLARE
PROFIT_CENTER NUMBER ;
START
PROFIT_CENTER : = 1109--(de même, je fais tourner le proc pour 5 profit_centers plus 1123,1132,1122,3211,1111 un par un en passant les valeurs manuellement, il prend près d'une minute pour chaque centre de profit)
Prc_test_calc () PROFIT_CENTER);
COMMIT;
END;
For each proc profit_center takes 1 minute (approx.) time.
But when I'm putting loop to call the procedure for each profit_center, I don't know why it takes too long for each profit_center
Please let me know is there something wrong with the loop below
DECLARE
PROFIT_CENTER NUMBER ;
cursor c_profit is
Select separate PROFIT_CENTER de plng_pc où profit_center in ()1109 1123,1132,1122,3211,1111)-Plng_pc is a table where profit_center information is obtain from
START
For pc_rec in c_profit
loop
Prc_test_calc ( pc_rec . PROFIT_CENTER );
COMMIT;
End loop;
END;
Could you please sugget me if something goes wrong?
Hello
as suggested, have you checked the query for the cursor loop and have you tried the process with no cursor loop.
Concerning
André
-
Call a procedure from javascript
Hello
I would like to help on the following please.
I have a JavaScript in page region 'function and Global Variable declaration ':
In the same page one have a number of standard reports. A number of columns in each of these reports sets a link. The binding for all the columns settings are defined as follows:function openUrl(pUrl) { window.open(pUrl,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=1024, height=768"); }
As you see, the user of the application, click on the link on the column of the report and a popup is generated showing the report. It all works very well.Target: URL URL: javascript:openUrl('http://#SERVERNAME#:9704/xmlpserver/Publications/Dock_Report.xdo?_xpf=&_xpt=0&_xdo=%2FPublications%2FDock_Report.xdo&_xmode=4&_paramsID_USU=#ID_USU#&_paramsIDCR=#IDCR#&_paramsIDCU=#IDCU#&_xt=DPol_Layout&_xf=pdf&_xautorun=true');
My requirement is to call a procedure from the augments that are included in the column link that was clicked by the user of the application.
My question is how to achieve this as the url is inside a call to javascript?#ID_USU# #IDCR# #IDCU#
Can I use the Javascritp set in the page to extract the details, and then use javascript to call a procedure?
Any help, pointers, ideas, everything is welcome.
Request Express 4.0.2.00.07
Thank you
Published by: zooid on 4 April 2013 22:47Have you seen this javascript API? http://docs.Oracle.com/CD/E17556_01/doc/apirefs.40/e15519/javascript_api.htm#BGBJHEHG
It has very convenient function: apex.submit (pOptions);
Specify the target URL as:
JavaScript:rowClick('#ID_USU#',_'#IDCRM#',_'#IDCU#');
Then add a function to your page somewhere:
function rowClick(idUsu, idcrm idcu){ openUrl(/*url*/); apex.submit({request: "SOME_REQUEST_VALUE", set: {Px_ID_USU: idUsu, Px_IDCRM: idcrm, Px_IDCU: idcu}}); }
(Where you have page elements for each of the items that you want to set.
Then you can have a process of PL/SQL page, under condition of request = expression 1, term 1 = SOME_REQUEST_VALUE
And do you want to ;-)
-
Calling a procedure from a form of Oracle database
Hello
I have a question, we will be calling the procedure from a form of Oracle, and through that we can spend as input values from 1000 to this procedure and that we must return values back to the Oracle form also. Here the damaged take two or more parameters. Please advice.
To receive the input values, we have the input parameter of the procedure as a type object, so that we can receive several parameter values.
Thanks and greetings
Srinivasuser2626293 wrote:
Hi François,Thanks for your response, please suggest me as to how we can achieve the passage of the parameters that can contain multiple values, by a call to the procedure of the form of the Oracle database
Hi Srinivas,
Here is an example of how...
CREATE OR REPLACE PROCEDURE P_GET_SAL (P_EMPID NUMBER, P_SAL OUT NUMBER) IS BEGIN SELECT SALARY INTO P_SAL FROM EMPLOYEE WHERE EMPLOYEE_ID=P_EMPID; END; SQL> VAR G_SAL NUMBER; SQL> EXEC P_GET_SAL(100,:G_SAL); PL/SQL procedure successfully completed. SQL> PRINT G_SAL; G_SAL ---------- 2300
Hope this helps
Hamid
If someone answer is useful or appropriate, please mark accordingly. *
-
Train stuck compilation when I call a procedure
Hello
I call a WHEN BUTTON PRESSED trigger procedure in a form.
The compilation is caught in the Middle when compiling reaches this trigger.
But when I compile the procedure that is called the form from the outside, its getting compiled successfully.
Any body can help me on this. Please let me know what could be the reason for this.
Thank you
SameerYou use a completely outdated version of the forms. At the very least, you should spend the last forms 6i forms, by applying the Patch 18. That will bring you to 6.0.8.27.0 the same level, Oracle does not support, but some of us still use it.
I think that there has always been problems using the links in the database, so I don't know what would be your solution. .. perhaps build procedures that run on the database to do the work, instead of starting in your form when they need to use the links in the database. Then call the procedures of your form.
-
Hi all
I use Sql Developer and calling several procedure like this:
Start multip (1,2); end;
Start multip (3,2); end;
Start multip (4.2); end;
Start multip (5.2); end;
and when I am trying to run this as one, treat this as a single block and not running.
Tried that too... but still get an error.
Start multip (1,2); end; \
Start multip (3,2); end; \
Start multip (4.2); end; \
Start multip (5.2); end; \
Please suggest what should be the syntax.
Thank you
VJRun it as:
begin multip(1,2); multip(3,2); multip(4,2); multip(5,2); end;
SY.
-
How to call the procedure in the package
Hi all!
The situation!
I received a package with body priview 'Change_utility '.
In this package, I had procedure, changing the data when triger calls a package, it is all ok and working
Now, I need to call a procedure in a single package gave him.
I need to run the sta_death procedure in the 'Change_utility' package with no code 112233-4455
How do I run that?
Thanks for the help!
IDMaybe (guessing)
begin change_utility.sta_death('112233-4455'); end;
Concerning
Etbin
Maybe you are looking for
-
What numbers of MPN are associated by model
I'm looking for I pad compatible with Square Up registry, Square lists the model "s # 1458, 1459-1460. The model # is rarely listed on E - bay etc. The MFN # is listed is the MPN # MD511LL/A or MD512LL/A the same unit as the above model #?
-
Trackpad acts as it is controlled remotely
MY trackpad will not answer me, but the cursor moves as if someone has access to it remotely. How can I fix it?
-
Satellite A300 - no lighting with WXP
Hello Excuse me for my bad English.My Toshiba A300 (Sat - 1EC) OS went from Vista to XP. Easy keys, keys shortcut and illumination stopped working. Thanks a lot of information from this forum, I downloaded the four drivers of Toshiba Support (Common,
-
Performance of newly shared printer on home network!
As I shared my computer printer with my husband papers began to jam and the printer prints incorrectly or not at all. I checked the 'Status' of the quue and Control Panel printer. All fittings are perfect and port 'USB '. My Lexmark 215 printer talki
-
Blue screen with error message: a problem has been detected and windows has shut down to prevent damge your computer. Session 3_Initialization_Failed Tried the F8 boot before we get to the blue screen and still get blue error message screen Tried to