Boolean cursor parameter
Hello,
I've been informed that it is possible to define a boolean cursor parameter in PL/SQL.
I tried, and it compiles:
cursor c_test(b_test boolean) is select 1 from dual;
Can somebody give me an example of the use of such a parameter?
thanks,
Marko
Can somebody give me an example of the use of such a parameter? I think it's just a PL/SQL curio. We can't use a BOOLEAN in SQL so we cannot use the parameter in the cursor's query.
Cheers, APC
Blog : http://radiofreetooting.blogspot.com/
Similar Messages
-
How to set a boolean webservice parameter to null
Hi all,
is it possible to set a boolean input parameter of a webservice to null?
False and true works well, but is there also the posibility of setting it to null?
Greetings
FlorianI will try to explain.
Our webservice has a boolean input parameter. And it acts like the follwing pseudo-code:
IF bool_arg == null
action1;
ELSE IF bool_arg==false
action2;
ELSE IF bool_arg==true
action3;
ENDIF;
With the value NULL i mean that the input paramter is not in the SOAP-XML.
But with Visual Composer i only manage to set the value to true or false.
I cannot find a way to set it to null (which means it is not in the SOAP-XML).
Edited by: Florian Kandlinger on May 27, 2008 12:14 PM -
Cast error message when discovering ref cursor parameter from stored proced
We are today using Microsoft's Oracle provider with some code from the old Data Application Block (from MSDN) to discover parameters from the stored procedures. This code uses the OracleCommandBuilder.DeriveParameters to get the parameters from the stored procedure and command.Parameters.CopyTo copies the discovered parameters into the command object.
If I test with a simple function returning a ref cursor I get one parameter with type refCursor and ParameterDirection.OutPut. This is working fine as long we where using Microsoft's Oracle provider. But using Oracle ODP .NET I get the following error message on datadapter.Fill (I fill a dataset with the result from the reference cursor)
Unable to cast object of Type 'Oracle.DataAccess.Client.OracleDataReader' to type 'Oracle.DataAccess.Types.OracleRefCursor.
If I create a ref parameter manualy like this:
OracleParameter myrefCursor = new OracleParameter();
myrefCursor .OracleDbType = OracleDbType.RefCursor;
myrefCursor .ParameterName = "myParameterName";
myrefCursor .Direction = ParameterDirection.ReturnValue;
and add it to the command object this is working OK. So it seems to be a problem with discovering ref cursor parameters from the database, other parameter types is OK.. I have compared the properties of my manual ref cursor parameter with the one discovered from the stored procedure, but I cannot see any difference. (I see the Value property has some values for the discovered one, but I have set this to DBNull.Value without any result)
Any ideas why I get this error code? Is there any other code blocks I can use to discover the parameters? We send in params object[] with the different values into the helper class and the value is added to the parameter. (Se I don't need to set the data type etc for each parameter, I just need to have the correct order of the parameters)For accuracy's sake, just wanted to let everyone know that this is actually a bug. The correct bug number is 8423178.
Christian
Mark_Williams wrote:
Just to follow-up on this issue...
The bug has been closed as "not a bug" as it seems undocumented behavior was relied upon for this to work in earlier releases.
Note from the documentation on DeriveParameters:
"The output values of derived parameters return as .NET Types by default. To obtain output parameters as provider types, the OracleDbType property of the parameter must be set explicitly by the application to override this default behavior. One quick way to do this is to set the OracleDbType to itself for all output parameters that should be returned as provider types." (emphasis added)
The issue, as you might already know, is that there is no corresponding .NET Framework Type for an Oracle Ref Cursor and the type is, therefore, set to Object. So, explicitly setting the type to OracleDbType.RefCursor should work.
Regards,
Mark -
Registering boolean Out parameter
Hi all,
Im trying to register a boolean out parameter in a callable statement. I went through a thread which said boolean types are not supported by JDBC. Is it the same case with my scenario?
Thanks.If your attribute is defined as Boolean, you should be able to use oracle callablablestatement as follows... oraclecallablestatement.setBoolean(12,getAttribute());
Here's some sample code from my EO. Is your syntax similar?
public class AcctMapEOImpl extends OAPlsqlEntityImpl
public void insertRow()
try
OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getDBTransaction();
String s = "begin spl_jdev_api_account_map.spl_create_acct(p_cont_cd=>:1,p_consolidate_cd=>:2, p_customer=>:3,p_req_asn=>:4, p_sonic_label=>:5,p_req_conversion_date=>:6,p_override_asn=>:7,p_vendor_name=>:8,p_building =>:9,p_revision =>:10, p_acct_lookup_use_whse_flag =>:11,p_asn_under_rcpt_tolerance=>:12,p_asn_over_rcpt_tolerance=>:13,p_created_by=>:14,p_creation_date=>:15,p_last_updated_by=>:16,p_last_update_date=>:17,p_cancel_asn_yn=>:18,";
String t = "p_use_flex_valueset=>:19,p_po_asn_yn=>:20,p_prepaid_ups_flag=>:21,p_eia_label=>:22,p_exe_flag=>:23,p_header_label_template=>:24,p_line_label_template=>:25,p_all_lpns=>:26,p_internal_asn=>:27,p_print_pickslip =>:28,p_replace_asn_flag =>:29,p_get_line_ref_flag=>:30,p_commercial_inv_flag=>:31,p_req_asn_search =>:32,p_asn_ship_days =>:33,p_asn_receipt_days=>:34,p_asn_creation_days =>:35,p_asn_conversion_flag =>:36,p_min_shelf_life_days=>:37,p_restrict_expired_pick =>:38,";
String u = "p_ars_rules=>:39,p_restock_ord_tgt_oms=>:40,p_attribute_category =>:41,p_attribute1 =>:42,p_attribute2 =>:43,p_attribute3 =>:44,p_attribute4 =>:45,p_attribute5=>:46,p_attribute6=>:47,p_attribute7 =>:48,p_attribute8=>:49,p_attribute9=>:50,p_attribute10=>:51,p_attribute11 =>:52,p_attribute12 =>:53,p_attribute13 =>:54,p_attribute14 =>:55,p_attribute15 =>:56,p_header_label_template1 => :57,p_header_label_template2 =>:58,p_header_label_template3 => :59,";
String v = "p_header_label_template4 => :60,p_header_label_template5 =>:61,p_header_label_template6 => :62,p_header_label_template7 => :63,p_header_label_template8 =>:64,p_header_label_template9 => :65,p_header_label_template10 => :66,p_header_label_template11 =>:67,p_header_label_template12 => :68,p_header_label_template13 => :69,p_header_label_template14 =>:70,p_header_label_template15 => :71,p_line_label_template1 => :72,p_line_label_template2 => :73," ;
String w = "p_line_label_template3 => :74,p_line_label_template4 => :75,p_line_label_template5 => :76,p_line_label_template6 => :77,p_line_label_template7 => :78,p_line_label_template8 => :79,p_line_label_template9 => :80,p_line_label_template10 => :81,p_line_label_template11 => :82,p_line_label_template12 => :83,p_line_label_template13 => :84,p_line_label_template14 => :85,p_line_label_template15 => :86); end;";
String x = (s+t+u+v+w);
OracleCallableStatement oraclecallablestatement = (OracleCallableStatement)oadbtransactionimpl.createCallableStatement(x, -1);
oraclecallablestatement.setString(1,getContCd());
oraclecallablestatement.setString(2,getConsolidateCd());
oraclecallablestatement.setString(3,getCustomer());
oraclecallablestatement.setString(4,getReqAsn());
oraclecallablestatement.setString(5,getSonicLabel());
oraclecallablestatement.setDATE(6,getReqConversionDate());
oraclecallablestatement.setString(7,getOverrideAsn());
oraclecallablestatement.setString(8,getVendorName());
oraclecallablestatement.setString(9,getBuilding());
oraclecallablestatement.setString(10,getRevision());
oraclecallablestatement.setString(11,getAcctLookupUseWhseFlag());
oraclecallablestatement.setNUMBER(12,getAsnUnderRcptTolerance());
oraclecallablestatement.setNUMBER(13,getAsnOverRcptTolerance());
oraclecallablestatement.setNUMBER(14,getCreatedBy());
oraclecallablestatement.setDATE(15,getCreationDate());
oraclecallablestatement.setNUMBER(16,getLastUpdatedBy());
oraclecallablestatement.setDATE(17,getLastUpdateDate());
oraclecallablestatement.setString(18,getCancelAsnYn());
oraclecallablestatement.setString(19,getUseFlexValueset());
oraclecallablestatement.setString(20,getPoAsnYn());
oraclecallablestatement.setString(21,getPrepaidUpsFlag());
oraclecallablestatement.setString(22,getEiaLabel());
oraclecallablestatement.setString(23,getExeFlag());
oraclecallablestatement.setString(24,getHeaderLabelTemplate());
oraclecallablestatement.setString(25,getLineLabelTemplate());
oraclecallablestatement.setString(26,getAllLpns());
oraclecallablestatement.setString(27,getInternalAsn());
oraclecallablestatement.setString(28,getPrintPickslip());
oraclecallablestatement.setString(29,getReplaceAsnFlag());
oraclecallablestatement.setString(30,getGetLineRefFlag());
oraclecallablestatement.setString(31,getCommercialInvFlag());
oraclecallablestatement.setString(32,getReqAsnSearch());
oraclecallablestatement.setNUMBER(33,getAsnShipDays());
oraclecallablestatement.setNUMBER(34,getAsnReceiptDays());
oraclecallablestatement.setNUMBER(35,getAsnCreationDays());
oraclecallablestatement.setString(36,getAsnConversionFlag());
oraclecallablestatement.setNUMBER(37,getMinShelfLifeDays());
oraclecallablestatement.setString(38,getRestrictExpiredPick());
oraclecallablestatement.setString(39,getArsRules());
oraclecallablestatement.setString(40,getRestockOrdTgtOms());
oraclecallablestatement.setString(41,getAttributeCategory());
oraclecallablestatement.setString(42,getAttribute1());
oraclecallablestatement.setString(43,getAttribute2());
oraclecallablestatement.setString(44,getAttribute3());
oraclecallablestatement.setString(45,getAttribute4());
oraclecallablestatement.setString(46,getAttribute5());
oraclecallablestatement.setString(47,getAttribute6());
oraclecallablestatement.setString(48,getAttribute7());
oraclecallablestatement.setString(49,getAttribute8());
oraclecallablestatement.setString(50,getAttribute9());
oraclecallablestatement.setString(51,getAttribute10());
oraclecallablestatement.setString(52,getAttribute11());
oraclecallablestatement.setString(53,getAttribute12());
oraclecallablestatement.setString(54,getAttribute13());
oraclecallablestatement.setString(55,getAttribute14());
oraclecallablestatement.setString(56,getAttribute15());
oraclecallablestatement.setString(57,getReferencename1());
oraclecallablestatement.setString(58,getReferencename2());
oraclecallablestatement.setString(59,getReferencename3());
oraclecallablestatement.setString(60,getReferencename4());
oraclecallablestatement.setString(61,getReferencename5());
oraclecallablestatement.setString(62,getReferencename6());
oraclecallablestatement.setString(63,getReferencename7());
oraclecallablestatement.setString(64,getReferencename8());
oraclecallablestatement.setString(65,getReferencename9());
oraclecallablestatement.setString(66,getReferencename10());
oraclecallablestatement.setString(67,getReferencename11());
oraclecallablestatement.setString(68,getReferencename12());
oraclecallablestatement.setString(69,getReferencename13());
oraclecallablestatement.setString(70,getReferencename14());
oraclecallablestatement.setString(71,getReferencename15());
oraclecallablestatement.setString(72,getLnrefname1());
oraclecallablestatement.setString(73,getLnrefname2());
oraclecallablestatement.setString(74,getLnrefname3());
oraclecallablestatement.setString(75,getLnrefname4());
oraclecallablestatement.setString(76,getLnrefname5());
oraclecallablestatement.setString(77,getLnrefname6());
oraclecallablestatement.setString(78,getLnrefname7());
oraclecallablestatement.setString(79,getLnrefname8());
oraclecallablestatement.setString(80,getLnrefname9());
oraclecallablestatement.setString(81,getLnrefname10());
oraclecallablestatement.setString(82,getLnrefname11());
oraclecallablestatement.setString(83,getLnrefname12());
oraclecallablestatement.setString(84,getLnrefname13());
oraclecallablestatement.setString(85,getLnrefname14());
oraclecallablestatement.setString(86,getLnrefname15());
oraclecallablestatement.execute();
catch(SQLException sqlexception)
throw OAException.wrapperException(sqlexception);
catch(Exception exception)
throw OAException.wrapperException(exception);
} -
Ora-01001 in procedures with ref cursor parameter after upgrade to 11.1.0.7
Hi,
after upgrading from 11.1.0.6.0 to 11.1.0.7.0, I get ora-01001 in procedure calls which have a ref cursor as an out parameter.
Even a new 11.1.0.7 instance throws this error. My OS is Linux SLES10SP2.
Please see atched sample code:
CREATE OR REPLACE PACKAGE test1_pck
IS
PROCEDURE run1; -- OK on 11.1.0.6; fails on 11.1.0.7
PROCEDURE run2; -- OK on 11.1.0.6; OK on 11.1.0.7
END test1_pck;
CREATE OR REPLACE PACKAGE BODY test1_pck
IS
TYPE t_rec IS RECORD(col dual.dummy%TYPE);
TYPE t_cur IS REF CURSOR RETURN t_rec;
PROCEDURE foo1(p_cur OUT t_cur)
IS
v_sql VARCHAR2(255) := 'BEGIN OPEN :1 FOR SELECT dummy FROM dual; END;';
BEGIN
EXECUTE IMMEDIATE v_sql USING p_cur;
END foo1;
PROCEDURE foo2
IS
v_sql VARCHAR2(255) := 'BEGIN OPEN :1 FOR SELECT dummy FROM dual; END;';
v_cur t_cur;
v_rec t_rec;
BEGIN
EXECUTE IMMEDIATE v_sql USING v_cur;
LOOP
FETCH v_cur INTO v_rec;
EXIT WHEN v_cur%NOTFOUND;
CASE v_rec.col
WHEN 'X' THEN dbms_output.put_line('success');
ELSE dbms_output.put_line('error');
END CASE;
END LOOP;
END foo2;
PROCEDURE run1
IS
v_cur t_cur;
v_rec t_rec;
BEGIN
foo1(v_cur);
LOOP
FETCH v_cur INTO v_rec;
EXIT WHEN v_cur%NOTFOUND;
CASE v_rec.col
WHEN 'X' THEN dbms_output.put_line('success');
ELSE dbms_output.put_line('error');
END CASE;
END LOOP;
END run1;
PROCEDURE run2
IS
BEGIN
foo2;
END run2;
END test1_pck;
Thanks for any hints.
Regards FrankHi Max,
the referenced thread discusses a .Net problem. A lot of layers are involved their. My problem is a very basic problem. You get this error even if you run the test in a sql session on the server.
It would be a great help for me
a) if someone could test this package on a 11.1.0.7 database
b) if someone could test this package on a 11.2 database (is it fixed in Release2?)
c) if someone could give me hints how I could modify the procedure to make it usable for 11.1.0.7
(I already tried a lot e.g. EXECUTE IMMEDIATE v_sql USING OUT p_cur;
Thank you
Frank -
Sort(Order by) a cursor by cursor parameter
Hello,
I want to make cursor to query three column data, and order by the paramter when calling store procedure. But the cursor did not order by column name at all.
Any help will be appreciated.
ggu.
My package/procedure:
CREATE OR REPLACE PACKAGE test_PKG AUTHID DEFINER
AS
TYPE REF_CUR IS REF CURSOR;
PROCEDURE test_proc(COLN IN VARCHAR2, OUTCUR OUT REF_CUR);
END test_PKG;
CREATE OR REPLACE PACKAGE BODY TEST_PKG
AS
PROCEDURE test_proc(COLN in varchar2, outcur out ref_cur) IS
BEGIN
IF NOT OUTCUR%ISOPEN
THEN
open OUTCUR FOR
SELECT CPS.PYROL_ID,
CPS.VEND_ID,
CPS.CONT_ID
FROM EPRS.CNTRCTR_PYROL_SUBMIT CPS
ORDER BY COLN; <------What should be here?
END IF;
end test_proc;
end test_pkg;
var results refcursor;
execute test_PKG.test_PROC('Vend_ID', :results);
print results;
It gave me results:
PYROL_ID VEND_ID CONT_ID
193 06883 009214070
196 11756 202101064
205 06507 072202046
206 06507 042202046
207 06507 032202046
208 06883 012202046I could make the question more clear;
I want to query a table, for example, with three columns. The query results should be sorted by one specific column. I want to leave the column to be ordered by as a parameter, how to implment it?
Thanks. -
Calling Stored Procedure with Boolean Output Parameter
Hi all,
I'm running into an issue (or is it a BUG) when calling a Database Stored Procedure that has an output parameter of the boolean type.
procedure proc(p_text in varchar2, p_result out boolean)
is
.....I use the following 'standard' code (developer guide 36-19 36-20) to invoke this procedure from my application module.
try {
// 1. Define the PL/SQL block for the statement to invoke
String stmt = "begin proc(?,?); end;";
// 2. Create the CallableStatement for the PL/SQL block
st = getDBTransaction().createCallableStatement(stmt, 0);
// 3. Register the positions and types of the OUT parameters
st.registerOutParameter(2, Types.BOOLEAN);
// 4. Set the bind values of the IN parameters
st.setObject(1, "Some text");
// 5. Execute the statement
st.executeUpdate();
..............................As soon as 'st.registerOutParameter(2, Types.BOOLEAN);' is invoked I run into a SQLexception. "Invalid ColumnType: 16". Obviously 16 refers to Types.BOOLEAN.
[edit by Luc]
SOLUTION / WORKAROUND
To answer my own question.
It looks like BOOLEAN output parameters are not supported. I just Read "Appendix D Troubleshooting" of the Oracle® Database JDBC Developer's Guide and Reference 10g Release 2 (10.2).
I found that JDBC drivers do not support the passing of BOOLEAN parameters to PL/SQL stored procedures. If a PL/SQL procedure contains BOOLEAN values, you can work around the restriction by wrapping the PL/SQL procedure with a second PL/SQL procedure that accepts the argument as an INT and passes it to the first stored procedure. When the second procedure is called, the server performs the conversion from INT to BOOLEAN.
I'm not very happy with this but I guess I've no choice.
Regards Luc
Edited by: lucbors on Nov 30, 2010 10:37 AMfyi
Related to the solution/workaround posted by Luc.
see "Do Oracle's JDBC drivers support PL/SQL tables/result sets/records/booleans? "
at http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#34_05
regards
Jan Vervecken -
Cursor-pasing multiple values as a cursor parameter
declare
credit_amount number:=0;
debit_amount number:=0;
v1 number:=0;
v2 number:=0;
v3 varchar2(500);
v4 varchar2(500);
v5 varchar2(240);
v6 varchar2(240);
v7 number;
v8 varchar2(240);
v9 varchar2(240);
v10 number;
v11 number;
v12 varchar2(240);
v13 varchar2(240);
v14 varchar2(240);
v15 number;
v16 number;
--This cursor is for liability records which are in GL not in AP
cursor c1(p_header_id number,p_reference_2 varchar2,p_reference_4 varchar2)
is
(select
jl.je_header_id "JE_HEADER_ID"
,jl.period_name "PERIOD"
,glcc.concatenated_segments "ACCOUNT_CODE"
,DECODE(jl.accounted_dr,null,0,jl.accounted_dr)"ACCOUNTED_DEBIT"
,DECODE(jl.accounted_cr,null,0,jl.accounted_cr) "ACCOUNTED_CREDIT"
,DECODE(jl.accounted_dr,null,0,jl.accounted_dr) - DECODE(jl.accounted_cr,null,0,jl.accounted_cr) "NET"
,glcc.CODE_COMBINATION_ID "CODE_COMBINATION_ID"
,jl.SET_OF_BOOKS_ID "SET_OF_BOOKS_ID"
,jl.PERIOD_NAME "PERIOD_NAME"
,DECODE(Jl.entered_dr,null,0,Jl.entered_dr)"ENTERED_DEBIT"
,DECODE(Jl.entered_cr,null,0,Jl.entered_cr) "ENTERED_CREDIT"
,jl.reference_1 "SUPPLIER"
,jl.reference_2 "INVOICE_ID"
,jl.reference_3 "CHECK_ID"
,jl.reference_4 "CHECK_NUMBER"
,jl.reference_5 "INVOICE_NUM"
,jl.reference_6 "'AP_PAYMT_JUST_INSERTED'"
,jl.reference_7 "set_of_books_id"
,jl.GL_SL_LINK_ID "GL_SL_LINK_ID"
,jl.REFERENCE_8 "INVOICE_DIST_LINE_NUMBER"
,jl.reference_9 "INVOICE_PAYMENT_ID"
,jl.REFERENCE_10 "LIABILITY"
,jl.TAX_CODE_ID "TAX_CODE_ID"
,jl.TAX_GROUP_ID "TAX_GROUP_ID"
FROM
gl_je_lines jl
, apps.gl_code_combinations_KFV glcc
, gl_je_headers jh
WHERE
jl.period_name='Mar-10'
and glcc. code_combination_id in (1016,1296,1298)
and jh.je_header_id = jl.je_header_id
AND glcc.code_combination_id = jl.code_combination_id
and jh.je_source = 'Payables'
AND jl.je_header_id = p_header_id
and jl.reference_2 = p_reference_2
and jl.reference_4 = p_reference_4
MINUS
select
ir.je_header_id
, h.period_name "APPERIOD"
,g.CONCATENATED_SEGMENTS "AP ACCOUNT CODE"
,DECODE(l.accounted_dr,null,0,l.accounted_dr) "AP ACCOUNTED_DR"
,DECODE(l.accounted_cr,null,0,l.accounted_cr) "AP ACCOUNTED_CR"
,DECODE(l.accounted_dr,null,0,l.accounted_dr) - DECODE(l.accounted_cr,null,0,l.accounted_cr) "NET"
,l.CODE_COMBINATION_ID "AP_CCID"
,h.set_of_books_id
,h.PERIOD_NAME "PERIOD_NAME"
,DECODE(l.entered_dr,null,0,l.entered_dr)"ENTERED_DEBIT"
,DECODE(l.entered_cr,null,0,l.entered_cr) "ENTERED_CREDIT"
,l.reference1 "SUPPLIER"
,l.reference2 "INVOICE_Id"
,l.reference3 "reference_3"
,l.reference4 "reference_4"
,l.reference5 "INVOICE_NUM"
,l.reference6 "reference_6"
,l.reference7 "reference_7"
,l.GL_SL_LINK_ID "GL_SL_LINK_ID"
,l.REFERENCE8 "REFERENCE_8"
,l.reference9 "reference_9"
,l.REFERENCE10 "REFERENCE_10"
,l.TAX_CODE_ID "TAX_CODE_ID"
,l.TAX_LINK_ID "TAX_LINK_ID"
from
ap_ae_lines_all l,
ap_ae_headers_all h,
gl_code_combinations_kfv g
,gl_import_references ir
where
ir.gl_sl_link_id=l.gl_sl_link_id
AND g.CODE_COMBINATION_ID = l.CODE_COMBINATION_ID
and h.ae_header_id = l.ae_header_id
AND h.period_name ='Mar-10'
AND g.CODE_COMBINATION_ID in (1016,1296,1298)
AND ir.JE_HEADER_ID = p_header_id
and l.reference2 = p_reference_2
and l.reference4 = p_reference_4);
--This cursor is for writeoff records
cursor c2
is
(select * from gl_je_lines
where period_name='Mar-10'
and reference_10='WRITEOFF'
and reference_2 in ('525706','525600'));
credit number:=0;
debit number:=0;
j varchar2(240);
i varchar2(4000):='0';
cursor c3 (p_invoice_id varchar2)
is
(select
jl.je_header_id "JE_HEADER_ID"
,jl.period_name "PERIOD"
,glcc.concatenated_segments "ACCOUNT_CODE"
,DECODE(jl.accounted_dr,null,0,jl.accounted_dr)"ACCOUNTED_DEBIT"
,DECODE(jl.accounted_cr,null,0,jl.accounted_cr) "ACCOUNTED_CREDIT"
,DECODE(jl.accounted_dr,null,0,jl.accounted_dr) - DECODE(jl.accounted_cr,null,0,jl.accounted_cr) "NET"
,glcc.CODE_COMBINATION_ID "CODE_COMBINATION_ID"
,jl.SET_OF_BOOKS_ID "SET_OF_BOOKS_ID"
,jl.PERIOD_NAME "PERIOD_NAME"
,DECODE(Jl.entered_dr,null,0,Jl.entered_dr)"ENTERED_DEBIT"
,DECODE(Jl.entered_cr,null,0,Jl.entered_cr) "ENTERED_CREDIT"
,jl.reference_1 "SUPPLIER"
,jl.reference_2 "INVOICE_ID"
,jl.reference_3 "CHECK_ID"
,jl.reference_4 "CHECK_NUMBER"
,jl.reference_5 "INVOICE_NUM"
,jl.reference_6 "'AP_PAYMT_JUST_INSERTED'"
,jl.reference_7 "set_of_books_id"
,jl.GL_SL_LINK_ID "GL_SL_LINK_ID"
,jl.REFERENCE_8 "INVOICE_DIST_LINE_NUMBER"
,jl.reference_9 "INVOICE_PAYMENT_ID"
,jl.REFERENCE_10 "LIABILITY"
,jl.TAX_CODE_ID "TAX_CODE_ID"
,jl.TAX_GROUP_ID "TAX_GROUP_ID"
FROM
gl_je_lines jl
, apps.gl_code_combinations_KFV glcc
, gl_je_headers jh
WHERE
jl.period_name='Mar-10'
and glcc. code_combination_id in (1016,1296,1298)
and jh.je_header_id = jl.je_header_id
AND glcc.code_combination_id = jl.code_combination_id
and jh.je_source = 'Payables'
and jl.reference_2 in (p_invoice_id)
MINUS
select
ir.je_header_id
, h.period_name "AP PERIOD"
,g.CONCATENATED_SEGMENTS "AP ACCOUNT CODE"
,DECODE(l.accounted_dr,null,0,l.accounted_dr) "AP ACCOUNTED_DR"
,DECODE(l.accounted_cr,null,0,l.accounted_cr) "AP ACCOUNTED_CR"
,DECODE(l.accounted_dr,null,0,l.accounted_dr) - DECODE(l.accounted_cr,null,0,l.accounted_cr) "NET"
,l.CODE_COMBINATION_ID "AP_CCID"
,h.set_of_books_id
,h.PERIOD_NAME "PERIOD_NAME"
,DECODE(l.entered_dr,null,0,l.entered_dr)"ENTERED_DEBIT"
,DECODE(l.entered_cr,null,0,l.entered_cr) "ENTERED_CREDIT"
,l.reference1 "SUPPLIER"
,l.reference2 "INVOICE_Id"
,l.reference3 "reference_3"
,l.reference4 "reference_4"
,l.reference5 "INVOICE_NUM"
,l.reference6 "reference_6"
,l.reference7 "reference_7"
,l.GL_SL_LINK_ID "GL_SL_LINK_ID"
,l.REFERENCE8 "REFERENCE_8"
,l.reference9 "reference_9"
,l.REFERENCE10 "REFERENCE_10"
,l.TAX_CODE_ID "TAX_CODE_ID"
,l.TAX_LINK_ID "TAX_LINK_ID"
from
ap_ae_lines_all l,
ap_ae_headers_all h,
gl_code_combinations_kfv g
,gl_import_references ir
where
ir.gl_sl_link_id=l.gl_sl_link_id
AND g.CODE_COMBINATION_ID = l.CODE_COMBINATION_ID
and h.ae_header_id = l.ae_header_id
AND h.period_name ='Mar-10'
AND g.CODE_COMBINATION_ID in (1016,1296,1298)
and l.reference2 in (p_invoice_id)); --here if i put l.reference2 in (p_invoice_id)) it must show the details of
-- of all.but it doesnot display sir
--here if i put l.reference2 not in (p_invoice_id)) it shows that id also sir
BEGIN
for writeoff_rec in c2
LOOP
FOR Main_cur in c1(writeoff_rec.je_header_id,writeoff_rec.reference_2,writeoff_rec.reference_4)
LOOP
j:='0';
IF writeoff_rec.accounted_dr is not null AND Main_cur.ACCOUNTED_CREDIT<>0
THEN
v10:=Main_cur.ACCOUNTED_CREDIT;
credit_amount:= credit_amount+Main_cur.ACCOUNTED_CREDIT;
ELSIF writeoff_rec.accounted_cr is not null AND Main_cur.ACCOUNTED_DEBIT<>0
THEN
v11:=Main_cur.ACCOUNTED_DEBIT;
debit_amount:= debit_amount+Main_cur.ACCOUNTED_DEBIT;
END IF;
if c1%found then
j:=Main_cur.INVOICE_ID;
end if;
END LOOP;
-- i:=i||','||j;
i:= i||','''||j||'''';
END LOOP;
dbms_output.put_line(i); --Here i got all invoiceids of varchar2 records without single qutations
--its look like '0','23232','2324234' etc.
for cash_clearing_cur in c3(i)--Here is the problem ..is it correct way here i am passing parameter to cursor
loop
v3:=0;
v4:=0;
v5:=0;
v6:=0;
v7:=0;
v8:=0;
v9:=0;
v10:=0;
v11:=0;
v12:=0;
v13:=0;
v14:=0;
v15:=0;
v16:=0;
credit:=credit+cash_clearing_cur.ACCOUNTED_CREDIT;
debit:=debit+cash_clearing_cur.ACCOUNTED_DEBIT;
v3:=cash_clearing_cur.JE_HEADER_ID;
v4:=cash_clearing_cur.INVOICE_ID;
v5:=cash_clearing_cur.CHECK_NUMBER;
v6:=cash_clearing_cur.LIABILITY;
v7:=cash_clearing_cur.CODE_COMBINATION_ID;
v8:=cash_clearing_cur.PERIOD;
v9:=cash_clearing_cur.ACCOUNT_CODE;
v10:=cash_clearing_cur.ACCOUNTED_CREDIT;
v11:=cash_clearing_cur.ACCOUNTED_DEBIT;
v12:=cash_clearing_cur.SUPPLIER;
v13:=cash_clearing_cur.CHECK_ID;
v14:=cash_clearing_cur.INVOICE_NUM;
v15:=cash_clearing_cur.GL_SL_LINK_ID;
v16:=cash_clearing_cur.SET_OF_BOOKS_ID;
DBMS_OUTPUT.PUT_LINE('HEAd '||v3||','||'inv_id '||v4||','||
'chk_num '||v5||','||'ref10 '||v6||','||'CCID '||V7||','||'PED '||V8
||','||'acctcode '||v9||','||'acct_Ct '||V10
||','||'acct_Dt '||v11||','||'chk_id '||v13||','||'inv_num '||V14
||','||'link '||v15||','||'sob '||v16||','||'suplir '||V12);
end loop;
DBMS_OUTPUT.PUT_LINE( 'Dr Amt ' ||debit || 'Cr amt ' || credit );
EXCEPTION
when too_many_rows then
dbms_output.put_line('Invalid no of rows');
when no_data_found then
dbms_output.put_line('no data found exception');
when others then
dbms_output.put_line('Other than Invalid no of rows');
dbms_output.put_line(SQLERRM);
END;
ouutput was
0,0 that means cursor c3 is not compiled because i am passing multiple values in parametr .is there any solutionWhats wrong with your previous thread passing variable which has multiple values to cursor as parameter
Opening a new thread doesn't mean that you will get more responses. Did you carefully studied the hints given by Justin Cave ? I guess no, because you ignored the first point itself to format your code with tag. -
Hi,
recently I found out that a cursor must not have explicit a defined parameter list:
1. Option
cursor cur_example
is
select name
from table1
where name = p_name
=> instead of
2. Option
cursor cur_example (p_name IN VARCHAR2)
is
select name
from table1
where name = p_name
why is then sometimes a parameterlist definition necessary?
cheers,
Bernhard> my problem is to understand if a parameter list must not necessarily be defined? But if it is defined it seems that it is only for readability reasons!!!!!????
True. In programming generally we often have the choice of whether to pass a parameter or have the code refer to a global variable, and passing the parameter is nearly always better practice because it makes the dependency explicit and therefore easier to understand. For example, this sort of scenario is ambiguous without cursor parameters:
DECLARE
v_somevar VARCHAR2(1) := 'X';
v_count INTEGER;
CURSOR c IS
SELECT COUNT(*) FROM dual WHERE dummy = v_somevar;
BEGIN
v_somevar := 'Y';
OPEN c;
FETCH c INTO v_count;
CLOSE c;
DBMS_OUTPUT.PUT_LINE('Count = ' || v_count);
END;I would always prefer the equivalent,
DECLARE
v_somevar VARCHAR2(1) := 'X';
v_count INTEGER;
CURSOR c ( cp_someval dual.dummy%TYPE ) IS
SELECT COUNT(*) FROM dual WHERE dummy = cp_someval;
BEGIN
v_somevar := 'Y';
OPEN c (v_somevar);
FETCH c INTO v_count;
CLOSE c;
DBMS_OUTPUT.PUT_LINE('Count = ' || v_count);
END; -
Hello,
The MSDN explanation is:
"Deletes the specified directory and, if indicated, any subdirectories and files in the directory."
If you specify that a directory should be deleted, the logical assumption is that subfolders and files will also be deleted. How can you delete a directory without all of its recursive contents also being deleted!? The documentation does not explain why
you need the Boolean parameter.
I have tested the function out, and I cannot understand the results it is producing. Can someone clarify precisely what this function actually does?
Also, is there another function that simply delete the directory whether or not it has any contents?
Many thanks.
Keith
R K HowardI tested what I communicated to you with another developer, and we both observed the behaviour. I will re-test soon (I can't do it immediately) and re-post later on.
Thanks.
R K Howard
Perhaps but you don't specify what you were doing when the behavior occured. I would guess something else had a folder open for one of the folders you were attempting this with. Or perhaps a file open and locked in the initial folder or subfolders off the
initial folder.
Doesn't any process on a PC have to ask the OS if it can "open" a file or folder or delete either so the OS knows what to do when those things occur including if something else has that file or folder open? After all the program doesn't delete
anything. It tells the OS it wants something deleted and the OS performs the deletion doesn't it? Otherwise the MFT could not keep track of anything on the system could it?
I replicated the issue as
Rbie said by having explorer displaying one of the folders to be deleted.
I have code that will display if a folder is open in Explorer if you would like that.
Also with regard to the Boolean value that will keep any subfolders in a chain from the initial folder in the path as well as the initial folder from being deleted if a subfolder contains a file if it is set to false. I suppose all other subfolders not in
that direct chain but in other subfolders in the initial folder would be deleted up to their entire chain except the original folder in the path if they all were empty.
Obviously if the boolean is set to true it will allow all folders in the initial folder, and all their chains, to be deleted as well as the initial folder even if they contain files. However there could be security issues that occur if a user used that code
on a path chain where they had no delete authority somewhere along the line of the chain.
Tree with branches rather than chain really.
La vida loca -
Hi expert,
I have a problem with a custom procedure
create or replace
PROCEDURE PRC_PARTITION
AS
STRFLUSSO VARCHAR2(50) := 'PRC_PARTITION';
STRERR VARCHAR2(255);
V_PARTITION VARCHAR2(255);
V_PARTITION_TRANSACTION VARCHAR2(255);
CURSOR V_CUR (V_PARTITION_CUR VARCHAR2)
IS
SELECT NAME FROM CITY PARTITION (V_PARTITION_CUR);
BEGIN
SELECT max(partition_name) into V_PARTITION FROM user_tab_partitions WHERE table_name = 'CITY';
DBMS_OUTPUT.Put_Line (V_PARTITION);
FOR I IN V_CUR(V_PARTITION)
LOOP
EXIT WHEN V_CUR%NOTFOUND;
DBMS_OUTPUT.Put_Line (I.NAME);
END LOOP;
EXCEPTION
WHEN OTHERS THEN
STRERR := SUBSTR (SQLERRM, 1, 254);
dbms_output.put_line('Errore:'||STRERR);
rollback;
END PRC_CARING_TRANSACTION;
Connecting to the database DBTEST.
SYS_P6209
Errore:ORA-02149: Specified partition does not exist
Process exited.
Disconnecting from the database DBTEST.But the partition SYS_P6209 exists and I can run this:
SELECT NAME FROM CITY PARTITION (SYS_P6209);.... what I wrong
cheers,
LainSELECT table_name,partition_name,high_value FROM user_tab_partitions WHERE table_name = 'CITY';
CITY SYS_P5969 TIMESTAMP' 2011-03-25 00:00:00'
CITY SYS_P6049 TIMESTAMP' 2011-04-01 00:00:00'
CITY SYS_P6209 TIMESTAMP' 2011-04-15 00:00:00'Current_date is the column partitioned:
SELECT * FROM CITY WHERE CURRENT_DATE ... ??thanks for all suggest.
Cheers,
Lain -
How to call a VB dll with boolean parameter in labview
hi ,
I havea problem with labview calling dll.
I need to call a customer's dll(VB) , but I find labview have no boolean type parameter, so how can I do it ?
I have used labview 7.1 and only have dll without source code.
sonic
Sonic
Diffrent Strokes for Different Folkshi semercurio :
I have bulid a dll by lv 7.1 with boolean and then call lt from LV7.1,but i have some issue of it .
I also use U8 and I16 type and all pop up a errer message,you can see it from accathed.
do you have any suggestion about it ?
Sonic
Diffrent Strokes for Different Folks
Attachments:
15.JPG 17 KB
SharedLib.h 1 KB -
REF CURSOR as IN parameter to stored procedure
Currently, ODP.NET supports REF CURSOR parameter as OUT parameter only.
Based on the project requirements it is necessary to pass
multiple records to the stored procedure.
In this case REF CURSOR as IN parameter is useful.
What are the plans to implement REF CURSOR as IN parameter to stored procedure?
What is the work around in case it is necessary to pass several different
record types as arrays to stored procedure?ODP.NET does not limit REF Cursor parameters to IN parameters. This is a known PL/SQL limitation.
An excerpt from Application Developer's Guide:
"If you pass a host cursor variable to PL/SQL, you cannot fetch from it on the server side unless you also open it there on the same server call". -
How to pass a date parameter(from a procedure IN) to a API
Hi,
CREATE OR REPLACE package body xxal_basic_sal_increment_pkg1 as
procedure emp_pro_inc1(ERRBUF VARCHAR2,RETCODE OUT NUMBER,
p_business_group_id_enter in number,p_change_date in varchar2) is
CURSOR STAFF IS
SELECT pp.ASSIGNMENT_ID
,peo.EMPLOYEE_NUMBER employee_no
,pp.OBJECT_VERSION_NUMBER
,pp.PAY_PROPOSAL_ID
,pp.PROPOSED_SALARY_N basic_salary
,pp.PROPOSAL_REASON
,pp.change_date
,pp.BUSINESS_GROUP_ID
,pg.name
,pr.PERFORMANCE_RATING,
'' v_effective_start_date,
'' v_effective_end_date
FROM per_all_people_f peo,
per_all_assignments_f pa,
per_pay_proposals pp,
per_grades_tl pg,
per_performance_reviews_v pr
where pa.person_id = peo.PERSON_ID
and pa.ASSIGNMENT_ID = pp.ASSIGNMENT_ID
and peo.PERSON_ID=pr.PERSON_ID
and pg.GRADE_ID=pa.GRADE_ID
--and peo.EMPLOYEE_NUMBER=STAFF_VAR.employee_no
and sysdate between peo.EFFECTIVE_START_DATE and peo.EFFECTIVE_END_DATE
and sysdate between pa.EFFECTIVE_START_DATE and pa.EFFECTIVE_END_DATE
and peo.BUSINESS_GROUP_ID = p_business_group_id_enter
and pp.change_DATE = (select max(change_DATE) from per_pay_proposals temp
where ASSIGNMENT_ID =pp.ASSIGNMENT_ID);
--L_BUSINESS_GROUP_ID NUMBER:=5128;
L_ASSIGNMENT_ID NUMBER;
L_PAY_PROPOSAL_ID NUMBER;
L_OBJECT_VERSION_NUMBER NUMBER;
L_pyp_proposed_sal_warning BOOLEAN;
L_additional_comp_warning boolean;
l_person_id number;
L_COMMON boolean;
L_ELEMENT_ENTRY_ID NUMBER;
TEMP NUMBER;
L_EFFECTIVE_START_DATE DATE;
L_MULTI VARCHAR2(30):='N';
L_APPROVED VARCHAR2(30):='Y';
L_CHANGE_DATE DATE:=TO_DATE('31-JAN-2008','DD-MON-YYYY');
BEGIN
v_disp_output:='EMPLOYEE_NUMBER'||','||
'BASIC'||','||
'EFF START DATE'||','||
'EFF END DATE';
fnd_file.put_line(FND_FILE.output,v_disp_output);
FOR STAFF_VAR IN STAFF LOOP
L_ELEMENT_ENTRY_ID:=null;
begin
select assign.assignment_id,assign.effective_start_date into
l_assignment_id,l_change_date_new
from per_people_f peo,per_assignments_f assign
where peo.person_id=assign.person_id
and sysdate between peo.effective_start_date and peo.effective_end_date
and sysdate between assign.effective_start_date and assign.effective_end_date
and current_employee_flag='Y'
and primary_flag='Y'
and peo.business_group_id=l_business_group_id
and peo.employee_number=staff_var.employee_no;
L_CHANGE_DATE_new:=L_CHANGE_DATE;
--L_CHANGE_DATE_new:=STAFF_VAR.v_effective_start_date;
begin
HR_MAINTAIN_PROPOSAL_API.INSERT_SALARY_PROPOSAL
P_PAY_PROPOSAL_ID=>L_PAY_PROPOSAL_ID
,P_ASSIGNMENT_ID=>staff_var.ASSIGNMENT_ID
,P_BUSINESS_GROUP_ID=>staff_var.BUSINESS_GROUP_ID
,P_CHANGE_DATE=>L_CHANGE_DATE_new
,P_PROPOSED_SALARY_N=>STAFF_VAR.basic_salary
,P_OBJECT_VERSION_NUMBER=>STAFF_VAR.OBJECT_VERSION_NUMBER
,p_multiple_components=>L_MULTI
,p_approved=>L_APPROVED
,P_VALIDATE=>false
,p_element_entry_id =>L_ELEMENT_ENTRY_ID
,P_INV_NEXT_SAL_DATE_WARNING=>l_common
,P_PROPOSED_SALARY_WARNING=>L_COMMON
,P_APPROVED_WARNING=>L_COMMON
,P_PAYROLL_WARNING=>L_COMMON
in the above code the variable L_CHANGE_DATE DATE is hard coded .
but we need to supply this variable value as dynamic, means (p_change date--procedure IN Parameter )
i tried like below ,
CREATE OR REPLACE package body xxal_basic_sal_increment_pkg1 as
procedure emp_pro_inc1(ERRBUF VARCHAR2,RETCODE OUT NUMBER,
p_business_group_id_enter in number,p_change_date in varchar2) is
CURSOR STAFF IS
SELECT pp.ASSIGNMENT_ID
,peo.EMPLOYEE_NUMBER employee_no
,pp.OBJECT_VERSION_NUMBER
,pp.PAY_PROPOSAL_ID
,pp.PROPOSED_SALARY_N basic_salary
,pp.PROPOSAL_REASON
,pp.change_date
,pp.BUSINESS_GROUP_ID
,pg.name
,pr.PERFORMANCE_RATING,
'' v_effective_start_date,
'' v_effective_end_date
FROM per_all_people_f peo,
per_all_assignments_f pa,
per_pay_proposals pp,
per_grades_tl pg,
per_performance_reviews_v pr
where pa.person_id = peo.PERSON_ID
and pa.ASSIGNMENT_ID = pp.ASSIGNMENT_ID
and peo.PERSON_ID=pr.PERSON_ID
and pg.GRADE_ID=pa.GRADE_ID
--and peo.EMPLOYEE_NUMBER=STAFF_VAR.employee_no
and sysdate between peo.EFFECTIVE_START_DATE and peo.EFFECTIVE_END_DATE
and sysdate between pa.EFFECTIVE_START_DATE and pa.EFFECTIVE_END_DATE
and peo.BUSINESS_GROUP_ID = p_business_group_id_enter
and pp.change_DATE = (select max(change_DATE) from per_pay_proposals temp
where ASSIGNMENT_ID =pp.ASSIGNMENT_ID);
--L_BUSINESS_GROUP_ID NUMBER:=5128;
L_ASSIGNMENT_ID NUMBER;
L_PAY_PROPOSAL_ID NUMBER;
L_OBJECT_VERSION_NUMBER NUMBER;
L_pyp_proposed_sal_warning BOOLEAN;
L_additional_comp_warning boolean;
l_person_id number;
L_COMMON boolean;
L_ELEMENT_ENTRY_ID NUMBER;
TEMP NUMBER;
L_EFFECTIVE_START_DATE DATE;
L_MULTI VARCHAR2(30):='N';
L_APPROVED VARCHAR2(30):='Y';
L_CHANGE_DATE DATE:=TO_DATE(p_change_date,'DD-MON-YYYY');
BEGIN
v_disp_output:='EMPLOYEE_NUMBER'||','||
'BASIC'||','||
'EFF START DATE'||','||
'EFF END DATE';
fnd_file.put_line(FND_FILE.output,v_disp_output);
FOR STAFF_VAR IN STAFF LOOP
L_ELEMENT_ENTRY_ID:=null;
begin
select assign.assignment_id,assign.effective_start_date into
l_assignment_id,l_change_date_new
from per_people_f peo,per_assignments_f assign
where peo.person_id=assign.person_id
and sysdate between peo.effective_start_date and peo.effective_end_date
and sysdate between assign.effective_start_date and assign.effective_end_date
and current_employee_flag='Y'
and primary_flag='Y'
and peo.business_group_id=l_business_group_id
and peo.employee_number=staff_var.employee_no;
L_CHANGE_DATE_new:=L_CHANGE_DATE;
--L_CHANGE_DATE_new:=STAFF_VAR.v_effective_start_date;
begin
HR_MAINTAIN_PROPOSAL_API.INSERT_SALARY_PROPOSAL
P_PAY_PROPOSAL_ID=>L_PAY_PROPOSAL_ID
,P_ASSIGNMENT_ID=>staff_var.ASSIGNMENT_ID
,P_BUSINESS_GROUP_ID=>staff_var.BUSINESS_GROUP_ID
,P_CHANGE_DATE=>L_CHANGE_DATE_new
,P_PROPOSED_SALARY_N=>STAFF_VAR.basic_salary
,P_OBJECT_VERSION_NUMBER=>STAFF_VAR.OBJECT_VERSION_NUMBER
,p_multiple_components=>L_MULTI
,p_approved=>L_APPROVED
,P_VALIDATE=>false
,p_element_entry_id =>L_ELEMENT_ENTRY_ID
,P_INV_NEXT_SAL_DATE_WARNING=>l_common
,P_PROPOSED_SALARY_WARNING=>L_COMMON
,P_APPROVED_WARNING=>L_COMMON
,P_PAYROLL_WARNING=>L_COMMON
but we are getting the error Cause: FDPSTP failed due to ORA-01839: date not valid for month specified
ORA-06512: at "APPS.XXAL_BASIC_SAL_INCREMENT_PKG1", line 45
ORA-06512: at line 1
we tried the solution available in the metalink still its giving error ..
pl help us to solve this issue ...
how should we pass the date parameter while we run the concurrent program(we used date value set).
also we tried with some other value set also ..
Regards,
kumardear,
I have the following code to create proposal, but the API create salary proposal for all record s and does not create entry for all records it just creates for the first record
any advice
the code ....
/* Formatted on 2007/08/29 16:20 (Formatter Plus v4.8.8) */
----------------------- P R O P O S A L -------------------------
DECLARE
l_rows_processed NUMBER := 0;
l_commit_point NUMBER := 500;
l_business_group_id NUMBER
:= fnd_profile.VALUE ('PER_BUSINESS_GROUP_ID');
l_proposal_salry NUMBER;
l_approved CHAR (1);
l_rowid VARCHAR2 (30);
l_errmessage VARCHAR2 (400);
l_entry_indecator NUMBER;
l_assignment_id NUMBER;
p_ctr_object_version_number NUMBER;
-- Out Parameters --
l_element_entry_id NUMBER;
p_element_entry_id NUMBER;
l_ctr_object_version_number NUMBER;
l_pay_proposal_id NUMBER;
l_inv_next_sal_date_warning BOOLEAN;
l_proposed_salary_warning BOOLEAN;
l_approved_warning BOOLEAN;
l_payroll_warning BOOLEAN;
CURSOR crs_dc_mn
IS
SELECT xdp.ROWID, xdp.assignment_id, xdp.change_date,
xdp.proposal_reason, xdp.proposed_salary,
xdp.assignment_number, xdp.employee_number, xdp.person_id,
xdp.new_asg_id
FROM apps.xx_dc_proposal xdp
WHERE xdp.assignment_id <> -1
AND xdp.processed = 'N'
AND xdp.change_date =
(SELECT MIN (xdc.change_date)
FROM xx_dc_proposal xdc
WHERE xdc.assignment_id = xdp.assignment_id
AND xdc.processed = 'N')
ORDER BY assignment_id, change_date ASC;
pro_rcrd crs_dc_mn%ROWTYPE;
CURSOR crs_dc_proposal1 (p_asg_id IN NUMBER)
IS
SELECT xdp.ROWID, xdp.assignment_id, xdp.change_date,
xdp.proposal_reason, xdp.proposed_salary,
xdp.assignment_number, xdp.employee_number, xdp.person_id,
xdp.new_asg_id
FROM apps.xx_dc_proposal xdp
WHERE xdp.assignment_id <> -1
AND xdp.processed = 'N'
AND xdp.assignment_id = p_asg_id
ORDER BY assignment_id, change_date ASC;
BEGIN
OPEN crs_dc_mn;
FETCH crs_dc_mn
INTO pro_rcrd;
LOOP
BEGIN
hr_maintain_proposal_api.insert_salary_proposal
(p_pay_proposal_id => l_pay_proposal_id,
p_assignment_id => pro_rcrd.assignment_id,
p_business_group_id => l_business_group_id,
p_change_date => pro_rcrd.change_date,
p_comments => NULL,
p_next_sal_review_date => NULL,
p_proposal_reason => NULL,
p_proposed_salary_n => pro_rcrd.proposed_salary,
p_forced_ranking => NULL,
p_performance_review_id => NULL,
p_attribute_category => NULL,
p_attribute1 => NULL,
p_attribute2 => NULL,
p_attribute3 => NULL,
p_attribute4 => NULL,
p_attribute5 => NULL,
p_attribute6 => NULL,
p_attribute7 => NULL,
p_attribute8 => NULL,
p_attribute9 => NULL,
p_attribute10 => NULL,
p_attribute11 => NULL,
p_attribute12 => NULL,
p_attribute13 => NULL,
p_attribute14 => NULL,
p_attribute15 => NULL,
p_attribute16 => NULL,
p_attribute17 => NULL,
p_attribute18 => NULL,
p_attribute19 => NULL,
p_attribute20 => NULL,
p_object_version_number => l_ctr_object_version_number,
p_multiple_components => 'N', -- 918219
p_approved => 'Y',
p_validate => FALSE,
p_element_entry_id => l_element_entry_id,
p_inv_next_sal_date_warning => l_inv_next_sal_date_warning,
p_proposed_salary_warning => l_proposed_salary_warning,
p_approved_warning => l_approved_warning,
p_payroll_warning => l_payroll_warning
UPDATE xx_dc_proposal
SET processed = 'Y'
WHERE ROWID = pro_rcrd.ROWID;
l_rows_processed := l_rows_processed + 1;
IF l_rows_processed = l_commit_point
THEN
COMMIT;
l_rows_processed := 0;
END IF;
EXCEPTION
WHEN OTHERS
THEN
l_errmessage := SQLERRM;
UPDATE xx_dc_proposal
SET err_message = l_errmessage
WHERE ROWID = pro_rcrd.ROWID;
END;
END LOOP;
CLOSE crs_dc_mn;
COMMIT;
END;
.............................. -
How to give ref cursor in VB procedure call
This is my Oracle Sp
CREATE OR REPLACE PROCEDURE CRD_DMAN.infy_usp_trades_by_broker_bkr
** Procedure name: CRD_DMAN.USP_TRADES_BY_BROKER
** Author's name: Infosys
** Date written: 04/11/07
** Description: Compliance Trade by Borker
** Maintenance history:
** Date Chg req# Name Remarks
** 04/11/07 Infosys Created
p_ordercursor IN OUT infy_pkg_compliance_transact.cur_compliancetrade,
p_startdate IN VARCHAR,
p_enddate IN VARCHAR,
p_fundcode IN cs_fund_config.parent_acct_cd%TYPE,
p_clientcode IN ts_order_alloc.acct_cd%TYPE,
p_brokercode IN ts_order_alloc.exec_broker%TYPE,
p_reportname IN report_log.report_name%TYPE,
p_callingapplication IN report_log.calling_application%TYPE,
p_callinguser IN report_log.calling_user%TYPE
IS
--Declaring Local Variables
v_owner VARCHAR2 (30);
v_startdate VARCHAR2 (10);
v_enddate VARCHAR2 (10);
v_rowcount NUMBER:=0;
v_logrec base_util_pkg.crd_log_record;
exp_error EXCEPTION;
v_fundcodevalue NUMBER;
BEGIN
BEGIN
/*checking if the start date and end date are null and
assigning the sysdate accordingly*/
IF (TRIM(p_startdate) IS NULL )
THEN
v_startdate := TO_CHAR (SYSDATE, 'mm/dd/yy');
ELSE
v_startdate := p_startdate;
END IF;
IF (TRIM(p_enddate) IS NULL )
THEN
v_enddate := TO_CHAR (SYSDATE, 'mm/dd/yy');
ELSE
v_enddate := p_enddate;
END IF;
/*checking if fund code is null and assigning value accordingly*/
IF TRIM (p_fundcode) IS NULL
THEN
v_fundcodevalue := 0;
ELSE
v_fundcodevalue := 1;
END IF;
/*checking if the reportname or calling user or calling
application name*/
IF (p_reportname IS NULL OR p_callinguser IS NULL
OR p_callingapplication IS NULL)
THEN
RAISE exp_error;
END IF;
END;
--opening and fetching the data into cursor
v_logrec.start_time := SYSDATE;
BEGIN
OPEN p_ordercursor
FOR
SELECT
oa.exec_broker EXEC_BROKER_CODE,
b.bkr_name EXEC_BROKER_NAME,
oa.acct_cd CLIENT_CODE,
f.acct_name CLIENT_NAME,
CASE WHEN (Exists (SELECT 1
FROM cs_fund_broker fb
WHERE rel_typ_cd IN('P','M')
AND oa.exec_broker=fb.BKR_CD
AND oa.acct_cd =fb.acct_cd))
THEN 'Y'
ELSE 'N' END DIRECTED_BROKER,
COUNT ( distinct o.order_id) COUNT_TICKNUM,
MAX (o.trade_date) TRADE_DATE,
SUM (oa.exec_amt) BASE_COST,
SUM (oa.commision_amt) TOTAL_COMMISSION,
(SELECT ab.bkr_typ_cd FROM au_broker ab
WHERE ab.au_change_date =(SELECT TO_TIMESTAMP(MAX(ab.au_change_date))
FROM au_broker ab WHERE b.bkr_typ_cd != ab.bkr_typ_cd AND b.bkr_cd = ab.bkr_cd))
BROKER_HISTORY
FROM
ts_order o
JOIN ts_order_alloc oa ON (o.order_id = oa.order_id)
JOIN cs_broker b ON(oa.exec_broker = b.bkr_cd)
JOIN cs_fund f ON(oa.acct_cd = f.acct_cd)
WHERE
o.status = 'ACCT'
AND oa.exec_broker = CASE WHEN TRIM (p_brokercode) IS NULL
THEN oa.exec_broker
ELSE TRIM(p_brokercode) END
AND oa.acct_cd = CASE WHEN TRIM(p_clientcode) IS NULL
THEN oa.acct_cd
ELSE TRIM(p_clientcode) END
AND ((0 = v_fundcodevalue) OR EXISTS (SELECT 1 FROM crd.cs_fund_config cf
WHERE cf.parent_acct_cd =TRIM (p_fundcode)
AND oa.acct_cd = cf.child_acct_cd))
AND o.trade_date BETWEEN TO_DATE (v_startdate, 'mm/dd/yy')
AND TO_DATE (v_enddate, 'mm/dd/yy')
GROUP BY oa.exec_broker, b.bkr_name ,oa.acct_cd ,f.acct_name,oa.directed_broker,b.bkr_typ_cd,b.bkr_cd;
END;
BEGIN
SELECT
owner
INTO
v_owner
FROM
all_objects
WHERE
object_name = 'INFY_USP_TRADES_BY_BROKER_BKR';
v_logrec.end_time := SYSDATE;
v_logrec.user_code := v_owner;
v_logrec.input_param_values := 'INFY_USP_TRADES_BY_BROKER_BKR,'
|| v_startdate
|| ','
|| v_enddate
|| ','
|| p_fundcode
|| ','
|| p_clientcode
|| ','
|| p_brokercode;
v_logrec.report_name := p_reportname;
v_logrec.object_name := 'INFY_USP_TRADES_BY_BROKER_BKR';
v_logrec.rows_returned := v_rowcount;
v_logrec.calling_application := p_callingapplication;
v_logrec.calling_user := p_callinguser;
END;
BEGIN
--calling the procedure to insert values into the report_log table
COMMIT;
SET TRANSACTION READ WRITE;
base_util_pkg.crd_base_util_proc (v_logrec);
SET TRANSACTION READ ONLY;
END;
EXCEPTION
WHEN exp_error
THEN
DBMS_OUTPUT.put_line ('ERROR');
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('ERROR OCCURED' || SQLCODE);
DBMS_OUTPUT.put_line (SQLERRM);
END infy_usp_trades_by_broker_bkr;
END OF CRD_DMAN.USP_TRADES_BY_BROKER
This is my Pakage from where i am using ref cursor
CREATE OR REPLACE PACKAGE CRD_DMAN.infy_pkg_compliance_transact
AS
** Package name : CRD.INFY_PKG_COMPLIANCE_TRANSACTIONS
** Author's name : Infosys
** Date written : 06/11/07
** Project/System : CRD
** Description : Compliance Trades By Borker Package
** Maintenance history:
** Date Chg req# Name Remarks
** 06/11/07 CRD Infosys Created
--Defining The ComplianceTrade Record DataType
TYPE rec_compliancetrade IS RECORD (
exec_broker_code crd.ts_order_alloc.exec_broker%TYPE,
exec_broker_name crd.cs_broker.bkr_name%TYPE,
client_code crd.ts_order_alloc.acct_cd%TYPE,
client_name crd.cs_fund.acct_name%TYPE,
directed_broker crd.ts_order_alloc.directed_broker%TYPE,
count_ticknum crd.ts_order.order_id%TYPE,
trade_date crd.ts_order.trade_date%TYPE,
base_cost crd.ts_order_alloc.cur_base_mkt_val%TYPE,
total_commission crd.ts_order_alloc.commision_amt%TYPE,
broker_history crd.au_broker.bkr_typ_cd%TYPE
--Declaring a variable of rec_auditdata data type
TYPE cur_compliancetrade IS REF CURSOR
RETURN rec_compliancetrade;
END infy_pkg_compliance_transact;
END OF CRD.INFY_PKG_COMPLIANCE_TRANSACTIONS
How to call this SP from VB code with ref cursor parameter?I'm fairly sure that's not possible, since there's nothing in the ODBC spec to allow for ref cursors. The driver has built in support to check for ref cursors that are returned via a stored procedure call, but there's nothing built into the driver to pass one IN. Since a ref cursor can't be constructed on the client side, you'd have to have some sort of structure that allowed you to reference the ref cursor directly in order to be able to pass one back to the database.
Since you're using VB.NET anyway, the better solution is probably just to use ODP.NET instead, which DOES allow you to reference a ref cursor directly, and there are samples that install with ODP.NET that show you how to do that.
Greg
Maybe you are looking for
-
How Can You Tell if a Song You WANT to Purchase can be a Ringtone?
Sorry, I would have posted this in the iTunes folder, but it's not allowing me to post there for some reason. Anyways, does anyone know how you can tell if a song you WANT to purchase is available as a ringtone? I know that if you already have purcha
-
BAM server crash with the following error. Exception: oracle.bam.adc.common.exceptions.CacheException: BAM-01247: An invalid transaction type sequence exists in the transaction map. What does this mean? Thanks
-
Is there a problem with the Firefox synch server?
I have three installations of Firefox 4.0.1 on two machines (two fixed, one PortableApps). They are all set up to synchronise. Since yesterday, all are showing an error at the bottom of the window saying "Sync encountered an error while connecting: S
-
How to cancel changes in a Table?
Hi Experts, In one requirement, i have a button called 'Cancel', when user clicks on this button all changes done by the user should be refresh.(i need old data before change). how can we achieve this? help please Thanks, Venkat.
-
Hi.. i have a three level bom. Second and third level having semifinsh and raw material. Now i want to change the material master of one fo semifinsh material. But system doesnt allow me to do thi s. it giving error as The value 7206.10.10 is not