PlSql Procedure Parameter
Hi
i would like to know if using varchar parameter in sql queries with number column can result in performance degrade.
Ex: Procedure testa ( myparam varchar) is
begin
select col1 into var1 from table where colno = myparam;
end;
Here colno is a number column and myparam is varchar. I feel its better to change the parameter to number. But i would like to get some advise before considering to change such occurences across my backend codes.
In all versions of Oracle, including the version you are using and which you didn't bother to mention, implicit type conversion is always on the left hand side of the comparison.
Your statement will be transformed into
select col1
into var1
from table
where to_char(colno)= myparam;
If colno is indexed, the index will NOT be used, and Oracle will use a Full Table Scan.
The best, most robust solution is to use
myparam table.colno%type
Doing so, you can alter the column without having to change the procedure.
Sybrand Bakker
Senior Oracle DBA
Similar Messages
-
Calling PLSQL Procedure with CLOB input parameter from JDBC
Hi..
I've got a PLSQL procedure with a CLOB object as input parameter:
function saveProject (xmldoc CLOB) RETURN varchar IS
I want to call that procedure from my JDBC Application as...
String data = "..."
CallableStatement proc = conn.prepareCall
("begin ? := saveProject (?); end;");
neither
proc.setCharacterStream(2, new StringReader(data, data.length());
nor
proc.setString(2, data);
will work.
The Application throws java.sql.Exception: ... PLS-00306 wrong
number or types of arguments in call 'SAVEPROJECT'
How can I use set setClob method?
The Problem is: with Oracles CLOB implementation I can't create
an Instance, and from the CallableStatement a can't get a
Locator for a CLOB-Object.
This CLOB stuff makes me really nuts!
please somebody help me.. thanks
AlexHi All,
You can not make it like that.
You can not make clob as input parameter.
Do you want an easy way?
This is the easy way.
sample:
function myFunction(S varchar2(40))
return integer as
begin
insert into TableAAA values(S)
--TableAAA only contains 1 column of clob type
end;
This will work the problem with this is the parameter is in
varchar2 right? so there will be limited length for it.
You can do this to call that function:
nyFunction('My String that will be input into clob field');
There's another slight difficult way, I understand that you have
installed Oracle client/server in your system, try to look at
jdbc folder and try to find demo.zip in that folder, you can
find several ways of doing thing with jdbc.
Have a nice day,
Evan -
How to pass int array as an IN parameter to PLSQL Procedure
Hi,
How to pass int array in java to a stored procedure througn jdbc
and what type of data type I should declare to this IN parameter
in PLSQL Procedure.
Thanks,
SimiHi,
The best way to do what you want depends on what you want. Start by describing what you need to do. It's best to post some sample data (CREATE TABLE and INSERT statments) and what results you want from that sample data. (See the forum FAQ: https://forums.oracle.com/message/9362002)
If you have ideas about how to do the job (e.g., populating a temporary table) it can be helpful to include those, too, but distinguish clearly between WHAT you need to do and HOW you might do it.
As Bencol suggested, a SYS_REFCURSOR might be the best way to pass back the results.
Since you didn't post your table, or even describe what you wanted to do with it, I'll illustrate using scott.emp, which is probably on your system.
Say you wanted a procedure that took a DATE as an argument, and returned a some designated columns (empno, ename and hiredate in the example below) for all employees hired on or after the given DATE. You might write a procedure like this:
CREATE OR REPLACE PROCEDURE hired_since
( start_date IN DATE
, out_data OUT SYS_REFCURSOR
AS
BEGIN
OPEN out_data FOR
SELECT empno, ename, hiredate
FROM scott.emp
WHERE hiredate >= start_date;
END hired_since;
SHOW ERRORS
You can test it in SQL*Plus like this:
VARIABLE c REFCURSOR
EXEC hired_since (DATE '1982-01-01', :c);
PRINT :c
The output I got from this test was:
EMPNO ENAME HIREDATE
7788 SCOTT 19-APR-87
7876 ADAMS 23-MAY-87
7934 MILLER 23-JAN-82 -
Call from Java Plsql Procedure with VArray as Out Parameter
Hi,
I have a Java web application(Tomcat server) that call a plsql procedure with Varray as OUT parameter.
The Plsql code is perfectly compiled.
When i run the application, I get the following error msg in my Tomcat window:
java.sql.SQLException: ORA-06530: Reference to uninitialized composite
ORA-06512: at "SEMS1.PACK_SEMSADMIN_OFFEREDJOBS", line 102
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:573)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1891)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:109
3)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2709)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:589)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStat
{color:#0000ff}
Doubt: Do I need to declare ArrayDescriptors to retrieve the VArray from the Plsql procedure.
I think the below statement is enough; we need ArrayDescriptors only when we we wish to send a Plsql Object or Varray from Java code to the procedure. Plz correct me if not so.
dbCallableStatement.execute();
ARRAY SimpleOUTArray = (ARRAY) ((OracleCallableStatement) dbCallableStatement).
getObject(Integer.parseInt(arlParameterOutIndex.get(i).toString()));{color}
I am unable to realize where the mistake is?
{color:#800000}
{color}{color:#800000}
VARRAY AND PROC DETAILS:
TYPE STRUCT_JOB_DETAILS AS OBJECT
APPL_NO NUMBER (10),
S_FNAME VARCHAR2 (32 Byte),
S_MI VARCHAR2 (32 Byte),
S_LNAME VARCHAR2 (32 Byte),
APPL_DATE DATE,
DESCRIPTION VARCHAR2 (100 Byte),
S_UCID VARCHAR2 (8 Byte)
TYPE VARRAY_JOB_DETAILS IS VARRAY(100) OF STRUCT_JOB_DETAILS;{color}
{color:#800000}PROCEDURE:{color}
{color:#800000}CREATE OR REPLACE PACKAGE PACK_SEMSADMIN_OFFEREDJOBS
AS
TYPE Generic_Cursor_Type IS REF CURSOR;
--TYPE varray_job_detail is VARRAY(100) OF STRUCT_JOB_DETAILS;
--va_varray_job_detail varray_job_detail := varray_job_detail();
va_varray_job_detail VARRAY_JOB_DETAILS := VARRAY_JOB_DETAILS();
PROCEDURE Admin_Jobs_Offered_Rtr
ic_status IN VARCHAR2,
or_offered_jobs OUT Generic_Cursor_Type,
va_varray_job_detail OUT VARRAY_JOB_DETAILS
CREATE OR REPLACE PACKAGE BODY PACK_SEMSADMIN_OFFEREDJOBS
AS
PROCEDURE Admin_Jobs_Offered_Rtr
ic_status IN VARCHAR2,
or_offered_jobs OUT Generic_Cursor_Type,
va_varray_job_detail OUT VARRAY_JOB_DETAILS
AS
vc_query VARCHAR2(15000) := '';
vc_query_1 VARCHAR2(15000) := '';
counter NUMBER := 1;
vc_no NUMBER := 0;
or_applicants_list Generic_Cursor_Type;
TYPE type_appln_list IS RECORD
job_no NUMBER(10),
job_title VARCHAR2(50 BYTE),
account_no VARCHAR2(10 BYTE),
head_fname VARCHAR2(32 BYTE),
head_minitial VARCHAR2(10 BYTE),
head_lname VARCHAR2(32 BYTE),
num NUMBER
vn_appln_list type_appln_list;
TYPE type_job_offered IS RECORD
APPL_NO NUMBER (10),
S_FNAME VARCHAR2 (32),
S_MI VARCHAR2 (32),
S_LNAME VARCHAR2 (32),
APPL_DATE DATE,
DESCRIPTION VARCHAR2 (100),
S_UCID VARCHAR2 (8)
vn_job_offered type_job_offered;
BEGIN
vc_query := vc_query || ' SELECT jobs.job_no,job_title, account_no, head_fname, head_minitial, head_lname, num';
vc_query := vc_query || ' FROM jobs, ( ' ;
vc_query := vc_query || ' SELECT jobs.job_no,count(*) as num' ;
vc_query := vc_query || ' FROM student_apps ,jobs ' ;
vc_query := vc_query || ' WHERE jobs.job_no = student_apps.job_no' ;
vc_query := vc_query || ' AND (student_apps.status in (''o'',''t'')) '; --|| ic_status || ')' ;
vc_query := vc_query || ' AND jobs.status not in (''z'', ''Z'')' ;
vc_query := vc_query || ' GROUP BY jobs.job_no' ;
vc_query := vc_query || ' ) no_apps_off' ;
vc_query := vc_query || ' WHERE jobs.job_no = no_apps_off.job_no' ;
dbms_output.put_line('Executed Query_1');
va_varray_job_detail := VARRAY_JOB_DETAILS();
va_varray_job_detail.extend(100);
OPEN or_offered_jobs FOR vc_query;
LOOP
FETCH or_offered_jobs INTO vn_appln_list;
EXIT WHEN or_offered_jobs%NOTFOUND;
vc_query_1 := '';
vc_query_1 := vc_query_1 || ' SELECT stud_apps.appl_no APPL_NO, stud_apps.s_fname S_FNAME, ';
vc_query_1 := vc_query_1 || ' stud_apps.s_mi S_MI, stud_apps.s_lname S_LNAME, ';
vc_query_1 := vc_query_1 || ' stud_apps.appl_date APPL_DATE, look_up.description DESCRIPTION, ' ;
vc_query_1 := vc_query_1 || ' stud_apps.s_ucid S_UCID ' ;
vc_query_1 := vc_query_1 || ' FROM student_apps stud_apps,jobs jbs,lookup look_up' ;
vc_query_1 := vc_query_1 || ' WHERE stud_apps.status in (''o'',''t'') '; --(' || ic_status || ') ' ;
vc_query_1 := vc_query_1 || ' AND jbs.job_no = stud_apps.job_no' ;
vc_query_1 := vc_query_1 || ' AND jbs.status not in (''z '', ''Z'')' ;
vc_query_1 := vc_query_1 || ' AND stud_apps.status = look_up.code ' ;
vc_query_1 := vc_query_1 || ' AND look_up.type = ''st''' ;
vc_query_1 := vc_query_1 || ' AND stud_apps.job_no = ''' || vn_appln_list.job_no || ''' ' ;
vc_query_1 := vc_query_1 || ' ORDER BY appl_date' ;
dbms_output.put_line('Executed Query_2');
OPEN or_applicants_list FOR vc_query_1;
LOOP
FETCH or_applicants_list INTO vn_job_offered;
EXIT WHEN or_applicants_list%NOTFOUND;
va_varray_job_detail(counter).APPL_NO := vn_job_offered.APPL_NO;
va_varray_job_detail(counter).S_FNAME := vn_job_offered.S_FNAME;
va_varray_job_detail(counter).S_MI := vn_job_offered.S_MI;
va_varray_job_detail(counter).S_LNAME := vn_job_offered.S_LNAME;
va_varray_job_detail(counter).APPL_DATE := vn_job_offered.APPL_DATE;
va_varray_job_detail(counter).DESCRIPTION := vn_job_offered.DESCRIPTION;
va_varray_job_detail(counter).S_UCID := vn_job_offered.S_UCID;
counter := counter + 1;
END LOOP; --end of FOR
CLOSE or_applicants_list;
END LOOP; -- end of FETCH
END Admin_Jobs_Offered_Rtr;
END PACK_SEMSADMIN_OFFEREDJOBS;
/{color}
Reqire help plzzzz !!!
Thanks.Originally posted by JDBC Development Team:
It's very similar to other datatype except that it uses OracleTypes.ARRAY typecode and the value is mapped to a oracle.sql.ARRAY instance. The code looks as follows --
cstmt.registerOutParameter (idx, OracleTypes.ARRAY, "VARRAY_TYPE_NAME_HERE");
cstmt.execute ();
ARRAY array = (ARRAY) cstmt.getObject (idx);
Thanks for your reply.
I have to use:-
OracleCallableStatement cs1 = (OracleCallableStatement )conn.prepareCall
( "{call proj_array(?)}" ) ;
for retrieving a collection as an OUT parameter.
This gives me the errors:-
C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
import java.sql.*;
^
C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Array getArray(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
import java.sql.*;
^
C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Clob getClob(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
import java.sql.*;
^
C:\jdbc\VarraySQL.java:0: The method oracle.jdbc2.Ref getRef(int) declared in class oracle.jdbc.driver.OracleCallableStatement cannot override the method of the same signature declared in interface java.sql.CallableStatement. They must have the same return type.
import java.sql.*;
^
How do I get rid of these errors?
null -
Using PLSQL procedure with parameter in AQ
hi,
we need to run a PLSQL procedure(asynchronously) with in parameters using oracle AQ.
can someone give me simple example/hint?
Many thanksSince you mention dbms_job, can you use dbms_scheduler since you can pass in parms? You can schedule the job to run "now" and while it may have a slight delay starting up due to available processes for the scheduler and system load, it will run as soon as it can.
What are you trying to accomplish in your environment? I'm not following why you want to allow a user to schedule any DB procedure. A certain set yes, all, no.
You could create a generic AQ structure where it is passed some information regarding what procedure needs to run and what/where the parms are. This driver procedure would then be responsible for calling a random procedure via dynamic SQL. I've never tried passing parms to a procedure via dynamic SQL but recall reading you could do it. I wouldn't recommend this approach unless you have no better options though. -
How Can i get PLSQL Procedure out values in Shell Script?
Hi,
I need to use PLSQL Procedure out values in shell script by using that parameter i need to check and call the other procedure. Please can you guide me how can i?
#!/bin/ksh
# Function to call validation program
SQL_PKG_CALL()
echo "Inside SQL_PKG_CALL for $file"
sqlplus -s /nolog << EOF
whenever sqlerror exit failure
connect ${APPS_LOGIN}
variable exit_value NUMBER
set serveroutput on size 100000
DECLARE
l_errbuf VARCHAR2(10000) := NULL; l_retcode NUMBER := NULL;lv_test VARCHAR2(4000) := NULL;
BEGIN
fnd_global.apps_initialize ( USER_ID => ${USER_ID}, RESP_ID => ${RESP_ID}, RESP_APPL_ID => ${RESP_APPL_ID}
, SECURITY_GROUP_ID => ${SECURITY_GROUP_ID}
#Calling PLSQL procedure for create and attache document
XXAFPEEP_SO_DOC_ATTACH_INT.DOCUMENT_ATTACH (p_errbuf => l_errbuf, p_retcode => :RETMSG, p_fileName => $file
, p_debug => 'Y', p_rettest => lv_test);
# to print the procedure return values
DBMS_OUT.PUT_LINE('Return Message: '|| lv_test);
#${RETCODE}=l_retcode;
print :RETMSG;
END;
EXIT 0
EOF
# Program starts here
echo "+---------------------------------------------------------------------------+"
echo "Program Start"
APPS_LOGIN=${1} # Apps Login
USER_ID=${2} # User ID
RESP_ID=${5} # Responsiblity ID
RESP_APPL_ID=${6} # Responsiblity Application ID
SECURITY_GROUP_ID=${7} # Security Group ID
DIRECTORY_PATH=${8} # Directory --Attached file locations
DIRECTORY_NAME=${9} # Directory Name for plsql
echo "User ID : $USER_ID"
echo "Responsibility ID : $RESP_ID"
echo "Responsibilith Application ID : $RESP_APPL_ID"
echo "Security Goup ID : $SECURITY_GROUP_ID"
echo "Directory Path : $DIRECTORY_PATH"
echo "Direcotry Name : $DIRECTORY_NAME"
echo
#files direcotry
cd $DIRECTORY_PATH
echo Present Working Directory: `pwd`
echo
#for all file names
ALL_FILES=`ls *.pdf`
for file in $ALL_FILES
do
if [ -f $file ]
then
#log "Processing $file" # future
echo Processing: $file
# Calling the PL/SQL Program
SQL_PKG_CALL;
#echo "Retcode : $RETCODE"
echo "RetMessage : $RETMSG"
else
log "Skipped $file: invalid file"
echo "Skipping current file $file: not a valid file."
fi
done
Thanks
SudheerSaubhik's provided the solution, but just for fun:
Test procedure:
create or replace procedure get_ename
( p_empno in emp.empno%type
, p_ename_out out emp.ename%type )
is
begin
select ename into p_ename_out
from emp
where empno = p_empno;
end get_ename;Test data:
SQL> select empno, ename from emp order by 1;
EMPNO ENAME
7369 SMITH
7499 ALLEN
7521 WARD
7566 JONES
7654 MARTIN
7698 BLAKE
7782 CLARK
7788 SCOTT
7839 KING
7844 TURNER
7876 ADAMS
7900 JAMES
7902 FORD
7934 MILLER
14 rows selectedTest call from SQL*Plus to show it working:
SQL> declare
2 v_ename emp.ename%type;
3 begin
4 get_ename(7844,v_ename);
5 dbms_output.put_line(v_ename);
6 end;
7 /
TURNER
PL/SQL procedure successfully completed.Demo shellscript (borrowing the function idea from Saubhik):
#!/bin/ksh
empno=${1:-NULL}
exec_sql() {
sqlplus -s william/w@//vm.starbase.local:1521/eleven <<END_SQL
spool get_out_value.sh.log
set serverout on size 2000 feedback off
declare
v_name emp.ename%type;
begin
get_ename(${empno},v_name);
dbms_output.put_line('# ' || v_name);
end;
spool off
exit
END_SQL
ename=$(exec_sql ${empno} | awk '/^# / {print $2}')
print Employee ${empno} = ${ename}Demo:
/Users/williamr: get_out_value.sh 7844
Employee 7844 = TURNER
/Users/williamr: get_out_value.sh
Employee NULL =Note this substitutes the word NULL if no empno is passed, and it ignores error output or anything else by only looking for lines beginning '# ' and then taking the following word. Error messages will appear in the logfile. (In this example it probably doesn't need the NULL substitution because a missing parameter would cause a syntax error which the script will handle anyway, but it could be useful in more complex examples.)
For a production script you should probably use an OS authenticated account so you don't have to deal with password strings. -
Problem with database adapter on plsql procedure with in/out parameters
running BPEL 10.1.3.1 and using the database adapter on a plsql procedure with in/out parameters I get errors
the plsql procedure:
create or replace procedure proc_with_clob_inout_parameter(
p_string in varchar2,
p_clob in out clob)
is
begin
p_clob := p_string;
end proc_with_clob_inout_parameter;
In BPEL I call this procedure. When I only assign a value to the p_string parameters (in a BPEL assign) all is well. When I also assign a value to the p_clob parameter the error occurs:
<part name="summary">
<summary>
file:/ora1/app/oracle/as101.3/bpel/domains/digitaaldossier/tmp/.bpel_janb_inout_1.0_f6908ccf864581b7265c362444e88075.tmp/twee.wsdl
[ twee_ptt::twee(InputParameters,OutputParameters) ] - WSIF JCA Execute of
operation 'twee' failed due to: Error while trying to prepare and execute
an API.
An error occurred while preparing and executing the
JANB.PROC_WITH_CLOB_PARAMETER2 API. Cause: java.sql.SQLException: Parameter
Type Conflict [Caused by: Parameter Type Conflict]
; nested exception is:
ORABPEL-11811
Error while trying to prepare and execute an API.
An error occurred while preparing and executing the
JANB.PROC_WITH_CLOB_INOUT_PARAMETER API. Cause: java.sql.SQLException: Parameter
Type Conflict [Caused by: Parameter Type Conflict]
Check to ensure that the API is defined in the database and that the
parameters match the signature of the API. Contact oracle support if error
is not fixable.
</summary>
</part>
In BPEL 10.1.2.0 this isn't a problem. I tested it against a 10.2.0.1 and a 10.2.0.2 database and in both situations I get the error with BPEL 10.1.3.1 and no error with BPEL 10.1.2.0
it appears to be a problem in the database adapter...
anyone with the same problems and/or a solution?Not of any use to you, but we had exactly the same problem on Friday when we applied AS 10.1.2.2 Patchset on top of BPEL 10.1.2.0.2.
The clob in our pl/sql proc wan't declared as in/out but for some reasons JDeveloper had created a clob on the Output Parameter type in the db partner link xsd. I removed this and it worked. This code had been untouched , and working fine, for months.
I'll be raising an SR today.
Rob J -
Help with truncating a table using plsql procedure in different schema
I have a plsql procedure in schema A that truncates a table that is given in as parameter.
create or replace procedure truncate_table(schema, table_name)
EXECUTE IMMEDIATE 'TRUNCATE TABLE '||schema||'.'||table_name;
end;
The above procedure has public execute grant.
I need to truncate a table in schema B. I have a plsql procedure in schema B that calls the truncate_table procedure and passes in the schema B table name.
Since the table is in schema B, should the delete grant on the table be given to user A or user B to truncate the table in schema B?
Thanks in advance.Procedure created in schema A
create or replace
procedure truncate_table(l_schema varchar2, table_name varchar2) authid current_user
as
begin
EXECUTE IMMEDIATE 'TRUNCATE TABLE '||l_schema||'.'||table_name;
end;from schema B
grant delete on table1 to Schema_A
from schema A
exec truncate_table('Schema_B','Table1');
Hope this helps.
Alvinder -
Html forms in plsql procedure prob
Hi,
i have created a plsql procedure and have included a javascript part in order to link two drop down menus in a web site. but even though when you select a category at the first drop down menu it successfully updates the options at the second, the Action of the form doesnt work (the parameter doesnt pass to the procedure they should according to the Action command. If i don't use the first drop down menu though and add few options at the second, the Action works fine...can u please help me???
This is the code after the java script part...
htp.print('<FORM NAME="select_mem" ACTION="'||f_host||'search" METHOD="post">');
htp.print('<SELECT name="Category" onChange="updateList(this.form, this.options[selectedIndex].value, this.form.Subject.length)" >');
for sel_t in ctype loop
htp.print('<option value="'||replace(sel_t.mem_type,' ','_')'">'||sel_t.mem_type||'</option>');
end loop;
htp.print('</SELECT>');
htp.print('<br>');
htp.print('<select name="Subject" id="Subject" >');
htp.print('<option value="None" SELECTED>- Please Choose a Category Above - </option>');
htp.print('</select>');
htp.print('<INPUT TYPE="submit" value="submit">');
htp.print('</FORM>');sorry, dimi, but this forum is limited to questions about the product Oracle HTML DB. if you're not sure what OTN discussion forum is best suited for your question, i think they'd have you ask for the correct one at...
Community Feedback (No Product Questions)
regards,
raj
ps-my answer to the second question at the top of Pop List and Developer Toolbar shows an easy way in htmldb to implement the type of thing you're after. -
Creating a PLSQL Procedure as Concurrent Program
Folks:
I am new both to PLSQL and Concurrent program creation. I am actually working on a process for deploying changes from one environment to another, so I want to create a simpel PLSQL procedure that I can then register as a concurrent program, and finally test the download/uplaod of this procedure and program from one instance to another.
I tried reading the Developer documentation on creating concurrent program, but couldn't find the information I was looking for. Here are some of my questions:
1) The PLSQL procedure that I want to run as concurrent program, can it be declared within a new custom package, or does it have to be created as a procedure.
2) In the concurrent program executable registration window, can i specify directly the name of this new procedure or do I need to create an additional wrapper PLSQL procedure that has Concurrent Program related attribute (Developer guide seemed to incline that way).
3) What should be put in the 'File' parameter on Concurrent Program Execution Window in the case of pl/sql concurrent program. There is no file, so what to put in there?
4) Any other place I can find step by step how to for making a 'PLSQL" package a concurrent program?Hi,
1) Create PL/SQL Package with "main" procedure that has arguments ERRBUF and RETCODE plus your other required arguments.
2) xxxx_pkg.main as per 1.
3) xxxx_pkg.main (the package and procedure name)
4) Best place to look is at an existing program! Plenty of basic examples on the net. Here's a link that has basic package and screens:
http://garethroberts.blogspot.com/2007/10/excel-file-output-from-oracle.html
Regards,
Gareth
Blog: http://garethroberts.blogspot.com/ -
Hi,
I have a PLSQL procedure defined in a schema which I like to run first so that it would poupulate a row in a table. I defined a pre-mapping process but it does not work. Any information would be appreciated!There is no complication to run procedure in premapping .
You can test few thing.
1. Are you able to run it from database directly.
3.If yes then run it with same parameter as provided (if there are) in mapping.
4.Check the procedure in which schema it is defined.
Cheers
Nawneet -
Passing multidimensional array to plsql procedure
hi ,
is there any way to pass a two dimensional array of different data types to plsql procedure as a parameter?
In other words, is it possible to pass a set or records or a datatable as a single parameter to plsql procedure?
Because I am using a dataset selected with odp.net in my client and I am modifying the data in different datatables contained in the dataset.At the moment, the modified datatables are saved by seperating each column as a sepearate array and passing each column array as a seperate parameter to a stored procedure. But, I would like to change it in a way to pass each datatable as a single parameter to the stored procedure.
I would appreciate any solution/suggestion/hint in regard to this problem
thanks in advance,
Prabhakar.If your Java array is of a base type (String, int, etc.) and you are using the OCI driver, you can use OracleCallableStatement.setPlSqlTable(). (I'm doing this from memory so the method name may be slightly different.)
The method takes a Java array and converts it to a PL/SQL table before passing it to the stored procedure. -
The simplest way for plsql procedure to return multiple rows
Hi,
What is the simplest way for plsql procedure to return multiple rows (records). There are many combination of ways to do it but I am looking for a solution that is appropriate for plsql beginners. Many solutions use cursors, cursor variables, collections and more that kind of things that are complex on the face of it. Is it somehow possible to achieve the same with less effort?
Sample query would be: SELECT * FROM EMPLOYEES;
I want to use returned rows in APEX to compose APEX SQL(in that context plsql) report.
It is enough to use just SELECT * FROM EMPLOYEES query in APEX but I want to use plsql procedure for that.
Thank you!Hi,
It depends :-).
With +...that is appropriate for plsql beginners...+ in mind... it still depends!
The list of techniques (ref cursors, cursor variables, collections, arrays, using explict SQL) you have referenced in your post can be made to work. but...
+Is it somehow possible to achieve the same with less effort?+ Less effort : That needs to be defined (measured). Especially in the context of pl/sql beginners (who is a beginner?) .
What is the level of "programming experience" ?
What is the level of understanding of "Relational Result set" as processible in Oracle?
If you are looking for
Process_the_set_of rows_in APEX () kind of capabilitywhich "abstracts/hides" relation database from developers when working on relation database, it may not be the best approach (at least strategically). Because I believe it already is abstracted enough.
I find REF CUROSOR most effective for such use, when the "begginer" has basic understanding of processing SQL result set .
So in a nut shell, the techniques (that you already are familiar with) are the tools available. I am not aware of any alternative tools (in pure Oracle) that will simplify / hide basics from develpers.
vr,
Sudhakar B. -
Business Event not triggering the PLSQL procedure.. What to do?
We need to call a plsql procedure when the GL Approval workflow has ended with approval. I thought i could do this by customizing the relevant business event.
We are on EBS 12.1.3 with RDBMS : 11.2.0.3.0.
I saw that the business event oracle.apps.gl.Journals.journal.approve was disabled currently. I enabled it and created a subscription for it. Subscription was a PLSQL procedure. Currently, for test purpose only thing it is doing is to insert a row into a table.
Business Event Subscription settings:
System: ORDEBS.SYSTEM.COM
Triggering Event
Source Type:Local
Event Filter: oracle.apps.gl.Journals.journal.approve
Execution Condition
Phase: 100
Status: Enabled
Rule Data: Message
Action Type:Custom
On Error: Stop and Rollback
Action
PL/SQL Rule Function: XX_GL_APPROVE_BE_PKG.Get_Attributes
Priority: Normal
Documentation (Not sure what value to be given for these. I went with the below values.)
Owner: Company Name
Owner Tag: Custom Schema
Using the below query i can see that the business event is getting called when the approval happens (One row added each time approval happened). But I cant see any rows in the table where it should insert a row. What could be going wrong? How can i verify that the procedure has been called?
select * from WF_DEFERRED where corrid ='APPS:oracle.apps.gl.Journals.journal.approve'
Procedure:
CREATE OR REPLACE PACKAGE BODY APPS.XX_GL_APPROVE_BE_PKG
AS
PROCEDURE Get_Attributes
IS
BEGIN
INSERT INTO xx.xx_test_table VALUES ('From BE');
COMMIT;
END Get_Attributes;
END XX_GL_APPROVE_BE_PKG;Thanks Alejandro. Now this is working.
Changes i made:
1. Added the WFERROR workflow as a subscription to this event. So i could see that the function i am calling from the event did not have proper signature.
2. Changed the function signature to have standard parameters like:
CREATE OR REPLACE PACKAGE BODY XX_GL_APPROVE_BE_PKG
AS
function subscription(p_subscription_guid in raw,
p_event in out nocopy wf_event_t) return varchar2 is
l_result varchar2(20);
begin
insert into xxvtv.xxvtv_test_table values ('From BE');
commit;
exception
when others then
wf_core.context('XX_GL_APPROVE_BE_PKG','function subscription', p_event.getEventName(), p_event.getEventKey());
wf_event.setErrorInfo(p_event, 'ERROR');
return 'ERROR';
end subscription;
END XX_GL_APPROVE_BE_PKG;
3. Changed the owner name and owner tag both to the custom schema name (XX) -
Passing values to between Pages from a PLSQL Procedure in third Page
Hello,
I have a form divided into 3 pages. The first Page is used to select Template which is used to call a screen Page 54 and Page 55 (Wizard Based screen).
From Page 55 (third page) of my application, When I click on Finish Button (Submit Button), a PLSQL Procedure is called which inserts values in 5 to 6 tables on a schema. The Success message include Article &DOCID. successfully Added.
When I return to the first Page which is Page 24, it displays no value for DOCID.
Sample Example =
DECLARE
DOCID VARCHAR2(30);
BEGIN
INSERT INTO SURE_DOCUMENT
DOCUMENT_ID
, DOCUMENT_TYPE
, TITLE
, STATUS
, DISTRIBUTION
, ARCHIVE_REVIEW_DATE
, CONTENT_TYPE
, IMPACT
, SKILL_LEVEL
, SOURCE
, SERVER_MIN_VERSION
, SERVER_MAX_VERSION
, REFRESH_INTERVAL
, LAST_REFRESH
, FOLDER_ID
, TOPIC_ID
, NOTE_POSITION
, OWNING_SITE
, MODIFY_NUMBER
, VERSION_STRING
, ALIAS
, EXTKEY
, FORMAT_MODIFIER
, DELETED
, CREATED_BY
, CREATED_DATE
, CREATED_SITE
, UPDATED_BY
, UPDATED_DATE
, UPDATED_SITE
VALUES
( SURE_DOCUMENT_SEQ.NEXTVAL || '.1'
, :ARTICLE_TYPE
, :TITLE
, :STATUS
, :DISTRIBUTION
, SYSDATE
, 'TEXT/PLAIN'
, 'LOW'
, 'NOVICE'
, 'ADHOC'
, :RDBMS_MIN_VERSION
, :RDBMS_MAX_VERSION
, NULL
, NULL
, :FOLDER
, :TOPIC
, NULL
, 1
, 1
, NULL
, NULL
, NULL
, NULL
, 'N'
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
COMMIT;
SELECT SURE_DOCUMENT_SEQ.CURRVAL INTO DOCID FROM DUAL;
INSERT INTO SURE_DOCUMENT_CONTRIBUTORS
DOCUMENT_ID
, SURE_SEQUENCE
, USER_ID
, CONTRIBUTION_DATE
, CONTRIBUTION_ROLE
, MODIFY_NUMBER
, REASON
, DELETED
, CREATED_BY
, CREATED_DATE
, CREATED_SITE
, UPDATED_BY
, UPDATED_DATE
, UPDATED_SITE
VALUES
( DOCID
, 1
, 'SKOPPALK.UK'
, SYSDATE
, 'Contributing Author'
, 1
, 'Contributing Author'
, 'N'
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
INSERT INTO SURE_DOCUMENT_LANGUAGES
DOCUMENT_ID
, SURE_SEQUENCE
, LANGUAGE
, DELETED
, CREATED_BY
, CREATED_DATE
, CREATED_SITE
, UPDATED_BY
, UPDATED_DATE
, UPDATED_SITE
VALUES
( DOCID
, 1
, 'USAENG'
, 'N'
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
INSERT INTO KREW_WORKFLOW
DOCUMENT_ID
, PRIORITY
, OWNER
, REVIEWER
, MODERATOR
, ASSIGNED_DATE
, DUE_DATE
, CHECKED_OUT_BY
, CHECKED_OUT_DATE
, VERSION_STRING
, DESCRIPTION
, AUTHORS
, COMMENTS
, UPD_DATE
, COPYSTATUS
, COPYDISTRIBUTION
, COPYFOLDERID
VALUES
DOCID
, 3
, DECODE(:OWNERS, NULL, 'UNASSIGNED',:OWNERS)
, DECODE(:REVIEWER, NULL, 'UNASSIGNED',:REVIEWER)
, DECODE(:MODERATOR, NULL, 'UNASSIGNED',:MODERATOR)
, SYSDATE
, SYSDATE + 7
, NULL
, NULL
, 'SKOPPALK.UK'
, :TITLE
, :AUTHORS
, :COMMENTS
, SYSDATE
, :STATUS
, :DISTRIBUTION
, :FOLDER
INSERT INTO SURE_DOCUMENT_KEYWORDS
DOCUMENT_ID
, SURE_SEQUENCE
, KEYWORD_TYPE
, KEYWORD
, DELETED
, CREATED_BY
, CREATED_DATE
, CREATED_SITE
, UPDATED_BY
, UPDATED_DATE
, UPDATED_SITE
VALUES
( DOCID
, 1
, 'NOTE'
, :KEYWORDS
, 'N'
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
INSERT INTO SURE_DOCUMENT_REFERENCES
DOCUMENT_ID
, SURE_SEQUENCE
, REFERENCE_SOURCE
, REFERENCE_DOCUMENT_ID
, REFERENCE_TYPE
, REFERENCE_DESCRIPTION
, DELETED
, CREATED_BY
, CREATED_DATE
, CREATED_SITE
, UPDATED_BY
, UPDATED_DATE
, UPDATED_SITE
VALUES
( DOCID
, 1
, 'NOTE'
, DOCID || '.1'
, 'NOTE'
, :REFERENCES
, 'N'
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
INSERT INTO SURE_DOCUMENT_PLATFORMS
DOCUMENT_ID
, SURE_SEQUENCE
, PLATFORM_ID
, MIN_VERSION
, MAX_VERSION
, DELETED
, CREATED_BY
, CREATED_DATE
, CREATED_SITE
, UPDATED_BY
, UPDATED_DATE
, UPDATED_SITE
VALUES
( DOCID
, 1
, :PLATFORMS
, NULL
, NULL
, 'N'
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
INSERT INTO SURE_DOCUMENT_PRODUCTS
DOCUMENT_ID
, SURE_SEQUENCE
, PRODUCT_ID
, COMPONENT_ID
, MIN_VERSION
, MAX_VERSION
, DELETED
, CREATED_BY
, CREATED_DATE
, CREATED_SITE
, UPDATED_BY
, UPDATED_DATE
, UPDATED_SITE
VALUES
( DOCID
, 1
, :PRODUCTS
, NULL
, NULL
, NULL
, 'N'
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
, HTMLDB_CUSTOM_AUTH.GET_USER
, SYSDATE
, 1
COMMIT;
END;
The Success message is as follows:
Article &DOCID. Created/Updated SuccessfullyShivanand,
There's no need to post that much code when you could create a very short test case that demonstrates only the problem you are having.
You're using &NAME. notation on something that isn't a page or application item. You can't reference PL/SQL variables that way (or any other way) outside the PL/SQL scope. For your situation, you could create a page item named P55_DOCID and assign it a value in the PL/SQL process (:P55_DOCID := DOCID;), then reference &P55_DOCID. in HTML areas like the success message.
Scott
Maybe you are looking for
-
good day. It's renewal time and I'm going to downgrade my .Mac account from a Family acct. to a single. The 2nd mac (and only additional mac) uses .Mac only for Blog and Photo iWeb uploads... So can I... Simply update the .Mac login p/w info on the 2
-
Error code: 400, error text: ICM_HTTP_CONNECTION_FAILED
Every now and then we are getting the following error on a synchronous call from XI 3.0. Error when receiving by HTTP (error code: 400, error text: ICM_HTTP_CONNECTION_FAILED) Usually it is from XI to R/3 (that's where most of our synch calls take pl
-
Hi All, I would like to create new query from which i wanted to know the GRIN made against Vendor material no. WHich table shall i use in this case
-
Hi All, Is is possible to display the matrix output in forms, if is possible please guide me how? Regards, YKING
-
How to get UCCX sessionID in vxml
Hi, Is there a way to get the sessionID of the UCCX call in VXML. I want to use it from Nuance VXML. It think it should be something like: sesssion.connection.sessionid , but I don't find the right format. Thank you, Daniel