Returning a row of data in a stored procedure

Please help me remember how to return a row or rows from a pl/sql query in a stored procedure.
I am having a major brain fart.

If want to return a resultset from stored procedures see here for an example
http://asktom.oracle.com/~tkyte/ResultSets/index.html

Similar Messages

  • How can I return a big amount of data from a stored procedure?

    How can I return a big amount of data from a stored procedure in a efficient way ?
    For example not using a cursor for going through all the rows and then assign the values to variables.
    thanks in advance!

    Let's see if I'm able to explain myself..
    I have a SQL query with..about 190.000 (in the best fo the the options)
    I have something like this in my stored procedure..
    FOR REC IN trn_adj_no
    LOOP
    REC_PIPE.INSTANCE_ID:=REC.INSTANCE_ID;
    REC_PIPE.PROCESS_ID:=REC.PROCESS_ID;
    REC_PIPE.ENTITY_TYPE:='TRANSACTION';
    REC_PIPE.CRES_FILENAME:=REC.CRES_FILENAME;
    REC_PIPE.CHUNK_REVISION_SK:=P_CHUNK_REVISION_SK;
    REC_PIPE.CHUNK_ID:=trim(p_chunk_id);
    REC_PIPE.FCL_SK:=REC.FCL_SK;
    REC_PIPE.FCL_TRADE_SK:=REC.FCL_TRADE_SK;
    REC_PIPE.FCL_VALUATION_SK:=REC.FCL_VALUATION_SK;
    REC_PIPE.FCL_BUSINESS_GROUP:=REC.FCL_BUSINESS_GROUP;
    REC_PIPE.ABS_TRN_CD:=REC.ABS_TRN_CD;
    REC_PIPE.ACC_INTEREST_IMP_LOAN_CCY_IFRS:=REC.ACC_INTEREST_IMP_LOAN_CCY_IFRS;
    REC_PIPE.ACC_INTEREST_IMP_LOAN_IFRS:=REC.ACC_INTEREST_IMP_LOAN_IFRS;
    REC_PIPE.ACCRUED_INT_AMT:=REC.ACCRUED_INT_AMT;
    REC_PIPE.ACCRUED_INT_CCY_CD:=REC.ACCRUED_INT_CCY_CD;
    REC_PIPE.AMORT_ID:=REC.AMORT_ID;
    REC_PIPE.AMORT_IND:=REC.AMORT_IND;
    REC_PIPE.ATI:=REC.ATI;
    REC_PIPE.ATI_2:=REC.ATI_2;
    REC_PIPE.ATI_2_AMT:=REC.ATI_2_AMT;
    REC_PIPE.ATI_2_CCY_CD:=REC.ATI_2_CCY_CD;
    REC_PIPE.ATI_AMT:=REC.ATI_AMT;
    REC_PIPE.ATI_CCY_CD:=REC.ATI_CCY_CD;
    REC_PIPE.AVG_MTH_DUE_AMT:=REC.AVG_MTH_DUE_AMT;
    REC_PIPE.AVG_MTH_DUE_CCY_CD:=REC.AVG_MTH_DUE_CCY_CD;
    REC_PIPE.AVG_YTD_DUE_AMT:=REC.AVG_YTD_DUE_AMT;
    REC_PIPE.AVG_YTD_DUE_CCY_CD:=REC.AVG_YTD_DUE_CCY_CD;
    REC_PIPE.BAL_SHEET_EXP_AMT:=REC.BAL_SHEET_EXP_AMT;
    REC_PIPE.BAL_SHEET_EXP_AMT_IFRS:=REC.BAL_SHEET_EXP_AMT_IFRS;
    REC_PIPE.BAL_SHEET_EXP_CCY_CD:=REC.BAL_SHEET_EXP_CCY_CD;
    REC_PIPE.BAL_SHEET_EXP_CCY_CD_IFRS:=REC.BAL_SHEET_EXP_CCY_CD_IFRS;
    REC_PIPE.BAL_SHEET_EXP_EUR_AMT:=REC.BAL_SHEET_EXP_EUR_AMT;
    REC_PIPE.BAL_SHEET_EXP_EUR_AMT_IFRS:=REC.BAL_SHEET_EXP_EUR_AMT_IFRS;
    REC_PIPE.BEN_CCDB_ID:=REC.BEN_CCDB_ID;
    REC_PIPE.BEN_CD:=REC.BEN_CD;
    REC_PIPE.BEN_SRC_CD:=REC.BEN_SRC_CD;
    REC_PIPE.BOOK_CD:=REC.BOOK_CD;
    REC_PIPE.BOOK_TYPE_CD:=REC.BOOK_TYPE_CD;
    REC_PIPE.BOOK_VAL_AMT:=REC.BOOK_VAL_AMT;
    REC_PIPE.BOOK_VAL_AMT_IFRS:=REC.BOOK_VAL_AMT_IFRS;
    REC_PIPE.BOOK_VAL_CCY_CD:=REC.BOOK_VAL_CCY_CD;
    REC_PIPE.BOOK_VAL_CCY_CD_IFRS:=REC.BOOK_VAL_CCY_CD_IFRS;
    REC_PIPE.BOOK_VAL_US_GAAP_AMT:=REC.BOOK_VAL_US_GAAP_AMT;
    REC_PIPE.BRANCH_ID:=REC.BRANCH_ID;
    REC_PIPE.BRANCH_LOC_CD:=REC.BRANCH_LOC_CD;
    REC_PIPE.BS_COMPEN_CD:=REC.BS_COMPEN_CD;
    REC_PIPE.BUS_AREA_UBR_ID:=REC.BUS_AREA_UBR_ID;
    REC_PIPE.CA_CD:=REC.CA_CD;
    REC_PIPE.CAD_RISK_WEIGHT_PCT:=REC.CAD_RISK_WEIGHT_PCT;
    REC_PIPE.CASH_SETTLE_IND:=REC.CASH_SETTLE_IND;
    REC_PIPE.CLS_FLG:=REC.CLS_FLG;
    REC_PIPE.COB_DT:=REC.COB_DT;
    REC_PIPE.COL_AGMENT_SRC_CD:=REC.COL_AGMENT_SRC_CD;
    REC_PIPE.CONSOLIDATION_PCT:=REC.CONSOLIDATION_PCT;
    REC_PIPE.CONTRACT_AMT:=REC.CONTRACT_AMT;
    REC_PIPE.CONTRACT_COUNT:=REC.CONTRACT_COUNT;
    REC_PIPE.COST_UNSEC_WORKOUT_AMT:=REC.COST_UNSEC_WORKOUT_AMT;
    REC_PIPE.CPTY_CCDB_ID:=REC.CPTY_CCDB_ID;
    REC_PIPE.CPTY_CD:=REC.CPTY_CD;
    REC_PIPE.CPTY_LONG_NAME:=REC.CPTY_LONG_NAME;
    REC_PIPE.CPTY_SRC_PROXY_UBR_ID:=REC.CPTY_SRC_PROXY_UBR_ID;
    REC_PIPE.CPTY_TYPE_CD:=REC.CPTY_TYPE_CD;
    REC_PIPE.CPTY_UBR_ID:=REC.CPTY_UBR_ID;
    REC_PIPE.CREDIT_LINE_NET_IND:=REC.CREDIT_LINE_NET_IND;
    REC_PIPE.CRES_SYS_ID:=REC.CRES_SYS_ID;
    REC_PIPE.CTRY_RISK_PROVISION_BAL_AMT:=REC.CTRY_RISK_PROVISION_BAL_AMT;
    REC_PIPE.CUR_NOTIONAL_AMT:=REC.CUR_NOTIONAL_AMT;
    REC_PIPE.CUR_NOTIONAL_CCY_CD:=REC.CUR_NOTIONAL_CCY_CD;
    REC_PIPE.CUR_NOTIONAL_CCY_CD_IFRS:=REC.CUR_NOTIONAL_CCY_CD_IFRS;
    REC_PIPE.CUR_NOTIONAL_AMT_IFRS:=REC.CUR_NOTIONAL_AMT_IFRS;
    REC_PIPE.DB_ENTITY_TRANSFER_ASSETS_CD:=REC.DB_ENTITY_TRANSFER_ASSETS_CD;
    REC_PIPE.DEAL_TYPE_CD:=REC.DEAL_TYPE_CD;
    REC_PIPE.DECOMPOSITION_IDENTIFIER:=REC.DECOMPOSITION_IDENTIFIER;
    REC_PIPE.DEF_LOAN_FEE_IFRS:=REC.DEF_LOAN_FEE_IFRS;
    REC_PIPE.DEF_LOAN_FEE_USGAAP:=REC.DEF_LOAN_FEE_USGAAP;
    REC_PIPE.DELIVERY_DT:=REC.DELIVERY_DT;
    REC_PIPE.DERIV_NOT_DT:=REC.DERIV_NOT_DT;
    REC_PIPE.DERIV_NOT_IND:=REC.DERIV_NOT_IND;
    REC_PIPE.DESK:=REC.DESK;
    REC_PIPE.DIVISION_UBR_ID:=REC.DIVISION_UBR_ID;
    REC_PIPE.ENTITY_CCDB_ID:=REC.ENTITY_CCDB_ID;
    REC_PIPE.FAC_CD:=REC.FAC_CD;
    REC_PIPE.FAC_LIMIT_CD:=REC.FAC_LIMIT_CD;
    REC_PIPE.FAC_LIMIT_SRC_CD:=REC.FAC_LIMIT_SRC_CD;
    REC_PIPE.FAC_SRC_CD:=REC.FAC_SRC_CD;
    REC_PIPE.FAIR_VAL_CD_IFRS:=REC.FAIR_VAL_CD_IFRS;
    REC_PIPE.FED_CLASS_CD:=REC.FED_CLASS_CD;
    REC_PIPE.FIRST_RISK_PROVISION_DT:=REC.FIRST_RISK_PROVISION_DT;
    REC_PIPE.FV_IMP_LOSS_CRED_CCY_IFRS:=REC.FV_IMP_LOSS_CRED_CCY_IFRS;
    REC_PIPE.FV_IMP_LOSS_CRED_IFRS:=REC.FV_IMP_LOSS_CRED_IFRS;
    REC_PIPE.FV_IMP_LOSS_CRED_YTD_CCY_IFRS:=REC.FV_IMP_LOSS_CRED_YTD_CCY_IFRS;
    REC_PIPE.FV_IMP_LOSS_CRED_YTD_IFRS:=REC.FV_IMP_LOSS_CRED_YTD_IFRS;
    REC_PIPE.GEN_RISK_PROVISION_BAL_AMT:=REC.GEN_RISK_PROVISION_BAL_AMT;
    REC_PIPE.GL_PROFIT_CENTRE:=REC.GL_PROFIT_CENTRE;
    REC_PIPE.GLOBAL_GL_CD:=REC.GLOBAL_GL_CD;
    REC_PIPE.IFRS_POSITION:=REC.IFRS_POSITION;
    REC_PIPE.IFRS_POSITION_AGGR:=REC.IFRS_POSITION_AGGR;
    REC_PIPE.IMP_DT:=REC.IMP_DT;
    REC_PIPE.IMP_METHOD_CD:=REC.IMP_METHOD_CD;
    REC_PIPE.INT_COMPEN_CD:=REC.INT_COMPEN_CD;
    REC_PIPE.INTER_IND:=REC.INTER_IND;
    REC_PIPE.INTERCO_IND:=REC.INTERCO_IND;
    REC_PIPE.INTERCO_IND_IFRS:=REC.INTERCO_IND_IFRS;
    REC_PIPE.LOAN_PUR_FAIR_VAL_ADJ_AMT:=REC.LOAN_PUR_FAIR_VAL_ADJ_AMT;
    REC_PIPE.LOCAL_GL_CD:=REC.LOCAL_GL_CD;
    REC_PIPE.LOWEST_LEVEL_UBR_ID:=REC.LOWEST_LEVEL_UBR_ID;
    REC_PIPE.LTD_FEES_TO_PRINCIPAL_AMT:=REC.LTD_FEES_TO_PRINCIPAL_AMT;
    REC_PIPE.MA_CD:=REC.MA_CD;
    REC_PIPE.MA_SPL_NOTE:=REC.MA_SPL_NOTE;
    REC_PIPE.MA_SRC_CD:=REC.MA_SRC_CD;
    REC_PIPE.MA_TYPE_CD:=REC.MA_TYPE_CD;
    REC_PIPE.MAN_LINK_ID:=REC.MAN_LINK_ID;
    REC_PIPE.MASTER_MA_CD:=REC.MASTER_MA_CD;
    REC_PIPE.MATURITY_DT:=REC.MATURITY_DT;
    REC_PIPE.MAX_OUT_AMT:=REC.MAX_OUT_AMT;
    REC_PIPE.MAX_OUT_CCY_CD:=REC.MAX_OUT_CCY_CD;
    REC_PIPE.MTM_AMT:=REC.MTM_AMT;
    REC_PIPE.MTM_AMT_IFRS:=REC.MTM_AMT_IFRS;
    REC_PIPE.MTM_CCY_CD:=REC.MTM_CCY_CD;
    REC_PIPE.MTM_CCY_CD_IFRS:=REC.MTM_CCY_CD_IFRS;
    REC_PIPE.NEW_RISK_PROVISION_AMT:=REC.NEW_RISK_PROVISION_AMT;
    REC_PIPE.NON_PERF_IND:=REC.NON_PERF_IND;
    REC_PIPE.NON_PERF_RCV_INT_AMT:=REC.NON_PERF_RCV_INT_AMT;
    REC_PIPE.OPT_TYPE_CD:=REC.OPT_TYPE_CD;
    REC_PIPE.ORIG_NOTIONAL_AMT:=REC.ORIG_NOTIONAL_AMT;
    REC_PIPE.ORIG_NOTIONAL_CCY_CD:=REC.ORIG_NOTIONAL_CCY_CD;
    REC_PIPE.ORIG_TRN_CD:=REC.ORIG_TRN_CD;
    REC_PIPE.ORIG_TRN_SRC_CD:=REC.ORIG_TRN_SRC_CD;
    REC_PIPE.OTHER_CUR_NOTIONAL_AMT:=REC.OTHER_CUR_NOTIONAL_AMT;
    REC_PIPE.OTHER_CUR_NOTIONAL_CCY_CD:=REC.OTHER_CUR_NOTIONAL_CCY_CD;
    REC_PIPE.OTHER_ORIG_NOTIONAL_AMT:=REC.OTHER_ORIG_NOTIONAL_AMT;
    REC_PIPE.OTHER_ORIG_NOTIONAL_CCY_CD:=REC.OTHER_ORIG_NOTIONAL_CCY_CD;
    REC_PIPE.OVERDUE_AMT:=REC.OVERDUE_AMT;
    REC_PIPE.OVERDUE_CCY_CD:=REC.OVERDUE_CCY_CD;
    REC_PIPE.OVERDUE_DAY_COUNT:=REC.OVERDUE_DAY_COUNT;
    REC_PIPE.PAY_CONTRACT_AMT:=REC.PAY_CONTRACT_AMT;
    REC_PIPE.PAY_CONTRACT_CCY_CD:=REC.PAY_CONTRACT_CCY_CD;
    REC_PIPE.PAY_FWD_AMT:=REC.PAY_FWD_AMT;
    REC_PIPE.PAY_FWD_CCY_CD:=REC.PAY_FWD_CCY_CD;
    REC_PIPE.PAY_INT_INTERVAL:=REC.PAY_INT_INTERVAL;
    REC_PIPE.PAY_INT_RATE:=REC.PAY_INT_RATE;
    REC_PIPE.PAY_INT_RATE_TYPE_CD:=REC.PAY_INT_RATE_TYPE_CD;
    REC_PIPE.PAY_NEXT_FIX_CPN_DT:=REC.PAY_NEXT_FIX_CPN_DT;
    REC_PIPE.PAY_UL_SEC_TYPE_CD:=REC.PAY_UL_SEC_TYPE_CD;
    REC_PIPE.PAY_UL_ISS_CCDB_ID:=REC.PAY_UL_ISS_CCDB_ID;
    REC_PIPE.PAY_UL_MTM_AMT:=REC.PAY_UL_MTM_AMT;
    REC_PIPE.PAY_UL_MTM_CCY_CD:=REC.PAY_UL_MTM_CCY_CD;
    REC_PIPE.PAY_UL_SEC_CCY_CD:=REC.PAY_UL_SEC_CCY_CD;
    REC_PIPE.PAY_UL_SEC_CD:=REC.PAY_UL_SEC_CD;
    REC_PIPE.PCP_TRANSACTION_SK:=REC.PCP_TRANSACTION_SK;
    REC_PIPE.PROD_AREA_UBR_ID:=REC.PROD_AREA_UBR_ID;
    REC_PIPE.QUOTA_PART_AMT:=REC.QUOTA_PART_AMT;
    REC_PIPE.RCV_CONTRACT_AMT:=REC.RCV_CONTRACT_AMT;
    REC_PIPE.RCV_CONTRACT_CCY_CD:=REC.RCV_CONTRACT_CCY_CD;
    REC_PIPE.RCV_FWD_AMT:=REC.RCV_FWD_AMT;
    REC_PIPE.RCV_FWD_CCY_CD:=REC.RCV_FWD_CCY_CD;
    REC_PIPE.RCV_INT_RATE:=REC.RCV_INT_RATE;
    REC_PIPE.RCV_INT_RATE_TYPE_CD:=REC.RCV_INT_RATE_TYPE_CD;
    REC_PIPE.RCV_INT_INTERVAL:=REC.RCV_INT_INTERVAL;
    REC_PIPE.RCV_NEXT_FIX_CPN_DT:=REC.RCV_NEXT_FIX_CPN_DT;
    REC_PIPE.RCV_UL_ISS_CCDB_ID:=REC.RCV_UL_ISS_CCDB_ID;
    REC_PIPE.RCV_UL_MTM_AMT:=REC.RCV_UL_MTM_AMT;
    REC_PIPE.RCV_UL_MTM_CCY_CD:=REC.RCV_UL_MTM_CCY_CD;
    REC_PIPE.RCV_UL_SEC_CCY_CD:=REC.RCV_UL_SEC_CCY_CD;
    REC_PIPE.RCV_UL_SEC_CD:=REC.RCV_UL_SEC_CD;
    REC_PIPE.RCV_UL_SEC_TYPE_CD:=REC.RCV_UL_SEC_TYPE_CD;
    REC_PIPE.REC_SEC_AMT:=REC.REC_SEC_AMT;
    REC_PIPE.REC_SEC_CCY_CD:=REC.REC_SEC_CCY_CD;
    REC_PIPE.REC_UNSEC_AMT:=REC.REC_UNSEC_AMT;
    REC_PIPE.REC_UNSEC_CCY_CD:=REC.REC_UNSEC_CCY_CD;
    REC_PIPE.RECON_CD:=REC.RECON_CD;
    REC_PIPE.RECON_SRC_CD:=REC.RECON_SRC_CD;
    REC_PIPE.RECOV_AMT:=REC.RECOV_AMT;
    REC_PIPE.RECOVERY_FLAG:=REC.RECOVERY_FLAG;
    REC_PIPE.REGULATORY_NET_IND:=REC.REGULATORY_NET_IND;
    REC_PIPE.REL_RISK_PROVISION_AMT:=REC.REL_RISK_PROVISION_AMT;
    REC_PIPE.RESPONSIBLE_BRANCH_CCDB_ID:=REC.RESPONSIBLE_BRANCH_CCDB_ID;
    REC_PIPE.RESPONSIBLE_BRANCH_ID:=REC.RESPONSIBLE_BRANCH_ID;
    REC_PIPE.RESPONSIBLE_BRANCH_LOC_CD:=REC.RESPONSIBLE_BRANCH_LOC_CD;
    REC_PIPE.RESTRUCT_IND:=REC.RESTRUCT_IND;
    REC_PIPE.RISK_END_DT:=REC.RISK_END_DT;
    REC_PIPE.RISK_ENGINES_METHOD_USED:=REC.RISK_ENGINES_METHOD_USED;
    REC_PIPE.RISK_MITIGATING_PCT:=REC.RISK_MITIGATING_PCT;
    REC_PIPE.RISK_PROVISION_BAL_AMT:=REC.RISK_PROVISION_BAL_AMT;
    REC_PIPE.RISK_PROVISION_CCY_CD:=REC.RISK_PROVISION_CCY_CD;
    REC_PIPE.RISK_WRITE_OFF_AMT:=REC.RISK_WRITE_OFF_AMT;
    REC_PIPE.RISK_WRITE_OFF_LIFE_DT_AMT:=REC.RISK_WRITE_OFF_LIFE_DT_AMT;
    REC_PIPE.RT_BUS_AREA_UBR_ID:=REC.RT_BUS_AREA_UBR_ID;
    REC_PIPE.RT_CB_CCDB_ID:=REC.RT_CB_CCDB_ID;
    REC_PIPE.RT_COV_CD:=REC.RT_COV_CD;
    REC_PIPE.RT_COV_SRC_CD:=REC.RT_COV_SRC_CD;
    REC_PIPE.RT_COV_TYPE_CD:=REC.RT_COV_TYPE_CD;
    REC_PIPE.RT_COV_TYPE_CD_IFRS:=REC.RT_COV_TYPE_CD_IFRS;
    REC_PIPE.RT_TYPE_CD:=REC.RT_TYPE_CD;
    REC_PIPE.RT_TYPE_CD_IFRS:=REC.RT_TYPE_CD_IFRS;
    REC_PIPE.SENIORITY:=REC.SENIORITY;
    REC_PIPE.SETTLE_STATUS_ID:=REC.SETTLE_STATUS_ID;
    REC_PIPE.SETTLEMENT_CD:=REC.SETTLEMENT_CD;
    REC_PIPE.SETTLEMENT_DT:=REC.SETTLEMENT_DT;
    REC_PIPE.SOX_REF:=REC.SOX_REF;
    REC_PIPE.SPE_IND:=REC.SPE_IND;
    REC_PIPE.SPL_TREAT_IND_IFRS:=REC.SPL_TREAT_IND_IFRS;
    REC_PIPE.SRC_PROD_TYPE_CD:=REC.SRC_PROD_TYPE_CD;
    REC_PIPE.SRC_PROD_TYPE_CD_IFRS:=REC.SRC_PROD_TYPE_CD_IFRS;
    REC_PIPE.SRC_PROXY_UBR_CD:=REC.SRC_PROXY_UBR_CD;
    REC_PIPE.START_DT:=REC.START_DT;
    REC_PIPE.STRATEGIC_LEND_IND:=REC.STRATEGIC_LEND_IND;
    REC_PIPE.STRIKE_FWD_FUT_PRICE_AMT:=REC.STRIKE_FWD_FUT_PRICE_AMT;
    REC_PIPE.STRIKE_FWD_FUT_PRICE_CCY_CD:=REC.STRIKE_FWD_FUT_PRICE_CCY_CD;
    REC_PIPE.TERMINATION_LOAN_DT:=REC.TERMINATION_LOAN_DT;
    REC_PIPE.TRAD_ASSET_CD_IFRS:=REC.TRAD_ASSET_CD_IFRS;
    REC_PIPE.TRADE_DT:=REC.TRADE_DT;
    REC_PIPE.TRADE_ENTITY_CCDB_ID:=REC.TRADE_ENTITY_CCDB_ID;
    REC_PIPE.TRADE_ENTITY_LOC_CD:=REC.TRADE_ENTITY_LOC_CD;
    REC_PIPE.TRADE_RELATED_IND:=REC.TRADE_RELATED_IND;
    REC_PIPE.TRADE_STATUS:=REC.TRADE_STATUS;
    REC_PIPE.TRADING_ENTITY_LOC_CD:=REC.TRADING_ENTITY_LOC_CD;
    REC_PIPE.TRAN_MATCH_CD:=REC.TRAN_MATCH_CD;
    REC_PIPE.TRN_CD:=REC.TRN_CD;
    REC_PIPE.TRN_LINK_CD:=REC.TRN_LINK_CD;
    REC_PIPE.TRN_SRC_CD:=REC.TRN_SRC_CD;
    REC_PIPE.TRN_TYPE_CD:=REC.TRN_TYPE_CD;
    REC_PIPE.TRN_VERSION:=REC.TRN_VERSION;
    REC_PIPE.UL_DELIVERY_DT:=REC.UL_DELIVERY_DT;
    REC_PIPE.UL_MATURITY_DT:=REC.UL_MATURITY_DT;
    REC_PIPE.UNDLY_ISS_NAME:=REC.UNDLY_ISS_NAME;
    REC_PIPE.UNEARNED_INCOME_CCY_CD:=REC.UNEARNED_INCOME_CCY_CD;
    REC_PIPE.UNEARNED_INCOME_DIS_LOAN_AMT:=REC.UNEARNED_INCOME_DIS_LOAN_AMT;
    REC_PIPE.US_GAAP_POSITION_AGGR:=REC.US_GAAP_POSITION_AGGR;
    REC_PIPE.VALUATION_DT:=REC.VALUATION_DT;
    REC_PIPE.XCHG_CTRY_CD:=REC.XCHG_CTRY_CD;
    REC_PIPE.YEAR01_NOTIONAL_AMT:=REC.YEAR01_NOTIONAL_AMT;
    REC_PIPE.YEAR02_NOTIONAL_AMT:=REC.YEAR02_NOTIONAL_AMT;
    REC_PIPE.YEAR03_NOTIONAL_AMT:=REC.YEAR03_NOTIONAL_AMT;
    REC_PIPE.YEAR04_NOTIONAL_AMT:=REC.YEAR04_NOTIONAL_AMT;
    REC_PIPE.YEAR05_NOTIONAL_AMT:=REC.YEAR05_NOTIONAL_AMT;
    REC_PIPE.YEAR06_NOTIONAL_AMT:=REC.YEAR06_NOTIONAL_AMT;
    REC_PIPE.YEAR07_NOTIONAL_AMT:=REC.YEAR07_NOTIONAL_AMT;
    REC_PIPE.YEAR08_NOTIONAL_AMT:=REC.YEAR08_NOTIONAL_AMT;
    REC_PIPE.YEAR09_NOTIONAL_AMT:=REC.YEAR09_NOTIONAL_AMT;
    REC_PIPE.YEAR10_NOTIONAL_AMT:=REC.YEAR10_NOTIONAL_AMT;
    REC_PIPE.YTD_PL_TRADE_AMT:=REC.YTD_PL_TRADE_AMT;
    REC_PIPE.FCL_VALIDATED_IND:=REC.FCL_VALIDATED_IND;
    REC_PIPE.FCL_EXCLUDED_IND:=REC.FCL_EXCLUDED_IND;
    REC_PIPE.FCL_SOURCE_SYSTEM:=REC.FCL_SOURCE_SYSTEM;
    REC_PIPE.FCL_CREATE_TIMESTAMP:=REC.FCL_CREATE_TIMESTAMP;
    REC_PIPE.FCL_UPDATE_TIMESTAMP:=REC.FCL_UPDATE_TIMESTAMP;
    REC_PIPE.FCL_TRADE_LOAD_DATE:=REC.FCL_TRADE_LOAD_DATE;
    REC_PIPE.FCL_VALUATION_LOAD_DATE:=REC.FCL_VALUATION_LOAD_DATE;
    REC_PIPE.FCL_MATRIX_TRADE_TYPE:=REC.FCL_MATRIX_TRADE_TYPE;
    REC_PIPE.PCP_GCDS_REVISION:=REC.PCP_GCDS_REVISION;
    REC_PIPE.FCL_UTP_BOOK_CD:=REC.FCL_UTP_BOOK_CD;
    REC_PIPE.FCL_MIS_RISK_BOOK_CD:=REC.FCL_MIS_RISK_BOOK_CD;
    REC_PIPE.ALD_STATUS:=REC.ALD_STATUS;
    REC_PIPE.FCAT_OPERATION:=REC.FCAT_OPERATION;
    REC_PIPE.INTERNAL_INTRA_IND_IFRS:=REC.INTERNAL_INTRA_IND_IFRS;
    REC_PIPE.FCL_USAGE_IND:=REC.FCL_USAGE_IND;
    REC_PIPE.QUICK:=REC.QUICK;
    REC_PIPE.SEDOL:=REC.SEDOL;
    REC_PIPE.CUSIP:=REC.CUSIP;
    REC_PIPE.ISIN:=REC.ISIN;
    REC_PIPE.QUANTITY:=REC.QUANTITY;
    REC_PIPE.RIC:=REC.RIC;
    REC_PIPE.DESCRIPTION:=REC.DESCRIPTION;
    REC_PIPE.RESET_DATE:=REC.RESET_DATE;
    REC_PIPE.PRICE:=REC.PRICE;
    REC_PIPE.EXCHANGERATE:=REC.EXCHANGERATE;
    REC_PIPE.PARA_PROD_TYPE_ID:=REC.PARA_PROD_TYPE_ID;
    REC_PIPE.EFF_INT_RATE:=REC.EFF_INT_RATE;
    REC_PIPE.ORIG_FEE_UNREALISED_AMT:=REC.ORIG_FEE_UNREALISED_AMT;
    REC_PIPE.ASSET_TYPE:=REC.ASSET_TYPE;
    REC_PIPE.IMP_IND_IFRS:=REC.IMP_IND_IFRS;
    REC_PIPE.NOT_AMT_REDEMPTION_TO_1YR:=REC.NOT_AMT_REDEMPTION_TO_1YR;
    REC_PIPE.NOT_AMT_REDEMPTION_TO_5YR:=REC.NOT_AMT_REDEMPTION_TO_5YR;
    REC_PIPE.NOT_AMT_REDEMPTION_OVER_5YR:=REC.NOT_AMT_REDEMPTION_OVER_5YR;
    REC_PIPE.CASH_LTD:=REC.CASH_LTD;
    REC_PIPE.CASH_LTD_CCY:=REC.CASH_LTD_CCY;
    REC_PIPE.FCL_FACILITY_SK:=REC.FCL_FACILITY_SK;
    REC_PIPE.DILUTION_RISK_CRITERIA:=REC.DILUTION_RISK_CRITERIA;
    REC_PIPE.FCL_RMS_RUNID:=REC.FCL_RMS_RUNID;
    REC_PIPE.BSTYPE:=REC.BSTYPE;
    REC_PIPE.YTD_ACCR_DIV:=REC.YTD_ACCR_DIV;
    REC_PIPE.YTD_DIV:=REC.YTD_DIV;
    REC_PIPE.ACC_ADJ_YTD:=REC.ACC_ADJ_YTD;
    REC_PIPE.FV_RLZD_PL:=REC.FV_RLZD_PL;
    REC_PIPE.ITD_PL:=REC.ITD_PL;
    REC_PIPE.YTD_RLZD_PL:=REC.YTD_RLZD_PL;
    REC_PIPE.YTD_UNRLZD_PL:=REC.YTD_UNRLZD_PL;
    REC_PIPE.TRN_BAS_LGD:=REC.TRN_BAS_LGD;
    REC_PIPE.TRAD_YTD_RLZD_PL:=REC.TRAD_YTD_RLZD_PL;
    REC_PIPE.TRAD_YTD_UNRLZD_PL:=REC.TRAD_YTD_UNRLZD_PL;
    REC_PIPE.UNADJUSTED_PV:=REC.UNADJUSTED_PV;
    REC_PIPE.UNADJUSTED_REALISED_PL:=REC.UNADJUSTED_REALISED_PL;
    REC_PIPE.UNADJUSTED_UNREALISED_PL:=REC.UNADJUSTED_UNREALISED_PL;
    REC_PIPE.GRC_PROD_TYPE_ID:=REC.GRC_PROD_TYPE_ID;
    REC_PIPE.GRC_PROD_TYPE_ID_IFRS:=REC.GRC_PROD_TYPE_ID_IFRS;
    REC_PIPE.CUR_FEE:=REC.CUR_FEE;
    REC_PIPE.SEC_IND:=REC.SEC_IND;
    REC_PIPE.INVEST_ASSETS_PORT:=REC.INVEST_ASSETS_PORT;
    REC_PIPE.RISK_PROVISION_START_BAL_AMT:=REC.RISK_PROVISION_START_BAL_AMT;
    REC_PIPE.GEN_RISK_PRV_START_BAL_AMT:=REC.GEN_RISK_PRV_START_BAL_AMT;
    REC_PIPE.GEN_RISK_PROVISION_NEW:=REC.GEN_RISK_PROVISION_NEW;
    REC_PIPE.GEN_RISK_PROVISION_REL:=REC.GEN_RISK_PROVISION_REL;
    REC_PIPE.ACQUIRED_IND:=REC.ACQUIRED_IND;
    REC_PIPE.CRED_NET_MNA:=REC.CRED_NET_MNA;
    REC_PIPE.SEC_IFRS_VUE_ADJ:=REC.SEC_IFRS_VUE_ADJ;
    REC_PIPE.YEAR00_NOTIONAL_AMT:=REC.YEAR00_NOTIONAL_AMT;
    REC_PIPE.MAX_OVERDUE_DAYS:=REC.MAX_OVERDUE_DAYS;
    REC_PIPE.MIS_CD:=REC.MIS_CD;
    REC_PIPE.MULTINAME_POOL_SK:=REC.MULTINAME_POOL_SK;
    REC_PIPE.MULTINAME_CHUNK_REVISION_SK:=REC.MULTINAME_CHUNK_REVISION_SK;
    REC_PIPE.MTRX_CALC_CNTRL_EPE:=REC.MTRX_CALC_CNTRL_EPE;
    REC_PIPE.MTRX_CALC_CNTRL_PFE:=REC.MTRX_CALC_CNTRL_PFE;
    REC_PIPE.FCL_TE_VALIDATED_IND:=REC.FCL_TE_VALIDATED_IND;
    REC_PIPE.PCP_TE_DYNAMIC_KEY:=REC.PCP_TE_DYNAMIC_KEY;
    REC_PIPE.AVG_COST:=REC.AVG_COST;
    REC_PIPE.SEC_LONG_NAME:=REC.SEC_LONG_NAME;
    REC_PIPE.ISS_CTRY_CD:=REC.ISS_CTRY_CD;
    REC_PIPE.RISK_REPORTING_UBR:=REC.RISK_REPORTING_UBR;
    REC_PIPE.RISK_COVERING_BRANCH_CCDB:=REC.RISK_COVERING_BRANCH_CCDB;
    REC_PIPE.CLEARING_STATUS:=REC.CLEARING_STATUS;
    REC_PIPE.FCL_CPTY_SK:=REC.FCL_CPTY_SK;
    REC_PIPE.STRGRP:=REC.STRGRP;
    REC_PIPE.OPEN_ENDED_FLAG:=REC.OPEN_ENDED_FLAG;
    REC_PIPE.AVAILABILITY_IND:=REC.AVAILABILITY_IND;
    REC_PIPE.ESCRW_FLG:=REC.ESCRW_FLG;
    REC_PIPE.ESTABLISHED_RELP_FLG:=REC.ESTABLISHED_RELP_FLG;
    REC_PIPE.GOV_GTY_AMT:=REC.GOV_GTY_AMT;
    REC_PIPE.BUBA_CTRY_ID:=REC.BUBA_CTRY_ID;
    REC_PIPE.GOV_GTY_CTRY_CD:=REC.GOV_GTY_CTRY_CD;
    REC_PIPE.INTERNET_DPST_FLG:=REC.INTERNET_DPST_FLG;
    REC_PIPE.LAST_ACTIVITY_DT:=REC.LAST_ACTIVITY_DT;
    REC_PIPE.NOTICE_PERIOD_QTY:=REC.NOTICE_PERIOD_QTY;
    REC_PIPE.OPR_RELP_FLG:=REC.OPR_RELP_FLG;
    REC_PIPE.SIG_WD_PENALTY_FLG:=REC.SIG_WD_PENALTY_FLG;
    REC_PIPE.TRN_ACT_FLG:=REC.TRN_ACT_FLG;
    PIPE ROW(REC_PIPE);
    END LOOP;
    the Stored procedre returns REC_PIPE.
    I thins this could be not efficient enough...
    What do you think?

  • How to view the returned data from a stored procedure in TOAD?

    Hi,
    I created ref cursor in the stored procedure to return data. The stored procedure works fine, just want to view the result in TOAD. The BEGIN... EXEC... END can execute the stored procedure, but how to make the result display?
    Thanks!

    Right click the editor and choose
    "Prompt For Substitution Variables".
    Run for example the following code:
    DECLARE
    PROCEDURE p (cur OUT sys_refcursor)
    AS
    BEGIN
    OPEN cur FOR
    SELECT *
    FROM DUAL;
    END p;
    BEGIN
    p (:cur);
    END;
    The result will display in Toad's Data Grid!
    Regards Michael

  • Use return date value in stored procedure

    hi
    i am new in oracle , i make stored procedure to fetch data in the form and i make calendar , i want user when they select a date from date LOV the stored procedure use this date in the query.. i try like this in the query:
    when time=:blok.date_item;
    but i get IN OUT error in the procedure.
    any help will be appreciated.

    ok this is the package header:
    create or replace package get_outvalue_test is
    type rec is record (time archive.time%type,
    value archive%type);
    type value_tab is table of rec index by binary_integer;
    procedure get_value(p_returnvalue IN OUT value_tab);
    end;
    package body :
    create or replace package body get_outvalue_test is
    procedure get_value(p_returnvalue IN OUT value_tab)
    is
    ii number;
    cursor valselect is
    select time,value from archive where u_id=5666
    and time=:block.date_item ; -- this is the return date from LOV
    begin
    open valselect;
    ii:=1
    loop
    fetch valselect into
    p_returnvalue(ii).time;
    p_returnvalue(ii).value;
    exite when valselect %notfound;
    ii:=ii+1;
    end loop;
    end;
    end;
    this is the error when i compile the package body :
    MIssing IN or OUT parameter at index
    i hope itis cleare and easy .

  • Pass a date parameter to Stored Procedure

    Hello friends,
    Can you help to pass a date parameter to Stored procedure from JSP. This is my code:
    In Oracle 9i I have this:
    PROCEDURE SP_EDORES(
    pfechaini IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field
    pfechafin IN hist_pol_reclama.hrc_fecha_contabilidad%Type, <-- This is a date field
    p_recordset OUT PKG_REP_CIERRE.cursor_type) AS
    In JSP have this:
    CallableStatement stmt = (CallableStatement)conn.prepareCall( "begin PKG_REP_CIERRE.SP_EDORES(?,?,?); end;" );
    stmt.registerOutParameter(3,oracle.jdbc.driver.OracleTypes.CURSOR);
    stmt.setDate(1,Date.valueOf("01-06-2005"));
    stmt.setDate(2,Date.valueOf("30-06-2005"));
    ResultSet rset = (ResultSet)stmt.getObject(3);
    while (rset.next()) {
    %>
    <TR>
    <TD ALIGN=CENTER> <%= rset.getString(1) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getString(2) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getString(3) %> </TD>
    <TD ALIGN=CENTER> <%= rset.getInt(4) %> </TD>
    </TR>
    <%
    The Stored Procedure returns de Result set, however I think does not recognized the date format because I need it with this format dd-mm-yyyy.
    Thanks in advance

    to use Date you will need the oracle package.
    u can try this other solution: use String, not Date
    CallableStatement stmt = (CallableStatement)conn.prepareCall( "begin PKG_REP_CIERRE.SP_EDORES(?,?,?); end;" );
    stmt.registerOutParameter(3,oracle.jdbc.driver.OracleTypes.CURSOR);
    stmt.setString(1,"01-06-2005");
    stmt.setString(2,"30-06-2005");
    ResultSet rset = (ResultSet)stmt.getObject(3);
    while (rset.next()) {
    %>
    if this don't work you can change your PL/SQL to get Strings and do the conversion with TO_DATE in the sql statement.

  • Passing data from Oracle stored procedures to Java

    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.

    user1754151 wrote:
    We're going to write a new web interface for a big system based on Oracle database. All business rules are already coded in PL/SQL stored procedures and we'd like to reuse as much code as possible. We'll write some new stored procedures that will combine the existing business rules and return the final result dataset.
    We want to do this on the database level to avoid java-db round trips. The interface layer will be written in Java (we'd like to use GWT), so we need a way of passing data from Oracle stored procedures to Java service side. The data can be e.g. a set of properties of a specific item or a list of items fulfilling certain criteria. Would anyone recommend a preferable way of doing this?
    We're considering one of the 2 following scenarios:
    passing objects and lists of objects (DB object types defined on the schema level)
    passing a sys_refcursor
    We verified that both approaches are "doable", the question is more about design decision, best practice, possible maintenance problems, flexibility, etc.
    I'd appreciate any hints.If logic is already written in DB, and the only concern is of passing the result to java service side, and also from point of maintenance problem and flexibility i would suggest to use the sys_refcursor.
    The reason if Down the line any thing changes then you only need to change the arguments of sys_refcursor in DB and as well as java side, and it is much easier and less efforts compare to using and changes required for Types and Objects on DB and java side.
    The design and best practise keeps changing based on our requirement and exisiting design. But by looking at your current senario and design, i personally suggest to go with sys_refcursor.

  • Read data from a Stored Procedure in Android

    I have a Stored Procedure say CustOrdersDetail. I have created a MBO for it in the workspace and deployed it on SAP Mobile Server. I am unable to read data from the stored procedure in code of the Android Application. If I pass a default load argument, then I am able to read data using findAll method. How to get the data from the stored procedure by passing it an argument in the Android Code ?
    Message was edited by: Abhijit Kadam

    Currently I am trying to call the stored procedure and retrieve the results. The stored procedure accepts 'orderId' as an argument and fetches the Product and Order Details.

  • Date/Time Format Stored Procedure Calls in ADVANCE MODE in JDBC ADAPTER

    Hi Experts,
    What is significance of Date/Time Format Stored Procedure Calls in ADVANCE MODE in JDBC ADAPTER.
    Thanks,
    ABDUR

    I guess this would be applicable for the folowing formats - DATE, TIME, TIMESTAMP.
    This is the correct link
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
    Regards,
    Prateek

  • How to work on Data Analysis using Stored procedures

    How to work on Data Analysis using Stored procedures any suggestions 

    Carefully?  Precisely?  Tomorrow?  Your question has no context so it means little to an outside reader. Perhaps you should start with some basic research into the data mining features of sql server:
    data mining homepage

  • Stored Procedure fails to return all rows of data.

    Our HR database uses a procedure to build a list of employee IDs (ie. 1,3,14,...1210,1215) then calls a procedure to with a variable to extract details per employee. Unfortunately the list is 947 ids, however only 887 rows are returned.
    As a test I split the list in two and called the procedure. If I add the data rows together I get 947, hence I know the employees are valid. Can anyone suggest why a long list of Ids should fail? Is there a limit a stored procedure can return?
    The procedure (simplified down a bit) is:
    ALTER PROCEDURE [dbo].[sp_Employee_CreateTable]
     @EmpIds varchar(4000)
    AS
    SELECT    E.empid as EmpId ,E.Surname
        FROM    Employee E
        WHERE  (E.[EmpID] IN (select * from GetAllUsersUnderManager(@EmpIds))) AND EJ.id=dbo.GetCurrentEmployeeJobRecord(EJ.empid)--EJ.dateto IS NULL
    I can run the procedure as:
    "exec sp_Employee_CreateTable @EmpIds=N'1,3,14.....999'" which returns (say) 700 rows  and  "exec sp_Employee_CreateTable @EmpIds=N'1001,.....1215'" which returns 247 rows. (ie. 700+247 = 947 which is correct.
    But exec sp_Employee_CreateTable @EmpIds=N'1,3,14......1215' only returns 887 rows.
    I have looked at the length of the data passed to the procedure (1,3,...1215) which equals 4126 chars, therefore I bumped the varchar space from 4,000 to 6,000 which is still within limits, however the number of rows returned was still 887.
    Any help would be gratefully received.

    Hi Scott. I run the script you suggested (thank you), the var EmpIds was set to a string with over 930 ids. The returned data set started with 0 but only had 888 rows. As mentioned above I refer the 930+ list as full list, and the 888 as the short list.
    The difference (around 47) were the last values in the full list.
    Although EmpIds was set to 6K it definately seems like it gets to around 4K chars then ignores any other values.
    Re "since you pass....". Absolutely. I have modified the Employee_CreateTable with the var update to 6K/
    ALTER PROCEDURE [dbo].[sp_Employee_CreateTable]
     @EmpIds varchar(6000),
     @IncludeLeavers Bit
    AS
        SELECT    E.empid as EmpId ,E.Surname, E.Firstname as Forename,E.PayrollID, E.intextno as Extension, EJ.position as Position, [dbo].[GetEmployeeDepartment](E.empid) as Department, [dbo].[GetEmployeeLocation](E.empid) as Location,
    E.title as Title, EJ.ReportsTo,
                CoEmail,E.[left]
        FROM    Employee E INNER JOIN EmployeeJobs EJ
        ON        E.empid = EJ.empid
        WHERE  (E.[EmpID] IN (select * from GetAllUsersUnderManager(@EmpIds))) AND EJ.id=dbo.GetCurrentEmployeeJobRecord(EJ.empid)--EJ.dateto IS NULL
                AND (E.[left]=0 or E.[left]=@IncludeLeavers)
        ORDER BY E.Surname, E.Firstname, E.empid

  • Query executed within a plug-in script returns 0 rows, although data exists

    I created a plug-in script for algorithm entity: Service Quantity Rule.
    The script calls a business service that I created using query zones. The query returns the values of the bill segment (ci.bseg.bseg_id and ci_bseg.closing_bseg_sw) that is created while running a bill manually. The zone receives the bseg_id as a parameter.
    The problem is that when I execute the business service within the plug-in script the business services returns 0 rows even though the data is actually being stored in the database.
    The script calculates some SQI values and saves it to the bill segment based on a response that is received from MDM (I'm using the usage request object).
    Steps:
    1.- Create Bill. The bill segment is created in error as it is waiting for the bill determinants to be sent from the MDM. If I test the zone with the bseg_id (as a parameter) of the newly created bill segment it works fine.
    2.- We send a message from the MDM to CC&B. The message is received and processed and it gets to a point when the usage updates the bill segment.
    3.- After the bill segment has been updated with the values from the usage request object it starts executing the plug-in script.
    4.- I obtain the bseg_id from the usage request and use the business service (passing the bseg_id as a parameter) and it returns no result.
    5.- The process finishes and if test the zone with the bseg_id (as a paramter) of the billing segment it works fine.
    So apparently during the execution of the script after the billing determinants are received from MDM I can't have access to the Bill segment that was created, even if the physically the record exists in the database (CI_BSEG).
    I also tried instantiating an object related with the bill segment and got the same result.
    Any idea or clue of what is happening?

    Could you be more explicit.
    What CC&B version?
    What MDM version?
    More details are required for:
    2.- We send a message from the MDM to CC&B. The message is received and processed and it gets to a point when the usage updates the bill segment.
    3.- After the bill segment has been updated with the values from the usage request object it starts executing the plug-in script.
    4.- I obtain the bseg_id from the usage request and use the business service (passing the bseg_id as a parameter) and it returns no result.

  • The ways to return data from a stored procedure.

    Hi, I know there are three ways to pass out a value from a Microsoft SQL stored procedure, but I have no clear idea what Oracle SP can do, I know Oracle doesn't support multi-recordset(v8), can not return a recordset by a inner select query, but I do know there is a cursor object, which doesn't like its counterpart in Microsoft SQL server, is a choice under most situation. Here I wonder anyone who is good at Oracle can give a list of all ways to return data from a SP, including example is more better, thanks.

    Here is a way to get return a record from a function and a procedure. You need to be familiar with Oracle packages as well as stored procedures and functions:
    CREATE OR REPLACE PACKAGE EmpPkg AS
    cursor cEmp(pEmpno in number) is
    select empno, ename, job, hiredate, sal
    from emp
    where empno = pEmpno;
    FUNCTION GetEmployee(pnEmpNo in number) RETURN cEmp%rowtype;
    PROCEDURE GetEmployee(pnEmpNo in number, prEmp out cEmp%rowtype);
    END;
    CREATE OR REPLACE PACKAGE BODY EmpPkg AS
    FUNCTION GetEmployee(pnEmpNo in number) RETURN cEmp%rowtype IS
    rEmp cEmp%rowtype;
    BEGIN
    open cEmp(pnEmpNo);
    fetch cEmp into rEmp;
    close cEmp;
    return rEmp;
    END;
    PROCEDURE GetEmployee(pnEmpNo in number, prEmp out cEmp%rowtype) IS
    BEGIN
    open cEmp(pnEmpNo);
    fetch cEmp into prEmp;
    close cEmp;
    END;
    END;
    Here's how you use the package:
    DECLARE
    rEmp EmpPkg.cEmp%rowtype;
    BEGIN
    rEmp := EmpPkg.GetEmployee(7782);
    dbms_output.put_line(rEmp.ename);
    EmpPkg.GetEmployee(7902, rEmp);
    dbms_output.put_line(rEmp.ename);
    END;
    Note that you can return any Oracle data type from a function. Likewise, you can specify any Oracle data type as an out parameter in a procedure. Also, you can make a parameter both an in and an out datatype like this:
    PROCEDURE GetEmployee(pnEmpNo in out number);
    I hope this puts you in the right direction.
    null

  • [b]Fill a DataGrid with the returned data of a Stored Procedure[/b]

    Hi
    I'm trying to use a stored procedure that returns data from the table tab_proc1 and a DataGrid that will display the results.
    Any help would be appreciated.
    bebop
    created the following in MS SQL Server:
    a table:
    create table tab_proc1 (col1 char(10), col2 char(10))
    a stored procedure:
    create procedure sp_test1
    as
    select * from tab_proc1
    Code I'm using:
    using System.Data;
    using System.Data.SqlClient;
    namespace spapc
         /// <summary>
         /// Summary description for WebForm1.
         /// </summary>
         public class WebForm1 : System.Web.UI.Page
              protected System.Web.UI.WebControls.DataGrid DataGrid1;
              protected System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
              protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;
              protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;
              protected System.Data.SqlClient.SqlConnection sqlConnection1;
              protected sptempdbTEST.DataSet1 dataSet11;
              protected System.Web.UI.WebControls.Button Button1;
              private void Page_Load(object sender, System.EventArgs e)
         //sqlDataAdapter1.Fill(dataSet11);
              //Page.DataBind();
    private void Button1_Click(object sender, System.EventArgs e)
    SqlConnection conn = new SqlConnection("server=localhost;database=apc;uid=ty;pwd=");
    try
         conn.Open();
         SqlCommand cmd = new SqlCommand("sp_test1", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         //cmd.CommandText = "sp_test1";
         SqlDataAdapter myadapter =new SqlDataAdapter();
         myadapter.SelectCommand = cmd;
         myadapter.Fill(dataSet11);
         //DataGrid1.DataSource=dataSet11.Tables("tab_proc1");
         DataGrid1.DataSource = cmd.ExecuteReader();
         DataGrid1.DataBind();
    catch (SqlException ex)
         finally
         conn.Close();

    Why are you posting to an Oracle site when you are using MS SQL Server? This is a discussion forum for ODP.NET which stand for ORACLE Data Provider for .NET. Not MS SQL Data Provider for .NET!!

  • How to view the returned data from a stored procedure?

    Hi,
    I created ref cursor in the stored procedure to return data. But how can I view the data when I execute it? The stored procedure works fine, just want to view the result.
    Thanks!

    SQL>set serveroutput on size 100000;
    SQL>set autoprint on
    SQL>variable cv refcursor;
    SQL>exec proc_name(param1,:cv);

  • SQL Server 2008 R2 - Report Builder 3.0 - timeout using shared data source and stored procedure

    I select the shared datasource from the data source propeties dialog, test the connection and everything is good.
    I add a dataset by selecting "use a dataset embedded in my report" option within the Dataset properties dialog.
    I select the newly added data source, click the "Stored procedure" query type and drop down the list box and select my intended stored procedure.
    the timeout for the dataset is "0" seconds.
    I click the "OK" button and I'm presented with the parameters to the stored procedure.
    I enter valid data for the parameters and click the "OK" button.
    I then get the following error message after 30 seconds:
    The problem is, all of the timeouts, that I'm aware of, have values of zero (no timeout) or high enough values that 30 seconds isn't even close to the timeout.
    I think the smallest timeout we have is 120 seconds.
    I have searched this site and many others and the solutions all involve altering the stored procedure to get the fields into report builder and then revert the stored procedure back to its original form.
    To me, this is NOT a solution.  
    I have too many stored procedures that need to be brought into Report Builder.
    I need a real solution.
    Thank you for you time, Tim Caldwell.
    Timothy E Caldwell

    I don't mean to be rude, but really, check to see if the stored procedure can return data rows???
    Maybe I'm not being clear enough.
    The stored procedure runs perfectly fine.
    it runs perfectly fine in the production environment and the test environment.
    I can access the stored procedure in several ways and have it return correct data.
    I can even trick report builder into creating a dataset with parameters and run the stored procedure that way.
    What I cannot do, is to get report builder to not timeout after 30 seconds on the initial creation of a dataset with a Query type of stored procedure.
    I have seen this issues posted again and again and again on may different sites and the "solution" is to simplifiy the stored procedure by creating a stored procedure that has a create table and a select in the stored procedure and that's it.  After
    report builder creates the dataset the developer then has to replace the simplified stored procedure with the actual stored procedure and everything works fine after that.
    HOWEVER, having to go through this process for 70 or more stored procedures is ridiculous.
    It would appear that there is something within report builder itself that is causing this issue.
    The SQL Script included is an example of a stored procedure that will not create fields create a dataset with fields and parameters in Report Builder 3.0:
    USE [CRUM_IT]
    GO
    /****** Object: StoredProcedure [dbo].[COGNOS_Level5ScriptSP] Script Date: 11/17/2014 08:02:26 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER procedure [dbo].[COGNOS_Level5ScriptSP]
    @CompanyCode varchar(8) = null,
    @GetSiblings varchar(1) = 'N'
    as
    Begin
    -- get emergency contact info
    select *
    into #tmp_Contacts
    from
    (select
    ConEEID,
    con.connamelast as [Emer Contact Last Name],
    con.connamefirst as [Emer Contact First Name],
    con.connamemiddle as [Emer Contact Middle Initial/Name]--,
    ,ROW_NUMBER() over (Partition by ConEEID order by ConNameLast)as rn
    ,ISNULL(
    case when con.conphonepreferred = 'H'
    then '(' + substring(con.conphonehomenumber, 1, 3) + ')' + substring(con.conphonehomenumber, 4, 3) + '-' + substring(con.conphonehomenumber, 7, 4)
    else '(' + substring(con.conphoneothernumber , 1, 3) + ')' + substring(con.conphoneothernumber , 4, 3) + '-' + substring(con.conphoneothernumber , 7, 4)
    end,
    ) as [Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.Contacts con
    where con.ConIsEmergencyContact='y'
    and con.ConIsActive='y'
    ) A
    where A.rn = 1
    CREATE TABLE #tmp_CompanyCodes (CompanyCode varchar(8))
    If @GetSiblings = 'Y'
    Begin
    INSERT INTO #tmp_CompanyCodes (CompanyCode)
    EXEC [z_GetClientNumbers_For_ParentOrg_By_ClientNumber] @CompanyCode
    End
    INSERT INTO #tmp_CompanyCodes
    values (@CompanyCode)
    select *
    into #tmp_Company
    from [ultiprosqlprod1].[ultipro_crum].dbo.Company
    where cmpcompanycode in (select CompanyCode from #tmp_CompanyCodes)
    select distinct
    cmpcompanycode as [Client ID],
    CmpCompanyDBAName as [Client Name],
    eec.eecEmplStatus AS [Employment Status],
    eec.eecEmpNo AS [Employee Num],
    rtrim(eep.eepNameLast) AS [Last Name],
    rtrim(eep.eepNameFirst) AS [First Name],
    isnull(rtrim(ltrim(eep.eepNameMiddle)), '') AS [Middle Initial/Name],
    rtrim(eep.eepAddressLine1) AS [Address Line 1],
    isnull(rtrim(eep.eepAddressLine2), '') AS [Address Line 2],
    eep.eepAddressCity AS [City],
    eep.eepAddressState AS [State],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 1, 5)
    ELSE rtrim(eep.eepAddressZipCode)
    END AS [Zip code],
    CASE
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) = 0
    THEN substring(eep.eepAddressZipCode, 6, 4)
    WHEN len(eep.eepAddressZipCode) > 5 and charindex(eep.eepAddressZipCode, '-', 1) > 0
    THEN substring(eep.eepAddressZipCode, charindex(eep.eepAddressZipCode, '-', 1) + 1, 4)
    WHEN len(eep.eepAddressZipCode) <= 5
    THEN ''
    END AS [ZIP + 4],
    substring(eep.eepSSN, 1, 3) + '-' + substring(eep.eepSSN, 4, 2) + '-' + substring(eep.eepSSN, 6, 4) AS [SSN],
    isnull(convert(VARCHAR(10), eep.eepDateOfBirth, 101), '') AS [Date Of Birth],
    eetFED.TAXCODE AS [FED Tax Code],
    eetFED.FILINGSTATUS AS [Fed Filing Status],
    eetFED.EXEMPTIONS AS [Fed Exemption Allowance],
    eetFED.ADDITIONAL AS [Additional Fed Withholding],
    eetSIT.TAXCODE AS [SIT Tax Code],
    eetSIT.FILINGSTATUS AS [State Filing Status],
    eetSIT.EXEMPTIONS AS [State Exemption Allowance],
    eetSIT.ADDITIONAL AS [Additional State Withholding],
    isnull('(' + substring(eep.eepPhoneHomeNumber, 1, 3) + ')' + substring(eep.eepPhoneHomeNumber, 4, 3) + '-' + substring(eep.eepPhoneHomeNumber, 7, 4), '') AS [Home Phone],
    isnull((SELECT cod.codDesc
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.Codes cod WITH (NOLOCK)
    WHERE cod.codCode = eep.eepEthnicID
    AND cod.codDosTable = 'ETHNICCODE'), '') AS [Race-Origin], --eep.eepEthnicID AS [Race-Origin],
    eep.eepGender AS [Gender],
    isnull(convert(VARCHAR(10), eec.eecDateOfOriginalHire, 101), '') AS [Original Hire Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfSeniority, 101), '') AS [Seniority Date],
    isnull(convert(VARCHAR(10), eec.eecDateOfTermination, 101), '') AS [Termination Date],
    isnull(eecTermType,'') as [Termination Type],
    isnull(TchDesc, '') as [Termination Reason],
    rtrim(eec.eecJobCode) AS [WC Code],
    isnull(eec.eecJobTitle, '') AS [Job Title],
    pgr.pgrPayFrequency AS [Pay Frequency],
    eec.eecFullTimeOrPartTime AS [Full/Part Time],
    eec.eecSalaryOrHourly AS [Pay Type],
    isnull(convert(MONEY, eec.eecHourlyPayRate), 0.00) AS [Hourly Rate],
    isnull(eec.eecAnnSalary, 0.00) AS [Annual Salary],
    [YTD Hours],
    isnull(eep.eepNameFormer, '') AS [Maiden Name],
    eec.eecLocation AS [Location ID],
    rtrim(eec.eecOrgLvl1) AS [Department ID],
    eec.eecorglvl2 AS [Cost Item],
    eec.eecorglvl3 as [Client Project],
    eec.eecPayGroup as [Pay Group],
    isnull(eepAddressEMail,' ') as [Email Address],
    isNull(BankName1,' ') as PrimaryBank,
    isNull(BankRoute1,' ') as PrimaryRouteNum,
    isNull(Account1,' ') as PrimaryAccount,
    isNull(AcctType1,' ') as PrimaryAcctType,
    isNull(DepositRule1,' ') as PrimaryDepositRule,
    isNull(BankName2,' ') as SecondaryBank,
    isNull(BankRoute2,' ') as SecondaryRouteNum,
    isNull(Account2,' ') as SecondaryAccount,
    isNull(AcctType2,' ') as SecondaryAcctType,
    isNull(DepositRule2,' ') as SecondaryDepositRule,
    isNull(
    CASE
    WHEN DepositRule2 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct2 AS decimal(10,2)))
    WHEN DepositRule2 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct2*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as SecondaryDepositAmount,
    isNull(BankName3,' ') as ThirdBank,
    isNull(BankRoute3,' ') as ThirdRouteNum,
    isNull(Account3,' ') as ThirdAccount,
    isNull(AcctType3,' ') as ThirdAcctType,
    isNull(DepositRule3,' ') as ThirdDepositRule,
    isNull(
    CASE
    WHEN DepositRule3 = 'D'
    THEN '$' + convert(varchar, cast(EddAmtOrPct3 AS decimal(10,2)))
    WHEN DepositRule3 = 'P'
    THEN convert(varchar, cast((EddAmtOrPct3*100) AS decimal(10,0))) + '%'
    ELSE null
    END,' ') as ThirdDepositAmount,
    Supervisor,
    eec.eecEEID AS [Employee EEID],
    eec.EecJobCode As [Job Code],
    isnull(eec.EecTimeclockID,' ') As [Time Clock ID],
    con.[Emer Contact Last Name],
    con.[Emer Contact First Name],
    con.[Emer Contact Middle Initial/Name],
    con.[Emergency Phone]
    from [ultiprosqlprod1].[ultipro_crum].dbo.empPers eep WITH (NOLOCK)
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.empComp eec WITH (NOLOCK)
    ON eep.eepEEID = eec.eecEEID
    inner join #tmp_Company cmp WITH (NOLOCK)
    ON eec.eecCOID = cmp.cmpCOID
    inner join [ultiprosqlprod1].[ultipro_crum].dbo.PayGroup pgr WITH (NOLOCK)
    ON eec.eecPayGroup = pgr.pgrPayGroup
    left outer join [ultiprosqlprod1].[ultipro_crum].dbo.TrmReasn
    on tchCode = eecTermReason
    left join (select CAST(sum(isnull(eee.eeeYTDHrs,0.00))AS DECIMAL(18,2)) as [YTD Hours],
    eeeEEID,
    eeeCOID
    from [ultiprosqlprod1].[ultipro_crum].dbo.EmpEarn eee with (NOLOCK)
    group by eeeCOID,eeeEEID)eee
    on eec.eecEEID = eee.eeeEEID
    and eec.eecCOID = eee.eeeCOID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode = 'USFIT'
    )eetFED
    ON eec.eecCOID = eetFED.COID
    and eec.eecEEID = eetFED.EEID
    left join (SELECT eetCOID AS COID,
    eetEEID AS EEID,
    eetTaxCode AS TAXCODE,
    eetFilingStatus AS FILINGSTATUS,
    eetExemptions AS EXEMPTIONS,
    eetExtraTaxDollars AS ADDITIONAL
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.empTax WITH (NOLOCK)
    WHERE eetTaxCode like '%SIT'
    AND eetIsWorkInTaxCode = 'Y'
    )eetSIT
    ON eec.eecCOID = eetSIT.COID
    and eec.eecEEID = eetSIT.EEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName1,
    eddEEBankRoute BankRoute1,
    eddAcct Account1,
    EddAcctType AcctType1,
    EddDepositRule DepositRule1,
    EddAmtOrPct EddAmtOrPct1
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '99')edd
    ON eec.eecCOID = edd.eddCOID
    and eec.eecEEID = edd.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName2,
    eddEEBankRoute BankRoute2,
    eddAcct Account2,
    EddAcctType AcctType2,
    EddDepositRule DepositRule2,
    EddAmtOrPct EddAmtOrPct2
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '01')edd2
    ON eec.eecCOID = edd2.eddCOID
    and eec.eecEEID = edd2.eddEEID
    left outer join (SELECT eddCOID,
    eddEEID,
    eddEEBankName BankName3,
    eddEEBankRoute BankRoute3,
    eddAcct Account3,
    EddAcctType AcctType3,
    EddDepositRule DepositRule3,
    EddAmtOrPct EddAmtOrPct3
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpDirDp WITH (NOLOCK)
    WHERE eddSequence = '02')edd3
    ON eec.eecCOID = edd3.eddCOID
    and eec.eecEEID = edd3.eddEEID
    left outer join (SELECT eecCOID,
    eecEEID,
    rtrim(eepNameLast) + ', ' +
    rtrim(eepNameFirst) + ' ' +
    isnull(rtrim(ltrim(eepNameMiddle)), '') AS [Supervisor]
    FROM [ultiprosqlprod1].[ultipro_crum].dbo.EmpComp WITH (NOLOCK)
    join [ultiprosqlprod1].[ultipro_crum].dbo.EmpPers with (NoLock)
    on eeceeid = eepeeid)eec2
    ON eec.eecSupervisorID = eec2.eecEEID
    left outer join #tmp_Contacts con
    on eep.eepEEID = con.ConEEID
    order by [Client ID],
    [Last Name],
    [First Name]
    drop table #tmp_Contacts
    END
    Timothy E Caldwell

Maybe you are looking for

  • Dynamic scrollbar position?

    Hi all, I have a scenario where the user needs a list of materials that is sorted by material text, which is used as a web based sales order creation application. This list can be very long (1000+ lines) and is shown in a Table where one of the colum

  • Back up contact from phone to mac

    Since upgrading the OS to X, the info tab is no longer available in itunes to help me sync my contacts from my phone or mac.  Now the sync between the two are no longer working, why???

  • Disk space for a Windows 8 Boot Camp partition?

    Hi, Hope your are all doing good Could you could please help me with how much hard disk space do i need for windows 8 bootcamp Current  Os ( Mountan lion)  Applications intended to be used Win 7/ Win 8 Office 2013 & office 2007 ( Only Word , Power po

  • Tree view control font size

    Hello, (LabVIEW 8.0): I have found that the font size of the tree view items can be set at design time from the drop down list on the menu bar.  However, is it possible to make each "level" (i.e. parent = a level, child = different level, grandchild 

  • Mini not falling to sleep.

    My ipad mini with retina stays wide awake until I put it to sleep manually.    Is this normal ? My iPhone and original iPad both automatically fall asleep after a few minutes when not being used.  I would think the iPad mini should be doing the same