Executing the stored procedure with output which is a collection of objects
Hello,
I have the objects and collection of objects within an objects as below:
CREATE OR REPLACE TYPE SHARE_OUTST_T
AS OBJECT
SHR_OUTST_AMT number
CREATE OR REPLACE TYPE SECURITY_T
AS OBJECT
VOTE_PER_SHR number
, CUSIP varchar2(12)
, EXCHANGE varchar2(10)
, IV_TYPE_CD varchar2(10)
, SEC_TICKER_SYMB varchar2(20)
CREATE OR REPLACE TYPE ALTERNATE_ID_T
AS OBJECT
( ALT_ID_TYPE varchar2(20)
CREATE OR REPLACE TYPE ISSUE_MAINT_VERSION_T
AS OBJECT
IM_KEY_ID number
, IM_VER_NUM number
, EFF_TMSTMP timestamp
, EXP_TMSTMP timestamp
, NEXT_REVIEW_TMSTMP timestamp
, APPR_STATUS_REF_ID number
, VOTE number
, ADD_USR_ID varchar2(20)
, ADD_TMSTMP timestamp
, UPD_USR_ID varchar2(20)
, UPD_TMSTMP timestamp
, LOCK_LEVEL_NUM number
, ACTION VARCHAR2(1)
CREATE OR REPLACE TYPE ISSUE_SHARE_MAINT_T
AS OBJECT
IM_KEY_ID number
, IM_VER_NUM number
, SHR_OUTST_AMT number
, CURR_OUTST_AMT number
, ADD_USR_ID varchar2(20)
, ADD_TMSTMP timestamp
, UPD_USR_ID varchar2(20)
, UPD_TMSTMP timestamp
, LOCK_LEVEL_NUM number
, ACTION VARCHAR2(1)
CREATE OR REPLACE TYPE ISSUE_MAINT_COMMENT_T
AS OBJECT
IM_KEY_ID number
, IM_VER_NUM number
, COMMENT_TXT varchar2(400)
, ADD_USR_ID varchar2(20)
, ADD_TMSTMP timestamp
, UPD_USR_ID varchar2(20)
, UPD_TMSTMP timestamp
, LOCK_LEVEL_NUM number
, ACTION VARCHAR2(1)
CREATE OR REPLACE TYPE ISSUE_MAINT_COMMENT_COL_T AS TABLE OF ISSUE_MAINT_COMMENT_T;
CREATE OR REPLACE TYPE ISSUE_VERSION_T
AS OBJECT
SHARE_OUTST SHARE_OUTST_T
, SECURITY SECURITY_T
, ALTERNATE_ID ALTERNATE_ID_T
, ISSUER ISSUER_T
, ISSUE_MAINT_VERSION ISSUE_MAINT_VERSION_T
, ISSUE_SHARE_MAINT ISSUE_SHARE_MAINT_T
, ISSUE_MAINT_COMMENT_COL ISSUE_MAINT_COMMENT_T
CREATE OR REPLACE TYPE ISSUE_VERSION_COL_T AS TABLE OF ISSUE_VERSION_T;
And the stored procedure as :
=======================================
PROCEDURE get_all_issue_version_col
( pv_issue_version_col OUT issue_version_col_t
AS
CURSOR cur_issue_version
IS
SELECT
issue_version_t (
SHARE_OUTST_T (so.shr_outst_amt )
, SECURITY_T ( s.vote_per_shr
, s.sec_cusip
, s.PRI_MKT_EXCH_CD
, s.IV_TYPE_CD
, s.SEC_TICKER_SYMB )
, ALTERNATE_ID_T (a.ALT_ID_TYPE)
, ISSUER_T (i.ISSR_ID )
, ISSUE_MAINT_VERSION_T (imv.im_key_id
, imv.im_ver_num
, imv.eff_tmstmp
, imv.exp_tmstmp
, imv.next_review_tmstmp
, imv.appr_status_ref_id
, imv.vote
, imv.add_usr_id
, imv.add_tmstmp
, imv.upd_usr_id
, imv.upd_tmstmp
, imv.lock_level_num
, NULL )
, ISSUE_SHARE_MAINT_T (ism.im_key_id
, ism.im_ver_num
, ism.shr_outst_amt
, ism.curr_outst_amt
, ism.add_usr_id
, ism.add_tmstmp
, ism.upd_usr_id
, ism.upd_tmstmp
, ism.lock_level_num
, NULL)
, ISSUE_MAINT_COMMENT_T(imc.im_key_id
, imc.im_ver_num
, imc.comment_txt
, imc.add_usr_id
, imc.add_tmstmp
, imc.upd_usr_id
, imc.upd_tmstmp
, imc.lock_level_num
, NULL )
FROM
share_outst so
, security s
, alternate_id a
, issuer i
, issue_maintenance_version imv
, issue_share_maintenance ism
, issue_maintenance_comment imc
WHERE
s.sec_key_id = so.SEC_KEY_ID
and s.SEC_KEY_ID = a.SEC_KEY_ID
and s.MSTR_ISSR_KEY_ID = i.ISSR_KEY_ID
and s.SEC_CUSIP = imv.SEC_CUSIP (+)
and s.SEC_CUSIP = ism.SEC_CUSIP (+)
and imv.IM_KEY_ID = imc.IM_KEY_ID (+);
BEGIN
OPEN cur_issue_version ;
FETCH cur_issue_version BULK COLLECT INTO pv_issue_version_col ;
CLOSE cur_issue_version ;
END ;
PROCEDURE get_all_issue_col_v1
( pv_issue_version_col OUT NOCOPY issue_version_col_t
, pv_row_count IN number
, pv_issuer_id IN VARCHAR2
AS
CURSOR cur_issue_version
IS
SELECT
issue_version_t (
SHARE_OUTST_T (so.shr_outst_amt )
, SECURITY_T ( s.vote_per_shr
, s.sec_cusip
, s.PRI_MKT_EXCH_CD
, s.IV_TYPE_CD
, s.SEC_TICKER_SYMB )
, ALTERNATE_ID_T (a.ALT_ID_TYPE)
, ISSUER_T (i.ISSR_ID )
, ISSUE_MAINT_VERSION_T (imv.im_key_id
, imv.im_ver_num
, imv.eff_tmstmp
, imv.exp_tmstmp
, imv.next_review_tmstmp
, imv.appr_status_ref_id
, imv.vote
, imv.add_usr_id
, imv.add_tmstmp
, imv.upd_usr_id
, imv.upd_tmstmp
, imv.lock_level_num
, NULL )
, ISSUE_SHARE_MAINT_T (ism.im_key_id
, ism.im_ver_num
, ism.shr_outst_amt
, ism.curr_outst_amt
, ism.add_usr_id
, ism.add_tmstmp
, ism.upd_usr_id
, ism.upd_tmstmp
, ism.lock_level_num
, NULL)
, ISSUE_MAINT_COMMENT_T(imc.im_key_id
, imc.im_ver_num
, imc.comment_txt
, imc.add_usr_id
, imc.add_tmstmp
, imc.upd_usr_id
, imc.upd_tmstmp
, imc.lock_level_num
, NULL )
FROM
share_outst so
, security s
, alternate_id a
, issuer i
, issue_maintenance_version imv
, issue_share_maintenance ism
, issue_maintenance_comment imc
WHERE
s.sec_key_id = so.SEC_KEY_ID
and s.SEC_KEY_ID = a.SEC_KEY_ID
and s.MSTR_ISSR_KEY_ID = i.ISSR_KEY_ID
and s.SEC_CUSIP = imv.SEC_CUSIP (+)
and s.SEC_CUSIP = ism.SEC_CUSIP (+)
and imv.IM_KEY_ID = imc.IM_KEY_ID (+);
BEGIN
OPEN cur_issue_version ;
FETCH cur_issue_version BULK COLLECT INTO pv_issue_version_col ;
CLOSE cur_issue_version ;
END ;
====================
When I execute this stored procedure thru rapid sql, I get error
Error: ORA-06550: line 1, column 21:
PLS-00306: wrong number or types of arguments in call to 'GET_ALL_ISSUE_VERSION_COL'
ORA-06550: line 1, column 21:
PL/SQL: Statement ignored, Batch 1 Line 1 Col 21
What is that I am missing?
Any help would be greatly appreciated.
I've never tried Rapid SQL, but my guess is that you can't pass objects through it. I'd write a test case on the server and try it there. It looks like it should work but I didn't build a test case. If it works on the server but not in the tool, it's like the tool. OCI8 doesn't support passing instantiated objects.
Similar Messages
-
Calling stored procedure with output parameters in a different schema
I have a simple stored procedure with two parameters:
PROCEDURE Test1(
pOutRecords OUT tCursorRef,
pIdNumber IN NUMBER);
where tCursorRef is REF CURSOR.
(This procedure is part of a package with REF CURSOR declared in there)
And I have two database schemas: AppOwner and AppUser.
The above stored procedure is owned by AppOwner, but I have to execute this stored procedure from AppUser schema. I have created a private synonym and granted the neccessary privileges for AppUser schema to execute the package in the AppUser schema.
When I ran the above procedure from VB using ADO and OraOLEDB.Oracle.1 driver, I got the following error when connecting to the AppUser schema:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'TEST1'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
but when I was connecting to the AppOwner schema, everything is running correctly without errors.
Also, when I switch to the microsoft MSDAORA.1 driver, I can execute the above procedure without any problems even when connecting to the AppUser schema.
I got this error only when I am trying to execute a stored procedure with an output parameter. All other procedures with only input parameters have no problems at all.
Do you know the reason for that? Thanks!If anyone has figured this one out let me know. I'm getting the same problem. Only in my case I've tried both the "OraOLEDB.Oracle" provider and the "MSDAORA" provider and I get an error either way. Also my procedure has 2 in parameters and 1 out parameter. At least now I know I'm not the only one with this issue. :)
'*** the Oracle procedure ***
Create sp_getconfiguration(mygroup in varchar2, myparameter in varchar2, myvalue out varchar2)
AS
rec_config tblconfiguration.configvalue%type;
cursor cur_config is select configvalue from tblconfiguration where configgroup = mygroup and configparameter = myparameter;
begin
open cur_config;
fetch cur_config into rec_config;
close cur_config;
myvalue := rec_config;
end;
'** the ado code ****
dim dbconn as new adodb.connection
dim oCmd as new adodb.connection
dim ors as new adodb.recordset
dbconn.provider = "MSDAORA" 'or dbconn.provider = "OraOLEDB.Oracle"
dbconn.open "Data Source=dahdah;User ID=didi;Password=humdy;PLSQLRSet=1;"
set ocmd.activeconnection = dbconn
cmd.commandtext = "{call fogle.sp_getconfiguration(?,?)}"
'i've also tried creating a public synonym called getconfiguration and just refering to procedure by that.
' "{call getconfiguration(?, ?)}"
' "{call getconfiguration(?,?, {resultset 1, myvalue})}"
'and numerous numerous other combinations
set oPrm = cmd.createparameter("MYGROUP", advarchar, adparaminput, 50, strGrouptoPassIn$)
cmd.parameters.append oPrm
set oPrm = cmd.createParameter("MYPARAMETER", advarchar, adParamInput, 50, strParameterToPassIn$)
cmdParameters.append oPrm
set rs = cmd.execute -
Error while executing the stored procedure through sender JDBC adapter
Hi All,
I am getting below error while executing the stored procedure through sender JDBC adapter.
Database-level error reported by JDBC driver while executing statement 'exec SapgetNextEntity 'SalesOrder''. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor.
what is the problem? any idea to anyone...
regards
Rameshhi Dharamveer,
I am not getting below statement for your reply
Try to use Refrence Cursor it will return u reference of resultset.
I mention SP like this
exec SapgetNextEntity 'SalesOrder'
SapgetNextEntity -
> SP Name
SalesOrder----
> Parameter I am passing...
regards
Ramesh -
Calling a Stored Procedure with output parameters from Query Templates
This is same problem which Shalaka Khandekar logged earlier. This new thread gives the complete description about our problem. Please go through this problem and suggest us a feasible solution.
We encountered a problem while calling a stored procedure from MII Query Template as follows-
1. Stored Procedure is defined in a package. Procedure takes the below inputs and outputs.
a) Input1 - CLOB
b) Input2 - CLOB
c) Input3 - CLOB
d) Output1 - CLOB
e) Output2 - CLOB
f) Output3 - Varchar2
2. There are two ways to get the output back.
a) Using a Stored Procedure by declaring necessary OUT parameters.
b) Using a Function which returns a single value.
3. Consider we are using method 2-a. To call a Stored Procedure with OUT parameters from the Query Template we need to declare variables of
corresponding types and pass them to the Stored Procedure along with the necessary input parameters.
4. This method is not a solution to get output because we cannot declare variables of some type(CLOB, Varchar2) in Query Template.
5. Even though we are successful (step 4) in declaring the OUT variables in Query Template and passed it successfully to the procedure, but our procedure contains outputs which are of type CLOB. It means we are going to get data which is more than VARCHAR2 length which query template cannot return(Limit is 32767
characters)
6. So the method 2-a is ruled out.
7. Now consider method 2-b. Function returns only one value, but we have 3 different OUT values. Assume that we have appended them using a separator. This value is going to be more than 32767 characters which is again a problem with the query template(refer to point 5). So option 2-b is also ruled out.
Apart from above mentioned methods there is a work around. It is to create a temporary table in the database with above 3 OUT parameters along with a session specific column. We insert the output which we got from the procedure to the temporary table and use it further. As soon the usage of the data is completed we delete the current session specific data. So indirectly we call the table as a Session Table. This solution increases unnecessary load on the database.
Thanks in Advance.
RajeshRajesh,
please check if this following proposal could serve you.
Define the Query with mode FixedQueryWithOutput. In the package define a ref cursor as IN OUT parameter. To get your 3 values back, open the cursor in your procedure like "Select val1, val2, val3 from dual". Then the values should get into your query.
Here is an example how this could be defined.
Package:
type return_cur IS ref CURSOR;
Procedure:
PROCEDURE myProc(myReturnCur IN OUT return_cur) ...
OPEN myReturnCur FOR SELECT val1, val2, val3 FROM dual;
Query:
DECLARE
MYRETURNCUR myPackage.return_cur;
BEGIN
myPackage.myProc(
MYRETURNCUR => ?
END;
Good luck.
Michael -
How to execute plsql stored procedure with DbAccess
sessionInfo object can give DbAccess .through
which u can use javax.infobus.DbAccess API to
execute sql satement and stored procedures according to infobus API .iam able to
execute simple query by using executeCommand() ,executeRetrival() ?. how to execute stored procedures with executeRetrieval() .
how to take in and out parameters
suggestions are welcome
waiting for your suggestionsI am also looking for the same.
Did you get any info on this
Thanks,
jagan
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by chandra sekhar ([email protected]):
sessionInfo object can give DbAccess .through
which u can use javax.infobus.DbAccess API to
execute sql satement and stored procedures according to infobus API .iam able to
execute simple query by using executeCommand() ,executeRetrival() ?. how to execute stored procedures with executeRetrieval() .
how to take in and out parameters
suggestions are welcome
waiting for your suggestions<HR></BLOCKQUOTE>
null -
Executing a Stored Procedure with OUT Variables
When you execute a stored proc withi OUT variables, do you have to add in the "Declare" section and "Begin/End" sections? Or can you just use "EXECUTE <stored proc>"??
When you execute a stored proc withi OUT variables, do you have to add in the "Declare" section and "Begin/End" sections?
Or can you just use "EXECUTE <stored proc>"?? You mean this?:
michaels> create or replace procedure p (o out varchar2)
as
begin
o := 'Some out variable';
end p;
Procedure created.
michaels> var o varchar2(50)
michaels> exec p(:o)
PL/SQL procedure successfully completed.
michaels> print o
o
Some out variable -
Problem in executing the stored procedure
I am trying to execute the following procedure which is used to capture data from 4 different tables:
The table structure is as follows with the sample data:
AREA
======
area_id area_type preferred_name
A1 Country India
A2 State AP
A3 Country Finland
A4 State Finland's State
A5 Country USA
T_CREATE_STAGE
=============
we_name we_num country_nm state_nm operator
B1 C1 A1 A2 O1
B1 C2 A3 A4 O1
ASSOCIATE
==========
ba_name busi_associate
ABC O1
XYZ O2
The IN-Paremeters of the procedure takes the Country name & State name (Prefered Name in table AREA) Operator Name (ba_name in table ASSOCIATE), at a time at least one parameter would come as Input and that could also be a Wild Card search.
The problem is that in the following procedure the query is taking the first match and returning it infinite times. Please suggest a suitable way to run the query in the procedure so that it returns the appropriate result.
CREATE OR REPLACE PROCEDURE proc_new_search (
p_recordset OUT sys_refcursor,
countryName VARCHAR2 ,
stateName VARCHAR2 ,
opName VARCHAR2 ,
fieldName VARCHAR2
AS
BEGIN
DECLARE
BEGIN
OPEN p_recordset FOR 'select b.preferred_name,d.preferred_name,a.we_name,a.we_num,c.ba_name,'
|| 'a.fluid_type,e.preferred_name FROM T_CREATE_STAGE a, AREA b,AREA d,AREA e,ASSOCIATE c '
|| 'where (upper('''||countryName||''') IS NULL or instr(b.preferred_name, upper('''||countryName||''') ) > 0) AND a.country_nm = b.area_id AND b.area_type=''COUNTRY'' AND b.active_ind=''Y'''
||' AND (upper('''||opName||''') IS NULL or instr(c.ba_name,upper('''|| opName||''') ) > 0) AND a.operator = c.busi_associate'
||' AND (upper('''||stateName||''') IS NULL or instr(d.preferred_name,upper('''|| stateName ||''') ) > 0) AND a.province_state = d.area_id AND d.area_type=''STATE_PROVINCE'' AND d.active_ind=''Y'''
|| ' AND (upper('''||fieldName||''') IS NULL or instr(a.field, upper('''||fieldName||''' )) > 0) ';
END;
Thanks in advance,
Regards,
PriyaOK, I have extracted the SQL from the code you posted. I notice that there are FIVE tables in the FROM clause of the SQL:
FROM T_CREATE_STAGE a,
AREA b,
AREA d,
AREA e,
ASSOCIATE cwhereas there are only THREE join-conditions joining FOUR tables [5th table AREA e has not been joined with any of the tables]:
/* other conditions in the WHERE clause are filters, not table joins */
AND a.country_nm = b.area_id
AND a.operator = c.busi_associate
AND a.province_state = d.area_idIn order to get valid expected result from a query involving FIVE tables, at least FOUR joins are required. *[ in a query involving N tables, at least N-1 joins are required ]*. Otherwise, the result will have duplication and hence will not be valid/as-expected.
So add a join involving AREA e table with other(s) and see if this improves the result.
HTH -
How to execute a stored procedure with an out parameter ?
Guys I am struggling with executing a stored procedure from sql plus.I mean my stored procedure has 2 input parameter and 1 out put parameter (status of the execution).
MY_PROCEDURE(p_name in varchar2,p_age in number,p_status out varchar2)
end my_procedure;
When I say
EXECUTE MY_PROCEDURE('manohar','Shetty');
i get insufficient parameters errors.
please help.EXECUTE isn't a valid PL/SQL construct. It's a SQL*Plus command. You don't want to put any SQL*Plus commands in a PL/SQL block.
You can always execute a stored procedure purely through PL/SQL
begin
my_stored_procedure( x, y, z );
end;SQL*Plus happens to give you the execute command so you can avoid the begin and end statements.
Justin -
Help required in executing the stored procedure and capturing the responce
Hi,
I have to execute a stored procedure in oracle database and if it successful then have to create a status IDOC.
The stored procedure may throw an exception(it is not an out parameter), in such cases i should capture the exception as part of the response message and send this information while creating the status IDOC.
i would like if the below is possible.
As the stored procedure is not returning( this means if you execute the procedure manually it will display the result), will it be possible to capture the result which has the exception details?
any direction to this will be highly appreciated.
Many thanks.
Regards,
Rahul@Bhaskar,
i need to execute the procedure by sending the input data from a file and capture the result after executing the procedure to create a status idoc
im not sure how the provided links helps me here.
i m not looking for any look ups. i would like to know is there any way that we can capture the result after executing the database procedure?
Edited by: Rahul_10416 on Dec 5, 2011 10:07 PM -
Calling stored procedures with output parameters using RDO and VB
I have a simple test procedure defined as follows:
CREATE OR REPLACE PROCEDURE test_sp (inval1 IN VARCHAR2,
inval2 IN NUMBER, inval3 OUT VARCHAR2, inval4 OUT NUMBER) IS
BEGIN
inval3 := 'RETURN TEST';
inval4 := 10;
END;
I am attempting to call this procedure from VB 5.0 using RDO and the Oracle ODBC Driver 8.01.06:
dim rdoQd as rdoQuery
dim grdoCn as rdoConnection
strSQL = "{ call test_sp('SOMETHING',?,?,?) }"
Set rdoQd = grdoCn.CreateQuery("", strSQL)
rdoQd(0).Direction = rdParamInput
' get error# 40041 at above line
' "Object Collection: Couldn't ' find item indicated by text."
rdoQd(0).Type = rdTypeINTEGER
rdoQd(0).Value = 5
rdoQd(1).Direction = rdParamOutput
rdoQd(1).Type = rdTypeVARCHAR
rdoQd(2).Direction = rdParamOutput
rdoQd(2).Type = rdTypeINTEGER
Set rdoApp = rdoQd.OpenResultset()
MsgBox (CStr(rdoQd(1)))
MsgBox (CStr(rdoQd(2)))
When I run this VB code, I get the above mentioned error. If I use placeholders for all parameters (like "{ call test_sp (?,?,?,?) }" ), no error occurs.
I really need to use the first type of syntax from above and not have to use placeholders for all parameters. Is there a way to accomplish this?
TIA,
EstherAre you getting any warning while importing the stored procedure?
Please check the below datatypes:
While creating the stored procedure, if you have used varchar(MAX), please ALTER it to varchar(255) and reimport to DS.
Also, the datatype of $message (global variable or local variable) used inside DS should also be varchar(255)
Try a print statement in between.
ADMIN.DBO.SPJOBSUMMARY(69,$message,$rtCode,$rtVal);
print('Message is '||$message);
smtp_to('leighattest.com.au', 'Results of ' || job_name(), $rtCode || '//' || $rtVal || '~~' || $message || '//', 0,0);
and see in the job log if DS is able to retrieve the output from DB.
Regards,
Suneer -
Error while executing the stored procedure
Hi All,
When I try to execute the store procedure .The store procedure does not have parameter. I am getting the following error. The store procedure has been successfully complied.
Thanks for all your help.
uday
ORA-01422: exact fetch returns more than requested number of rows
01422. 00000 - "exact fetch returns more than requested number of rows"
*Cause: The number specified in exact fetch is less than the rows returned.
*Action: Rewrite the query or change number of rows requestedHi All,
Here is the store proc and version. I do not have much exposure to pl sql store proc .
Thanks for all your support and help.
uday
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production"
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Here is the store proc .
create or replace
PROCEDURE TEST AS
R_REGION VARCHAR2(5);
R_listing2rifs_count number;
R_listing2rifs number;
listing2iag_count number; /* mentioned already: rp0428 */
listing2iag number;
R_rod2iag_count number;
R_rod2iagnumber;
R_rod2ra_count number;
R_rod2ra number;
begin
select Region,
sum(listing2rifs_count) as listing2rifs_count,
round((sum(listing2rifs) / sum(listing2rifs_count))/30.4,1) as listing2rifs,
sum(listing2iag_count) as listing2iag_count,
round((sum(listing2iag) / sum(listing2iag_count))/30.4,1) as listing2iag,
sum(rod2iag_count) as rod2iag_count,
round((sum(rod2iag) / sum(rod2iag_count))/30.4,1) as rod2iag,
sum(rod2ra_count) as rod2ra_count,
round((sum(rod2ra) / sum(rod2ra_count))/30.4,1) as rod2ra
into R_REGION,R_listing2rifs_count,R_listing2rifs,listing2iag_count,listing2iag,
R_rod2iag_count,R_rod2iag,R_rod2ra_count,R_rod2ra
from (select site.FK_REF_REGION_CODE Region,
site.site_id,
site.EPA_ID,
site.name site_name,
FEDERAL_FACILITY_DETER_CODE,
NPL_STATUS_CODE,
site.BRAC_TYPE_NAME,
sis.FT_FLAG,
listing_action,
rifs_action,
iag_action,
rod_action,
ra_action,
listing.ACTUAL_COMPLETION_DATE as listing_date,
iag.ACTUAL_COMPLETION_DATE as iag_date,
first_rifs.ACTUAL_START_DATE as first_rifs_start_date,
first_rod.ACTUAL_COMPLETION_DATE as first_rod_date,
ra_start.ACTUAL_START_DATE as first_ra_start_date,
case when first_rifs.ACTUAL_START_DATE is not null
and listing.ACTUAL_COMPLETION_DATE is not null
then 1
else 0
end as listing2rifs_count,
first_rifs.ACTUAL_START_DATE - listing.ACTUAL_COMPLETION_DATE as listing2rifs,
case when first_rifs.ACTUAL_START_DATE is not null
and listing.ACTUAL_COMPLETION_DATE is not null
then 1
else 0
end as listing2iag_count,
iag.ACTUAL_COMPLETION_DATE - listing.ACTUAL_COMPLETION_DATE as listing2iag,
case when first_rifs.ACTUAL_START_DATE is not null
and listing.ACTUAL_COMPLETION_DATE is not null
then 1
else 0
end as rod2iag_count,
iag.ACTUAL_COMPLETION_DATE - first_rod.ACTUAL_COMPLETION_DATE as rod2iag,
case when first_rifs.ACTUAL_START_DATE is not null
and listing.ACTUAL_COMPLETION_DATE is not null
then 1
else 0
end as rod2ra_count,
ra_start.ACTUAL_START_DATE - first_rod.ACTUAL_COMPLETION_DATE as rod2ra
from site
LEFT OUTER JOIN
(select fk_site_id,
SPECIAL_INITIATIVE_CODE as FT_FLAG
from SPECIAL_INITIATIVE_SITE sppi
where SPECIAL_INITIATIVE_CODE = 'FT'
) SIS
ON site.site_id = sis.fk_site_id
LEFT OUTER JOIN
(select fk_site_id,
TYPE_SEQUENCE_CODE as listing_action,
ACTUAL_COMPLETION_DATE
from action
where TYPE_CODE = 'NF'
and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PC','PB','OA','OC','TO','TT'))
and ACTUAL_COMPLETION_DATE is not null
and TO_CHAR(action.ACTUAL_COMPLETION_DATE,'YYYYMMDD') || action.TYPE_SEQUENCE_CODE =
(SELECT min(TO_CHAR(ACTUAL_COMPLETION_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
from action b
WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
and b.TYPE_CODE = 'NF'
and b.ACTUAL_COMPLETION_DATE is not null
) listing
ON SITE.SITE_ID = LISTING.FK_site_id
LEFT OUTER JOIN
(select FK_site_id,
TYPE_SEQUENCE_CODE as rifs_action,
ACTUAL_START_DATE,
ACTUAL_COMPLETION_DATE
from action
where TYPE_CODE in ('NH','LW') /*('RI','NA','NH','FS','NK','NI','CO','BD','LW') */
and LEAD_CODE = 'FF'
and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PS','PB','OA','OS','TN','TT'))
and ACTUAL_START_DATE is not null
and TO_CHAR(action.ACTUAL_START_DATE,'YYYYMMDD') || TYPE_SEQUENCE_CODE =
(SELECT min(TO_CHAR(ACTUAL_START_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
from action b
WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
and b.TYPE_CODE in ('NH','LW') /*('RI','NA','NH','FS','NK','NI','CO','BD','LW') */
and b.ACTUAL_START_DATE is not null
) first_rifs
ON site.site_id = first_rifs.FK_site_id
LEFT OUTER JOIN
(select FK_site_id,
TYPE_SEQUENCE_CODE as iag_action,
ACTUAL_COMPLETION_DATE
from action
where TYPE_CODE = 'FI'
and action.LEAD_CODE = 'FE'
and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PC','PB','OA','OC','TO','TT'))
and ACTUAL_COMPLETION_DATE is not null
and TO_CHAR(action.ACTUAL_COMPLETION_DATE,'YYYYMMDD') || action.TYPE_SEQUENCE_CODE =
(SELECT min(TO_CHAR(ACTUAL_COMPLETION_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
from action b
WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
and b.TYPE_CODE = 'FI'
and b.ACTUAL_COMPLETION_DATE is not null
) iag
ON site.site_id = iag.FK_site_id
LEFT OUTER JOIN
(select FK_site_id,
TYPE_SEQUENCE_CODE as rod_action,
ACTUAL_COMPLETION_DATE
from action
where TYPE_CODE = 'RO'
and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PC','PB','OA','OC','TO','TT'))
and ACTUAL_COMPLETION_DATE is not null
and TO_CHAR(action.ACTUAL_COMPLETION_DATE,'YYYYMMDD') || action.TYPE_SEQUENCE_CODE =
(SELECT min(TO_CHAR(ACTUAL_COMPLETION_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
from action b
WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
and b.TYPE_CODE = 'RO'
and b.ACTUAL_COMPLETION_DATE is not null
) first_rod
ON site.site_id = first_rod.FK_site_id
LEFT OUTER JOIN
(select FK_site_id,
TYPE_SEQUENCE_CODE as ra_action,
ACTUAL_START_DATE
from action
where TYPE_CODE = 'LY'
and (ANOMALY_CODE is null or ANOMALY_CODE not in ('PS','PB','OA','OS','TN','TT'))
and ACTUAL_START_DATE is not null
and TO_CHAR(action.ACTUAL_START_DATE,'YYYYMMDD') || action.TYPE_SEQUENCE_CODE =
(SELECT min(TO_CHAR(ACTUAL_START_DATE,'YYYYMMDD') || B.TYPE_SEQUENCE_CODE)
from action b
WHERE ACTION.FK_SITE_ID = b.FK_Site_ID
and b.TYPE_CODE = 'LY'
and b.ACTUAL_START_DATE is not null
) ra_start
ON site.site_id = ra_start.FK_site_id
WHERE site.FEDERAL_FACILITY_DETER_CODE = 'Y'
and site.NPL_STATUS_CODE in (/*'P',*/'F','D','A')
) durations
group by Region
order by 1;
end;
errors:
ORA-01422: exact fetch returns more than requested number of rows
01422. 00000 - "exact fetch returns more than requested number of rows"
*Cause: The number specified in exact fetch is less than the rows returned.
*Action: Rewrite the query or change number of rows requested -
Problem Calling MaxDB stored procedure with output from MII Query template
Hi,
I am using Max DB Database studio to write stored procedure, I am calling stored procedure from MII Query using CALL statement.
Can anyone guide me how to pass output values of stored procedure.
Examlpe::
call ProcName('[Param.1]','[Param.2]','[Param.3]','[Param.4]','[Param.5]', :isSuccess, :Trace)
In the above line of code I am not able to get the output values of stored procedure that is isSuccess and Trace values in Query template when executed. But same thing I get when executed in Database studio.
How do I call with outputs for any stored procedure in MII.
Any help would be appriciated.
Thanks,
PadmaMy call statement is like this
call RESULTDATA_INSERT('[Param.1]','[Param.2]','[Param.3]', :isSuccess, :Trace)
I am able to insert record in DB, But I am not getting output values in Query template.I have done this in Fixed Query, when I execute it throws me "Fatal error as Loaded content empty".
I tried giving select below call but it dont work.
Regards,
Rao -
Calling an oracle stored procedure with output parameter
Hi,
I am trying to execute a procedure with 2 input and 1 output parameters by using SQLQuery. I tried each mode (Command, FixedQuery & FixedQueryWithOutput) with following statements.
call cm_test_prod([Param.1],[Param.2],[Param.3])
Error:"missing expression "
call cm_test_prod([Param.1],[Param.2],?)
Error:"wrong number or types of arguments in call to 'CM_TEST_PROD'"
call cm_test_prod([Param.1],[Param.2],:var)
Error:"wrong number or types of arguments in call to 'CM_TEST_PROD' "
or
Error: "not all variables bound"
If I use without output parameter, in Command mode, It works fine.
call cm_test_prod([Param.1],[Param.2])
or
call cm_test_prod('[Param.1]','[Param.2]')
works without error.
SAP XMII: Version 12.0.5 Build(126)
Oracle 10G
Any help would be greatly appreciated.
Thanks,
Tunur.
Edited by: Namik Tunur on Dec 14, 2010 3:34 PM
Edited by: Namik Tunur on Dec 14, 2010 3:36 PMHi,
@Marcelo,
I used your package just by replacing 'varchar2' instead of 'varchar(100)''. I got the error message 'ORA-00900: invalid SQL statement'. I didn't understand how we handle output parameter with this:
Query = Call MYPKG.MyProcedure(1,'Test FixedQueryWithOutput',?)
What is Query in here? If we have two output parameters, how would we get the outputs?
My procedure is:
CREATE OR REPLACE
PROCEDURE XXXXX.CM_TEST_PROD_OUTPUT(v1 in number,v2 in number, v3 out number) IS
BEGIN
update test_table set no2 = (v1+v2);
commit;
v3 := v1+v2;
END;
declare
a number;
BEGIN
cm_test_prod_output(1,6,a);
END;
if I use this
call cm_test_prod_output([Param.1],[Param.2],?)
with FixedQueryWithOutput mode,
I get the following error:
ORA-06553: PLS-306: wrong number or types of arguments in call to 'CM_TEST_PROD_OUTPUT'
@Mike,
I already tried both with quotes and without quotes, also I tried both with number output and with string output.
As I mentioned before, if I use number inputs without output in Command mode,
call cm_test_prod(http://Param.1,http://Param.2)
or
call cm_test_prod('http://Param.1','http://Param.2')
works succesfully.
Regards,
Tunur -
Getting error while Calling Oracle Stored Procedure with output Parameter
HI All,
From long days i am working on this but i unable to solve it.
Even i have studied so many forums in SAP but i didn't find the solution.
I am calling Oracle Store procedure with 3 inputs and 1 output without cursor.
Store Procedure:-
CREATE OR REPLACE PROCEDURE PDS.send_rm
IS
proc_name VARCHAR2(64) := 'send_rm';
destination_system VARCHAR2(32) := 'RAWMAT';
xml_message VARCHAR2(4000);
status_code INTEGER;
status_message VARCHAR2(128);
debug_message VARCHAR2(128);
p_ret INTEGER;
BEGIN
DBMS_OUTPUT.PUT_LINE( proc_name || ' started' );
xml_message := '<RAW_MATERIAL>'||
'<BAR_CODE>10000764601</BAR_CODE>'||
'<MATERIAL>1101448</MATERIAL>'||
'<VENDOR_CODE/>'||
'<PRODUCTION_DATE>0000-00-00</PRODUCTION_DATE>'||
'<EXPIRE_DATE>0000-00-00</EXPIRE_DATE>'||
'<BATCH/>'||
'<PO_NUM/>'||
'<MATERIAL_DESCRIPTION>POWER SUPPLY</MATERIAL_DESCRIPTION>'||
'<SPEC_NAME/>'||
'<STOCK_CODE>BSW-JH</STOCK_CODE>'||
'<INSPECTION_LOT>00</INSPECTION_LOT>'||
'<USAGE_DECISION_CODE/>'||
'<MATERIAL_GROUP>031</MATERIAL_GROUP>'||
'</RAW_MATERIAL>';
dbms_output.put_line('XML '||xml_message);
-- vp_interface.load_rawmat@cnprpt1_pds(SYSDATE, destination_system,
-- xml_message, p_ret);
vp_interface.load_rawmat(SYSDATE, destination_system,
xml_message, p_ret);
dbms_output.put_line('Return Code '||p_ret);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
status_code := SQLCODE;
status_message := SUBSTR(SQLERRM, 1, 64);
-- Extract_Error_Logger(proc_name, 'LOCAL', SYSDATE, -999,
-- status_message, 0, debug_message);
ROLLBACK;
END send_rm;
And while i am calling this Store procedure in MII, I am facing error.
I have tried different ways but didnt solved
In SQL Query, i kept mode as: FixedQueryOutput
Can anyone tell me or send code for calling above store procedure
And onemore thing, While creating store procedure in Oracle for MII. Do we need to Create output parameter as cursor or normal.
Thanks,
Kind Regards,
Praveen Reddy MHi Praveen
Our wrapper was created because we could not modify the procedure we call (it was not returning a cursor).
CREATE OR REPLACE PROCEDURE CHECK_PUT_IN_USE
(STRCMPNAME in varchar2,
STRSCANLABEL in varchar2,
RCT1 out SYS_REFCURSOR
AS
charDispo Char(1);
charStatus Char(1);
intCatNo Integer;
charCatDispo Char(1);
strCatQual VarChar2(2);
strCatDesc VarChar2(30);
strMsg VarChar2(128);
BEGIN
qa.check_put_in_use@AR(STRCMPNAME,
STRSCANLABEL,
charDispo,
charStatus,
intCatNo,
charCatDispo,
strCatQual,
strCatDesc,
strMsg);
OPEN RCT1
FOR Select charDispo,charStatus,charDispo,charStatus,intCatNo,charCatDispo,strCatQual,strCatDesc,strMsg from Dual;
END;
Hope this helps
Regards
Amrik
then with a FixedQueryWithOutput
call mixar.qasap.wrapper_update_put_in_use('[Param.1]','[Param.2]',[Param.3],?)
Hope this helps. -
'PLS-00363: expression..' error when executing a stored procedure with in o
Hello,
I'm trying to run a PLSQL script containing an ORACLE API but its failing on compilation with the message:
'PLS-00363: expression '<expression>' cannot be used as an assignment target'.
As far as I understand its connected to my IN-OUT parameters but I can't figure out which (I must admit I'm still hiking up a steep learning curve here and I've cut and pasted someone elses example and modified it).
I would be most grateful if one of you pro's could read through my code and advise..
many thanks,
Steveni guess you are trying to store value in your IN parameter.
here is an example
SQL> create or replace procedure pr(p in integer)
2 as
3 begin
4 p := 1;
5 end;
6 /
Warning: Procedure created with compilation errors.
SQL> show err
Errors for PROCEDURE PR:
LINE/COL ERROR
4/2 PL/SQL: Statement ignored
4/2 PLS-00363: expression 'P' cannot be used as an assignment targetSee it also gives the exact line in which the error has occurred. so see that and fix it.
Edited by: Karthick_Arp on Feb 12, 2009 1:57 AM
Maybe you are looking for
-
Error U43M1D207 when attempting to download updates in Adobe Application Manager
How do I get around this? I am using an enterprise IT managed computer. Thanks, Jonathan
-
[SOLVED] Can't get Echinus to work
Hello Arch users, I have installed Echinus from the AUR, but it doesn't seem to be working, or else I'm not doing something correctly. I am using the example config from the Echinus Arch wiki. I am using Slim as the display manager, and have config
-
Using derived obj as a parameter in one of the methods
Hi I have a class "class1", which is the parent class. Another class "class2" is derived from class1 (extends class1) In class3, there is a method "method3" that uses "class1" obj as a parameter. I need to call the same method "method3" in class2 als
-
Few Warp Stabilizer workflow questions
I'm looking for the best workflow with warp stabilizar, because it consists in 90% of my edit work. This is my workflow at the moment: Start to add my trimmed clips in the Premiere timeline Right click the shaky clip and select "replace with AE compo
-
Is it possible to use an external controller, such as the Digi002?
I use a Digi002 (mixer/transport controller) with ProTools. Is it possible to use FinalCutPro X with the same contoller? If so, how do I set it up? thanks, Geoff