Execution of a stored procedure in a Package in an Oracle schema?
I found solutions to guidance how to run stored procedures to an Oracle DB, for example http://blogs.oracle.com/adf/entry/call_db_stored_procedure_using.However, I have a database where procedures are in the packages and I want to know if there a way, that they can be run using enterprise Java Bean.
See you soon.
Published by: 893478 on October 27, 2011 05:46
Calling stored procedures has nothing to do with the Enterprise Javabeans directly. What you want to do, is to use JDBC to create a callable statement and follow these steps:
Connection conn = ...; // fetch from a datasource for example
CallableStatement ps = conn.prepareCall("call PACKAGENAME.PROCEDURENAME(?,?,?)");
ps.setString(1, "InputParam1");
ps.setString(2, "InputParam2");
ps.registerOutParameter(3, java.sql.Types.VARCHAR);
ps.execute();
String res = ps.getString(3);
This example accepts two input parameters and an output parameter. Adapt to your own needs. And don't forget to add exceptions and a finally clause in which you close the statement and connection.
Tags: Java
Similar Questions
-
ODP 12 c version 3 with EF 6.1.1 I can't add Stored Procedure of a package to my model
I use the ODP 12 c Release 3 (12.1.0.2.1), with Entity Framework 6.1.1 with the first database in MS Visual Studio 2013 update 4
I have a MVC 5 (.Net Framework 4.5.2) project that connects to Oracle 11 G R2 Database server, an existing database (Tables, views and a pack of Stored procedures)
I can add tables and use them successfully in my model
I can add a simple stored procedureHere's the problem:
I have my .edmx file right click and click on "update model from database...". «, on the 'Add' tab, I chose «Stored procedures and functions»
I can see the list of procedures stored in the package (format packageName.usp) and check the box for the stored procedure of my package, then click 'Finish' to start the update process.No stored procedures have been added to my Model.Store
The only possible exit I get the 'entity data model' is:
Generated template file: Model1.edmx.
Loading metadata from the database took 00:00:00.5803351.
The model generation took 00:00:00.3761861.How to add a stored procedure from a package with the Entity Framework 6.1.1?
I found the answer.
When in the edmx model and you right click "Update Model database.
Uncheck "Import selected stored procedures and functions in the entity model", select the package and update procedures. (It works)
Then in "Model Explorer" under "Model. Store\ stored procedures/functions" you will see your procedures in the package (finally). Then their card in "Function Imports".
I don't understand why unchecking import stored procedures works, but it does.
I also found easier to simply call the procedure directly and not using Entity Framework, as all my procedures are: insertion, update and deletions and not all parameters mapped on the model for the view.
-
Problem: Not sufficient privileges execution of stored procedure in a package
I am using Visual Studio 2008 Team Suite, ODT with ODAC 111.07.20 and I am trying to run a procedure stored within a packet, it displays the following error message:
Oracle.DataAccess.Client.OracleException: ORA-01031: insufficient privileges
ORA-06512: at & quot; KIKO. PACK_SP & quot; line 205
ORA-06512: at line 1
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper (Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx * pOpoSqlValCtx, ByVal src, String, Boolean Bcheck procedure)
at Oracle.DataAccess.Client.OracleException.HandleError (Int32 errCode, OracleConnection conn, String procedure, IntPtr opsErrCtx, OpoSqlValCtx * pOpoSqlValCtx, ByVal src, Boolean Bcheck)
at Oracle.DataAccess.Client.OracleCommand.ExecuteNonQuery)
at SqlOracleWebService.OracleReplicationTool.GetData (String strNameServer, String strNameDatabase, String strNameTable, String strNameStoreProcedure, String strUserId, String strPassword, intSince, intUntil, Int32 intPort, string strID Int64 Int64) in C:\Documents and Settings\kiko\Desktop\kiko\SQL-ORACLE\SqlOracleWebService\SqlOracleWebService\Oracle\OracleReplicationTool.vb:line 1171
at SqlOracleWebService.OracleReplicationTool.SmallDataInit (String strNameServerSource, String strNameDatabaseSource, String strNameServerDestiny, String strNameDatabaseDestiny, String strNameTable, String strUserIdSource, String strPasswordSource, String strUserIdDestiny, String strPasswordDestiny, Int32 intPortSource, Int32 intPortDestiny) in C:\Documents and Settings\kiko\Desktop\kiko\SQL-ORACLE\SqlOracleWebService\SqlOracleWebService\Oracle\OracleReplicationTool.vb:line 614
at SqlOracleWebService.OracleReplicationTool.ReplicationDataInit (Boolean boolBothDirections, String strNameServerSource, String strNameDatabaseSource, String strNameServerDestiny, String strNameDatabaseDestiny, String strNameTable, String strUserIdSource, String strPasswordSource, String strUserIdDestiny, String strPasswordDestiny, Int32 intPortSource, Int32 intPortDestiny) in C:\Documents and Settings\kiko\Desktop\kiko\SQL-ORACLE\SqlOracleWebService\SqlOracleWebService\Oracle\OracleReplicationTool.vb:line 28
at SqlOracleWebService.Service1.Oracle_ReplicationDataInit (Boolean boolBothDirections, String strNameServerSource, String strNameDatabaseSource, String strNameServerDestiny, String strNameDatabaseDestiny, String strNameTable, String strUserIdSource, String strPasswordSource, String strUserIdDestiny, String strPasswordDestiny, Int32 intPortSource, Int32 intPortDestiny) in C:\Documents and Settings\kiko\Desktop\kiko\SQL-ORACLE\SqlOracleWebService\SqlOracleWebService\Service1.asmx.vb:line 20
I have change the execute privileges and granted to the user KIKO execute the PACK_SP package, but it does not work. Could you help me?
Thanks in advance.
Published by: user9112176 on February 8, 2010 10:27This behavior is probably not related to the ODP and will happen when you run the same procedure as the same user of SQLPlus directly for example, so the PLSQL forum is probably a more appropriate place for assistance.
What is 'KIKO. PACK_SP', line 205? Roles are disabled inside stored procedures, so you must have the permissions that are granted directly.
It will be useful,
Greg -
DECLARE
the stored procedure varchar2 (25);
BEGIN
-DBMS_OUTPUT. Put_line ("enter the name of the procedure :'||: procname");
the stored procedure: =: procname;
DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);
stored procedure.
END;
: procname is a variable binding in the apex to switch the running value.
This is the error I get
ORA-06550: line 7, column 2:
PLS-00221: "STORED procedure" is not a procedure or is not defined
ORA-06550: line 7, column 2:
PL/SQL: Statement ignored
5the stored procedure: =: procname;
6 DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);
7. the stored procedure.
8 END;
SmtWtL wrote:
DECLARE
the stored procedure varchar2 (25);
BEGIN
-DBMS_OUTPUT. Put_line ("enter the name of the procedure :'||: procname");
the stored procedure: =: procname;
DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);
stored procedure.
END;
: procname is a variable binding in the apex to switch the running value.
This is the error I get
ORA-06550: line 7, column 2:
PLS-00221: "STORED procedure" is not a procedure or is not defined
ORA-06550: line 7, column 2:
PL/SQL: Statement ignored
5. the stored procedure: =: procname;
6 DBMS_OUTPUT. Put_line (' procedure :'|| stored procedure);
7. the stored procedure.
8 END;
What you're trying to achieve?
Bind variables cannot be used for the dynamic execution of stored programs. Dynamic SQL using lexical rather than bind substitution must be used to run when the program name is not known until execution of the programs.
declare sproc varchar2(25); begin sproc := :procname; dbms_output.put_line('procedure:'||sproc); execute immediate 'begin ' || sproc || '; end;'; -- DO NOT DO THIS! end;
It is a fundamental design flaw and a security disaster. It's stops essential compilation controls is performed and is open to attack by SQL injection and other security vulnerabilities. There is no good reason to do this.
-
Execution of the stored procedure Oracle EF6 error.
Hello
Need help with the oracle error
{"ORA-06550: line 1, column 8:"}
PLS-00306: wrong number or types of arguments in the call to "sp_name".
ORA-06550: line 1, column 8:
{"PL/SQL: statement ignored '}
This error occurs when the code runs the line in Vb.net application in Model Designer
MyBase.ExecuteFunction ("sp_name" para1, para2, para3, dOBpara4, para5)
I create the SSDL and CSDL, MSL files for oracle to MS SQL connection by the method mentioned in the link JasonShort - professional profile - CodeProject it worked perfectly fine without the stored procedures. I managed to insert, update, and delete records. Then, I created stored procedures for Insert, Update, Delete. It worked fine with MS SQL. I copied and updated oracle files respectively. I gives me the error mentioned above.
I executed stored procedures in Oracle SQL Developer, and it works without error. But when it is executed via the model there is light of the error. Can anyone let me know the solution for this error. I'm using VS2010, EF6, Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
Thank you
Prachin Soparkar
Hello
Sorry for the inconvenience. After I posted this question I took a break and saw that the error was nothing, but I had given FNAME as parameter name in MS SQL. In oracle when I created the sp I created the parameter with p_FNAME. Where the schema defined in the language SSDL and CSDL, MSL had to be changed to MS, but since I want to that it would be same in different databases, I choose to have changed it in oracle stored procedure. The error msg is confusing, it should be something not found parameter or incompatibility etc.
Thank you
Prachin Soparkar
-
The execution of a stored procedure from inside the cursor for loop?
I posted this in the SQL Developer forum, but I tried in SQLPlus and get the same error, so I think it's an encoding issue.
I have a piece of code that I'm trying to write that will only be executed once. The goal: we have three tables relating to the pieces of information. Each table has a column that stores the number of site that belongs to the part. We want to copy the parts of a site to about 130 sites which don't have any info on parts. The number of site is stored in another table. So I created three stored procedures, one for each of the three tables that we, who take 2 inputs: a source and destination site. Procedure names are: ptfile_copy_fac, ptxref_copy_fac and ptvndrs_copy_fac.
The problem I have is that I can run the procedures in a separate worksheet in SQL Developer, but when they are integrated in this cursor for loop, I get the following message from SQL Developer:
ORA-06550: line 23, column 11:
PLS-00103: encountered the symbol "PTFILE_COPY_FAC" during the expected in the following way:
:= . (@ %; immediate)
The symbol ': = ' was replaced by 'PTFILE_COPY_FAC' continue.
He repeated this for each of the three methods. I have attached the code I am trying to run below. He expects an assignment operator, but I have no idea why.
If there is a better way to do this, by all means let me know. I'm a SQL Server guy, I'm not sure how to do what I do using PL\SQL.
/ * Declares the variables source_fac and dest_fac.
The source_fac is the installation that we copy parts.
The dest_fac is the installation we copy parts to.* /
DECLARE
source_fac facility.facility_num%type;
INSTALLATION OF DEST_FAC. TYPE % FACILITY_NUM;
/ * Declare cursor to use loop for.
Slider load number installation and the status of the installation.
Is not installation of 1 or 2, since these will be
the main source of facilities.*.
CURSOR fac_cursor
IS
SELECT
facility_num,
div_state
Of
installation
WHERE
facility_num NOT IN (1,2);
BEGIN
FOR fac_row IN fac_cursor
LOOP
/ * Test for the State of the installation. If a Canadian State, the source_fac value 2.
Otherwise, the value source_fac 1.* installation.
IF fac_row.div_state IN ("AB", "BC", "Mo", "NB", "NL", "NT", "NS", "NAKED", "WE", "PE",
"QC", "SK", "YT")
THEN
source_fac: = 2;
ON THE OTHER
source_fac: = 1;
END IF;
/ * Sets the installation of destination to the facility_num from the cursor * /.
DEST_FAC: = FAC_ROW. FACILITY_NUM;
/ * Execute the three procedures, past of the source and dest AEC variable * /.
run ptfile_copy_fac (source_fac, dest_fac);
run ptxref_copy_fac (source_fac, dest_fac);
run ptvndrs_copy_fac (source_fac, dest_fac);
END LOOP;
END;
Published by: SunDevilKid on March 3, 2010 15:31
Update the comments you make more sense of the code.EXECUTE is a SQLPlus command, change your code to
dest_fac := fac_row.facility_num; ptfile_copy_fac(source_fac, dest_fac); ptxref_copy_fac(source_fac, dest_fac); ptvndrs_copy_fac(source_fac, dest_fac); END LOOP;
Max
http://oracleitalia.WordPress.com -
Required privilege to view the source code for the stored procedure
RDBMS Version: 11.2.0.4
Platform: Oracle Linux 6.4
In our Production database, we have an application schema named CRM_PROD. And we have a read-only user named steve in this PB.
Steve must be able to view the source code of all stored procedures, functions and packages in the CRM_PROD schema. But steve shouldn't be able to run these procedures, functions and packages in the CRM_PROD schema. What a privilege should give Steve for this?
SYS is owner of the dictionary of data and tables for the source code. See configuration of privilege and role authorization - 11 g Release 2 (11.2).
Select it no matter what dictionary grant will give user (read) access to the full data dictionary.
-
Error on the definition of the stored procedure in the simultaneous program
Hello
I created a stored procedure and wanted it attached to the concurrent program. The purpose of this stored procedure when you run it in simultaneous program, the system retrieves the data from the csv file downloaded from the server, then it will insert in the tables of SO / the Interface API. Below, the error occurred.
* Starts * 18 April 2012 18:18:42
Error ORACLE 6550 in FDPSTP
Cause: FDPSTP failed due to the ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in the call to 'SPKO1 '.
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
Steps I did to set the stored proc
< < simultaneous executable program > >
Executable: RDRAGON_SO_IMPORT
Short name: RDRAGON_SO_IMPORT
Application: Order management
Method of execution: PL/SQL, stored procedure
Run file name: SPKO1
< < concurrent program - set > >
Program: RDRAGON SO IMPORT
Short name: RDRAGON_SO_IMPORT
Application: Order management
Name of executable: RDRAGON_SO_IMPORT
Method: PL/SQL, stored procedure
Format: text
No set
-Here are my stored procedure-
CREATE OR REPLACE PROCEDURE APPS. SPKO1 IS
FH UTL_FILE. TYPE_DE_FICHIER;
v_line VARCHAR2 (32767).
v_source_id NUMBER (10);
v_created_by NUMBER (10);
v_creation_date DATE;
v_org_id NUMBER (10);
v_orig_sys_docref VARCHAR2 (50);
V_Customer VARCHAR2 (360);
v_customer_prev VARCHAR2 (360);
v_sold_to_org NUMBER (10);
v_orig_line_ref NUMBER (10);
v_item_code VARCHAR2 (2000);
v_ordered_qty NUMBER (10);
v_selling_price NUMBER (10);
v_count NUMBER (10);
v_stat NUMBER;
/******************************************************************************
NAME: SPKO
PURPOSE:
REVISIONS:
Worm Date Description of the author
--------- ---------- --------------- ------------------------------------
1.0 16/04/2012 administrator 1. Created this procedure.
NOTES:
Keywords to replace automatically available Auto:
Object name: SPKO
SYSDATE: 16/04/2012
Date and time: 16/04/2012, 17:55:42 and 16/04/2012 17:55:42
Username: admin (set in Options of TOAD, editor of the procedure)
Name of the table: (defined in the dialog box "New PL/SQL object")
******************************************************************************/
BEGIN
v_source_id: = 6;
v_created_by: = - 1;
v_org_id: = 204;
v_customer_prev: = null;
v_orig_line_ref: = 0;
v_stat: = 0;
SELECT header_id in (DE) v_orig_sys_docref
Select header_id
of OE_ORDER_HEADERS_ALL
creation_date desc order
) WHERE ROWNUM = 1;
FH: = UTL_FILE. FOPEN ('XXANDDIR2', 'myfile1.csv', 'R', 32767);
< < file_read_lines > >
LOOP
BEGIN
UTL_FILE. GET_LINE (fh, v_line);
V_Customer: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 1") ',' "') ','" ');
v_creation_date: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 2") ',' "') ','" ');
v_item_code: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 3") ',' "') ','" ');
v_ordered_qty: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 4") ',' "') ','" ');
v_selling_price: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 5") ',' "') ','" ');
v_orig_line_ref: = (v_orig_line_ref + 1);
If v_stat = 0 then
v_orig_sys_docref: = (v_orig_sys_docref + 1);
end if;
SELECT hca.cust_account_id from v_sold_to_org
OF hz_cust_accounts AOB.
HP hz_parties
WHERE hca.party_id = hp.party_id
AND hca.request_id is null
AND hp.party_name = v_customer;
If v_stat = 0 then
INSERT INTO OE_HEADERS_IFACE_ALL)
order_source_id,
orig_sys_document_ref,
org_id,
CREATION_DATE,
created_by,
last_update_date,
last_updated_by,
operation_code,
sold_to_org_id,
booked_flag)
VALUES)
v_source_id,
('TEST' | v_orig_sys_docref).
v_org_id,
v_creation_date,
v_created_by,
v_creation_date,
v_created_by,
"INSERT."
v_sold_to_org,
'Y') ;
commit;
end if;
INSERT INTO OE_LINES_IFACE_ALL)
order_source_id,
orig_sys_document_ref,
orig_sys_line_ref,
inventory_item,
org_id,
ordered_quantity,
unit_selling_price,
unit_list_price,
CREATION_DATE,
created_by,
last_update_date,
last_updated_by,
operation_code)
VALUES)
v_source_id,
('TEST' | v_orig_sys_docref).
v_orig_line_ref,
v_item_code,
v_org_id,
v_ordered_qty,
v_selling_price,
v_selling_price,
v_creation_date,
v_created_by,
v_creation_date,
v_created_by,
"INSERT");
commit;
v_customer_prev: = v_customer;
If v_customer_prev = v_customer then
v_stat: = 1;
on the other
v_stat: = 0;
end if;
-DBMS_OUTPUT. Put_line ('Col1: ' | v_source_id |', Col2: ' | v_creation_date |', Col3: ' | v_created_by |', Col4: ' | v_updated_date |', Col5: ' | v_updated_by);
EXCEPTION
WHEN NO_DATA_FOUND THEN
OUTPUT file_read_lines;
END;
END LOOP;
SELECT count (*) in the OE_HEADERS_IFACE_ALL v_count;
DBMS_OUTPUT. Put_line (' record Total inserted successfully: ' | v_count);
UTL_FILE. FCLOSE (FH);
END SPKO1;
/
But when I run the stored procedure using TOAD his work.
Help, please. This is my first time to attach the stored procedure in the concurrent program.
Thank you very much.
Kind regards
Diane
Published by: peopsquik08 on April 18, 2012 03:58as clive_t solier
>
You must explicitly reference the settings out
>Try
DECLARE VFILE VARCHAR2(32767); V_SOURCE_ID NUMBER; -- ERRBUF VARCHAR2(200); RETCODE NUMBER; BEGIN VFILE := 'myfile1.csv'; V_SOURCE_ID := 6; --APPS.OMORDERLOADER.SPKO1 ( VFILE, V_SOURCE_ID ); --COMMIT; APPS.OMORDERLOADER.SPKO1( ERRBUF => ERRBUF, RETCODE => RETCODE, VFILE => VFILE, V_SOURCE_ID => V_SOURCE_ID ); END;
but the code above to test your proc
to run concurrent SQL, you can use fnd_submit.submit_program
-
Compilation of a stored procedure that is frequently consulted
RDBMS version: 10.2.0.4.0 in a 2 RAC node
Our Production database is 24 x 7. Our development team has made a change in the code of the procedure frequently consulted.
At some point this stored proc is accessible by at least 5 sessions.
I was asked to compile this procedure with the new changes.
Since this is a frequently viewed, I think that the only option I have left to compile this proc is stopped by the DB and launch it using
and then compile it. But, this procedure is actually headed by a DBMS_JOB, so even if I stop, when I restart, the work will resume i.e. that execution of the stored procedure. Right?STARTUP RESTRICT
I can't knock local listeners because they are listening to an another DB in the cluster.
Is there another better way?ALTER system set job_queue_processes = 0 will stop the ease of use.
You might also consider to define windows service and stop the practical execution of cowboy.
------------
Sybrand Bakker
Senior Oracle DBA -
Forms - calls to rather than shares of standard database stored procedures
After seeing the reports, I now start with shapes in the APEX. :)
While I like the basic features offered by different Assistants, there is one thing that bothers me. After you create your form, you get basically 3 buttons (not counting cancel them) for different actions, each corresponding to an Action of database (SQL INSERT/UPDATE/DELETE). That's nice, but is not exactly what I want. I would replace the actions of database directly by the calls of stored procedures (in a package), one for each action. Would be nice, of course, to keep the benefits of the wizard, in particular in view of the fact that I would like to find a simple way to create standard forms. So, basically, I would create my forms in this way, but instead of linking the button action predefined database, do call a stored procedure. It's somehow possible and what would be the best way to achieve this?
I am running 4.0.1.00.03 on an Oracle XE database APEX.
ErwinUnfortunately it is only three as a limit.
Instead (to link a page), you can change your link (s) to the form via a URL using the following syntax:
f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly
Use substitution variables, as in that above syntax and ItemNames and ItemValues through comma lists of names and values in the respective order and in this way you can send more than three on the next page.
-
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
-
Hello
How can I force DAC to run always full load for one of the task that executes the stored procedure? And remaining tasks load incremental in the second and sub sequent executions.
Thank you
Jay.
Hi if your task is running an informatica mapping you can set your DAC task to run the full mapping for incremental and full loads, so tab task just point to the mapping.
Hope that helps.
Thank you
-
Need to query to find stored procedures that takes great execution time
Hi all
I use the oracle version below:
Oracle Database 11 g Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE Production 11.2.0.3.0
AMT for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
is it possible to find the name of stored procedure that take too long to run, I need those optimized all SPs.
Is there a query as top queries that are used to find queries albums that have great time for execution...
or y at - it another way to find the names of MS. I try with AWR report but showing only used the names of MS.
Thank you
No, it not there no such request as far as I know.
or y at - it another way to find the names of MS.
Just listen to complaints from the user...
-
execution of stored procedure in sql developer/sql more with a table setting?
Hello
I create a package with a procedure which has a cursor ref as output and a type as an input parameter. Here is my definition of the package
PACKAGE ------- CREATE OR REPLACE PACKAGE TEST As TYPE RefCursorType IS REF CURSOR; type intTableType is table of varchar2(50) index by binary_integer; PROCEDURE GETDATA ( P_RECORDS OUT RefCursorType, YEAR_LIST IN intTableType ); END; PACKAGE BODY ----------------------- SET DEFINE OFF CREATE OR REPLACE PACKAGE BODY TEST AS PROCEDURE GETDATA ( P_RECORDS OUT RefCursorType, YEAR_LIST IN intTableType ) AS iYearList IDTableType; BEGIN --GET ARRAY COUNT IYEARLIST := IDTABLETYPE(); IYEARLIST.EXTEND(YEAR_LIST.COUNT); --LOOP THROUGH LISTS AND POPULATE ARRAY FOR I IN YEAR_LIST.FIRST .. YEAR_LIST.LAST LOOP IYEARLIST(I) := IDTYPE(TO_CHAR(YEAR_LIST(I))); END LOOP; OPEN P_RECORDS FOR SELECT CITHTML AS FORMATTED FROM dbTest.FORMATTED_HTML WHERE YEAR IN (SELECT * FROM TABLE(IYEARLIST)) ; END GETDATA ; END TEST ; /
I want to perform this procedure from the sql or sql developer more to see if it works properly. The year field dbTest.FORMATTED_HTML is defined as varchar2 (20 bytes). He has many years as well as text.
I've used this in the past with simple stored procedures, but not those with a table setting
var r refcursor;
exec GETOLDDATA(:r,40);
print r;
How can I modify this to allow him to run my stored procedure?
Thank you
Just declare SQL, not type of PL/SQL:
CREATE OR REPLACE
TYPE Str50TblType
AS THE TABLE OF THE VARCHAR2 (50)
/
CREATE OR REPLACE
THE TEST PACKAGE
IS
GETDATA PROCEDURE)
P_RECORDS ON SYS_REFCURSOR,
YEAR_LIST IN Str50TblType
);
END;
/
CREATE OR REPLACE
TEST OF PACKAGE BODY
IS
GETDATA PROCEDURE)
P_RECORDS ON SYS_REFCURSOR,
YEAR_LIST IN Str50TblType
)
IS
BEGIN
OPEN P_RECORDS
FOR
SELECT CITHTML AS FORMATTED
OF dbTest.FORMATTED_HTML
WHERE YEAR IN)
SELECT *.
TABLE (YEAR_LIST)
);
GETDATA END;
END TEST;
/
SY.
-
Cursor to another stored procedure return package
Hello
I am new to Oracle, and I have the following problem:
I have a slider in a package that is defined like this:
create or replace
PACKAGE 'TestPACKAGE' AS
DOWNLOAD_CURSOR cursor's select A.* from A Table1, Table2 B
END TestPACKAGE;
In reality, there is more than one package with different cursors. I want to use this DOWNLOAD_CURSOR in a stored procedure, function, or another package, to return to the client in a ref cursor
Something like this:
create or replace
procedure aa_test (retCURSOR to sys_refcursor) is
Start
retCURSOR: = TestPACKAGE.DOWNLOAD_CURSOR;
end;
or replace this procedure with another method to return data and use in a .NET application.961449 wrote:
There are so any solution to access TestPACKAGE. DOWNLOAD_CURSOR to .NET web application. I found how to access a stored procedure that returns a ref cursor
And the package cannot be change, add a stored procedure that returns a ref cursorIn this case, it is not possible. Your .NET code cannot directly access the static cursor declaration, because at this point it's just a statement, not an open cursor.
Cursors declared that are opened using the PL/SQL code, using the OPEN cursor_name statement or variable IN the syntax of other cases.
.NET and other external applications require a ref Cursor, so the only way you can get this query in a Ref cursor is to open the ref cursor in the query itself.
Maybe you are looking for
-
Apple Watch to unlock some MacBook Pro Two Step
I have two factor turned on, connected to the same user on all devices but still get the "two-factor authentication is necessary to allow your Apple Watch unlock your Mac" when I click "Allow your Apple Watch unlock your Mac" in security and privacy
-
I have Thunderbird 38.3.0 on a Windows 7 PC. For some reason any today my calendar with all my appointments simply disappeared. When I went to the Add-ons Manager, lightning was missing in my extensions. I didn't remove it myself. I tried to reinstal
-
Hey I am using an Arduino Uno and I have 4 connected thermocouples. The code I have seems to work well, but every ~ 15 readings, at random intervals, the program returns 0 for two or three thermocouples. I added a delay to this program because it did
-
My Xbox Live region has been changed and I would like to know if Microsoft could change.
My Xbox Live region has been changed and I would like to know if Microsoft could change, because ive crossed * with xbox to change and I was wondering if microsoft could change my profile e-mail region and xbox? original title: Xbox Live
-
Acquisition of gain in current camera settings?
Hello I would like to know if it is possible to know the current camera Gain and shutter speed settings. I m using a camera to Firewire 1394 IMAQ for the Vision Application. All possible solutions to the above would be welcome. Thank you.