Pipeline Function Showing Error.
Hi,
I have created a popeline finction in a packages...
CREATE OR REPLACE package xx is
type xxaptab_tp is record (FLAG CHAR(1),
LEDGER VARCHAR2(30),
OPERATING_UNIT VARCHAR2(240) ,
GL_DATE DATE ,
TYPE CHAR(1),
VOUCHER_NO NUMBER,
VOUCHER_DATE DATE,
CHECK_NUMBER VARCHAR2(40),
CHECK_DATE VARCHAR2(11),
VENDOR_NAME VARCHAR2(240),
DESCRIPTION VARCHAR2(240),
RECEIPTS NUMBER,
PAYMENTS NUMBER,
PAYMENTS1 NUMBER,
BANK_ACCOUNT_NAME VARCHAR2(100) ,
BANK_ACCOUNT_NUM VARCHAR2(30),
PROJECT_NAME VARCHAR2(240),
NATURE_OF_PAYMENT VARCHAR2(80),
NATURE_OF_RECEIPT varchar2(100),
CHECK_ID NUMBER(15) ,
CHECK_STATUS VARCHAR2(25),
FUTURE_PAY_DUE_DATE DATE);
type rec_type is table of xxaptab_tp ;
function xxbank_cashbook return rec_type pipelined;
end;
CREATE OR REPLACE package body xx is
function xxbank_cashbook(st_gldate date default null, end_gldate date default null) return rec_type pipelined is
r_type rec_type;
PRAGMA AUTONOMOUS_TRANSACTION;
begin
execute immediate('truncate table xx_ap_check_89i');
execute immediate('truncate table xx_ap_check_1910');
insert into xx_ap_check_1910
SELECT MIN(b.invoice_id) ID
, check_id
FROM ap_invoice_payments_all b
, ap_invoices_all a
, DUAL
WHERE 1 = 1
AND a.invoice_id = b.invoice_id
AND NOT REGEXP_LIKE (a.invoice_num ,'(-TDS-SI-|-TDS-CM-|-RTN-)')
GROUP BY check_id;
commit;
insert into xx_ap_check_89i
SELECT MIN(b.invoice_id) ID
, check_id
FROM ap_invoice_payments_all b
, ap_invoices_all a
, DUAL
WHERE 1 = 1
AND (CHECK_ID,'TRUE') = (
select AIP.CHECK_ID,
MIN (CASE WHEN REGEXP_LIKE (aia.invoice_num ,'(-TDS-SI-|-TDS-CM-)') THEN 'TRUE'--WHEN aia.invoice_num not LIKE '%-TDS-SI-%' THEN 'FALSE'
ELSE 'FALSE' END) FLAG
from ap_invoice_payments_all aip, ap_invoices_all aia
where aip.invoice_id = aia.invoice_id
and aip.check_id = b.check_id
group by check_id
AND a.invoice_id = b.invoice_id
GROUP BY check_id;
commit;
select FLAG,
LEDGER,
OPERATING_UNIT,
GL_DATE,
TYPE,
VOUCHER_NO,
VOUCHER_DATE,
CHECK_NUMBER,
CHECK_DATE,
VENDOR_NAME,
DESCRIPTION,
RECEIPTS,
PAYMENTS,
PAYMENTS1,
BANK_ACCOUNT_NAME,
BANK_ACCOUNT_NUM,
PROJECT_NAME,
NATURE_OF_PAYMENT,
NATURE_OF_RECEIPT,
CHECK_ID,
CHECK_STATUS,
FUTURE_PAY_DUE_DATE bulk collect into r_type
from
( SELECT '1' flag
, led.NAME ledger
, hou.NAME operating_unit
, aip.accounting_date gl_date
, 'P' TYPE
, apc.doc_sequence_value voucher_no
, apc.creation_date voucher_date
, TO_CHAR(apc.check_number) check_number
, TO_CHAR(apc.check_date, 'DD-MON-YYYY') check_date
, apc.vendor_name vendor_name
, apc.description description
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, -1,(apc.amount * NVL(apc.exchange_rate, 1)) * -1
, 0
)) receipts
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, 1,(apc.amount * NVL(apc.exchange_rate, 1))
, 0
)) payments
, TO_NUMBER(apc.amount * NVL(apc.exchange_rate, 1)) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, ffvv.description project_name
, flv.meaning nature_of_payment
, NULL nature_of_receipt
, aip.check_id check_id
, apc.STATUS_LOOKUP_CODE Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM APPS.XX_AP_CHECK_1910 aip1
, ap_invoice_payments_all aip2
, ap_invoice_payments_all aip
, ap_checks_all apc
, ce_bank_accounts cba
, ce_bank_acct_uses_all cbu
, po_vendors pov
, gl_code_combinations gl
, fnd_flex_values_vl ffvv
, gl_ledgers led
, hr_operating_units hou
, fnd_lookup_values_vl flv
WHERE pov.vendor_type_lookup_code = flv.lookup_code(+)
AND aip.check_id = apc.check_id
AND aip1.check_id = apc.check_id
AND aip2.check_id = apc.check_id
AND aip1.ID = aip2.invoice_id
AND flv.lookup_type(+) = 'VENDOR TYPE'
AND apc.vendor_id = pov.vendor_id(+)
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = apc.org_id
AND apc.org_id <> 86
AND ffvv.flex_value = gl.segment1
AND ffvv.flex_value_set_id = 1013712
AND aip2.accts_pay_code_combination_id = gl.code_combination_id
AND aip.check_id = apc.check_id
AND apc.ce_bank_acct_use_id = cbu.bank_acct_use_id
AND cba.bank_account_id = cbu.bank_account_id
AND apc.status_lookup_code IN('NEGOTIABLE', 'CLEARED', 'RECONCILED UNACCOUNTED', 'RECONCILED', 'CLEARED BUT UNACCOUNTED') -- added for Bug# 2449877
AND aip.invoice_payment_type IS NULL
AND apc.FUTURE_PAY_DUE_DATE is null
GROUP BY aip.accounting_date
, apc.doc_sequence_value
, apc.creation_date
, apc.check_number
, apc.check_date
, apc.vendor_name
, apc.description
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description
, flv.meaning
, led.NAME
, hou.NAME
, aip.check_id
, apc.amount
, NVL(apc.exchange_rate, 1)
, apc.STATUS_LOOKUP_CODE
UNION ALL
SELECT '2' flag
, led.NAME ledger
, hou.NAME ouperating_unit
, apid.accounting_date gl_date
, 'I' TYPE
, api.doc_sequence_value voucher_no
, api.creation_date voucher_date
, api.invoice_num check_number
, TO_CHAR(api.invoice_date, 'DD-MON-YYYY') check_date
, pov.vendor_name vendor_name
, NVL(api.description, api.invoice_num) description
, TO_NUMBER(SUM(api.invoice_amount * NVL(api.exchange_rate, 1))) receipts
, TO_NUMBER(SUM(0), 'fm999999999990.00') payments
, TO_NUMBER(SUM(0)) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, ffvv.description project_name
, flv.meaning nature_of_payment
, NULL nature_of_receipt
, NULL check_id
, NULL Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM ap_invoice_distributions_all apid
, ap_invoice_lines_all apla
, ap_invoices_all api
, po_vendors pov
, ce_bank_accounts cba
, gl_code_combinations gl
, fnd_flex_values_vl ffvv
, gl_ledgers led
, hr_operating_units hou
, fnd_lookup_values_vl flv
WHERE api.invoice_id = apid.invoice_id
AND pov.vendor_type_lookup_code = flv.lookup_code(+)
AND flv.lookup_type(+) = 'VENDOR TYPE'
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = api.org_id
AND api.org_id <> 86
AND ffvv.flex_value = gl.segment1
AND ffvv.flex_value_set_id = 1013712
AND api.accts_pay_code_combination_id = gl.code_combination_id
AND apla.invoice_id = apid.invoice_id
AND apla.line_number = apid.invoice_line_number
AND api.vendor_id = pov.vendor_id
AND cba.asset_code_combination_id = apid.dist_code_combination_id
AND apid.match_status_flag = 'A'
AND NVL(api.payment_status_flag, 'N') <> 'N'
GROUP BY apid.accounting_date
, api.doc_sequence_value
, api.creation_date
, api.invoice_num
, api.invoice_date
, pov.vendor_name
, NVL(api.description, api.invoice_num)
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description
, flv.meaning
, led.NAME
, hou.NAME
UNION ALL
SELECT '3' flag
, led.NAME ledger
, hou.NAME operating_unit
, acrh.gl_date gl_date
, DECODE(
acrh.status
, 'REVERSED', 'REV'
, 'R'
) TYPE
, acr.doc_sequence_value voucher_no
, acr.creation_date voucher_date
, acr.receipt_number check_number
, TO_CHAR(acr.receipt_date, 'DD-MON-YYYY') check_date
, SUBSTR(
hp.party_name
, 1
, 50
) vendor_name
, NVL(acr.comments, acr.receipt_number) description
, TO_NUMBER(SUM(DECODE(
acrh.status
, 'CLEARED',(NVL(acrh.amount, 0) * NVL(acrh.exchange_rate, 1))
, 'REMITTED',(NVL(acrh.amount, 0) * NVL(acrh.exchange_rate, 1))
, 'CONFIRMED',(NVL(acrh.amount, 0) * NVL(acrh.exchange_rate, 1))
, 'REVERSED', 0
))) receipts
, TO_NUMBER(SUM(DECODE(
acrh.status
, 'REVERSED',(NVL(acrh.amount, 0) * NVL(acrh.exchange_rate, 1))
, 0
))) payments
, TO_NUMBER(TO_CHAR(SUM(0))) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, ffvv.description project_name
, NULL nature_of_payment
, DECODE(
acr.TYPE
, 'CASH', 'Collection'
, 'MISC', 'Cash Deposit'
, acr.TYPE
) nature_of_receipt
, NULL check_id
, NULL Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM ar_cash_receipt_history_all acrh
, ar_cash_receipts_all acr
, hz_parties hp
, hz_cust_accounts hca
, ce_bank_accounts cba
, ce_bank_acct_uses_all cbau
, fnd_flex_values_vl ffvv
, gl_ledgers led
, hr_operating_units hou
WHERE acrh.cash_receipt_id = acr.cash_receipt_id
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = acr.org_id
AND acr.org_id <> 86
AND ffvv.flex_value = acr.attribute1
AND ffvv.flex_value_set_id = 1013712
AND cbau.bank_acct_use_id = acr.remit_bank_acct_use_id
AND cbau.bank_account_id = cba.bank_account_id
AND hca.party_id = hp.party_id(+)
AND acr.pay_from_customer = hca.cust_account_id(+)
AND acrh.status IN('CLEARED', 'REMITTED', 'CONFIRMED', 'REVERSED')
AND (
acr.reversal_date IS NOT NULL
AND acrh.status = 'REVERSED')
OR (acrh.cash_receipt_history_id IN(SELECT
MIN(incrh.cash_receipt_history_id)
FROM ar_cash_receipt_history_all incrh
WHERE incrh.cash_receipt_id = acr.cash_receipt_id
AND incrh.status <> 'REVERSED'))
GROUP BY acrh.gl_date
, acrh.status
, acr.doc_sequence_value
, acr.creation_date
, SUBSTR(
hp.party_name
, 1
, 50
, NVL(acr.comments, acr.receipt_number)
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description
, acr.TYPE
, led.NAME
, hou.NAME
, acr.receipt_number
, acr.receipt_date
UNION ALL
SELECT '3A' flag
, led.NAME ledger
, hou.NAME operating_unit
, acrh.gl_date gl_date
, DECODE(
acrh.status
, 'REVERSED', 'REV'
, 'R'
) TYPE
, acr.doc_sequence_value voucher_no
, acr.creation_date voucher_date
, acr.receipt_number check_number
, TO_CHAR(acr.receipt_date, 'DD-MON-YYYY') check_date
, SUBSTR(
hp.party_name
, 1
, 50
) vendor_name
, NVL(acr.comments, acr.receipt_number) description
, TO_NUMBER(SUM(DECODE(
acrh.status
, 'REVERSED',(NVL(acrh.amount, 0) * NVL(acrh.exchange_rate, 1))
, 0
))) Receipts
, TO_NUMBER(SUM(DECODE(
acrh.status
, 'CLEARED',(NVL(acrh.amount, 0) * NVL(acrh.exchange_rate, 1))
, 'REMITTED',(NVL(acrh.amount, 0) * NVL(acrh.exchange_rate, 1))
, 'CONFIRMED',(NVL(acrh.amount, 0) * NVL(acrh.exchange_rate, 1))
, 'REVERSED', 0
))) Payments
, TO_NUMBER(TO_CHAR(SUM(0))) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, ffvv.description project_name
, NULL nature_of_payment
, DECODE(
acr.TYPE
, 'CASH', 'Collection'
, 'MISC', 'Cash Deposit'
, acr.TYPE
) nature_of_receipt
, NULL check_id
, NULL Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM ar_cash_receipt_history_all acrh
, ar_cash_receipts_all acr
, hz_parties hp
, hz_cust_accounts hca
, ce_bank_accounts cba
, ce_bank_acct_uses_all cbau
, fnd_flex_values_vl ffvv
, gl_ledgers led
, hr_operating_units hou
WHERE acrh.cash_receipt_id = acr.cash_receipt_id
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = acr.org_id
AND acr.org_id <> 86
AND ffvv.flex_value = acr.attribute1
AND ffvv.flex_value_set_id = 1013712
AND cbau.bank_acct_use_id = acr.remit_bank_acct_use_id
AND cbau.bank_account_id = cba.bank_account_id
AND hca.party_id = hp.party_id(+)
AND acr.pay_from_customer = hca.cust_account_id(+)
AND acrh.status IN('CLEARED', 'REMITTED', 'CONFIRMED', 'REVERSED')
AND (
acr.reversal_date IS NOT NULL
AND acrh.status = 'REVERSED')
OR (acrh.cash_receipt_history_id IN(SELECT
MIN(incrh.cash_receipt_history_id)
FROM ar_cash_receipt_history_all incrh
WHERE incrh.cash_receipt_id = acr.cash_receipt_id
AND incrh.status <> 'REVERSED'))
AND cba.bank_account_num = '1723201002888'
GROUP BY acrh.gl_date
, acrh.status
, acr.doc_sequence_value
, acr.creation_date
, SUBSTR(
hp.party_name
, 1
, 50
, NVL(acr.comments, acr.receipt_number)
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description
, acr.TYPE
, led.NAME
, hou.NAME
, acr.receipt_number
, acr.receipt_date
UNION ALL
SELECT '4' flag
, led.NAME ledger
, NULL operating_unit
, glh.default_effective_date gl_date
, 'G' TYPE
, glh.doc_sequence_value voucher_no
, glh.creation_date voucher_date
, NULL check_number
, NULL check_date
, NULL vendor_name
, gll.description description
, TO_NUMBER(DECODE(
SUM(accounted_dr)
, NULL, 0
, SUM(accounted_dr)
)) receipts
, TO_NUMBER(DECODE(
SUM(accounted_cr)
, NULL, 0
, SUM(accounted_cr)
)) payments
, TO_NUMBER(DECODE(
SUM(accounted_cr)
, NULL, 0
, SUM(accounted_cr)
)) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, ffvv.description project_name
, NULL nature_of_payment
, NULL nature_of_receipt
, NULL check_id
, NULL Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM gl_je_headers glh
, gl_je_lines gll
, ce_bank_accounts cba
, gl_code_combinations_kfv glcc
, gl_code_combinations_kfv glcc1
, fnd_flex_values_vl ffvv
, gl_ledgers led
WHERE glh.je_header_id = gll.je_header_id
AND cba.asset_code_combination_id = glcc.code_combination_id
AND gll.code_combination_id = glcc1.code_combination_id
AND glcc.segment2 = glcc1.segment2
AND ffvv.flex_value = glcc1.segment1
AND ffvv.flex_value_set_id = 1013712
AND glh.ledger_id = led.ledger_id
AND glh.je_source NOT IN('Payables', 'Receivables', 'Manual')
GROUP BY glh.default_effective_date
, gll.description
, cba.bank_account_name
, cba.bank_account_num
, glh.doc_sequence_value
, glh.creation_date
, ffvv.description
, led.NAME
UNION ALL
SELECT '5' flag
, led.NAME ledger
, NULL operating_unit
, glh.default_effective_date gl_date
, 'G' TYPE
, glh.doc_sequence_value voucher_no
, glh.creation_date voucher_date
, NULL check_number
, NULL check_date
, NULL vendor_name
, gll.description description
, TO_NUMBER(DECODE(
SUM(accounted_dr)
, NULL, 0
, SUM(accounted_dr)
)) receipts
, TO_NUMBER(DECODE(
SUM(accounted_cr)
, NULL, 0
, SUM(accounted_cr)
)) payments
, TO_NUMBER(DECODE(
SUM(accounted_cr)
, NULL, 0
, SUM(accounted_cr)
)) payments1
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description project_name
, NULL nature_of_payment
, NULL nature_of_receipt
, NULL check_id
, NULL Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM gl_je_headers glh
, gl_je_lines gll
, ce_bank_accounts cba
, gl_code_combinations_kfv glcc
, gl_code_combinations_kfv glcc1
, fnd_flex_values_vl ffvv
, gl_ledgers led
WHERE glh.je_header_id = gll.je_header_id
AND cba.asset_code_combination_id = glcc.code_combination_id
AND gll.code_combination_id = glcc1.code_combination_id
AND glcc.segment2 = glcc1.segment2
AND ffvv.flex_value = glcc1.segment1
AND (ffvv.flex_value_set_id = 1013712 or ffvv.flex_value_id=53880)
AND glh.ledger_id = gll.ledger_id
AND glh.ledger_id = led.ledger_id
AND glh.je_source = 'Manual'
GROUP BY glh.default_effective_date
, gll.description
, cba.bank_account_name
, cba.bank_account_num
, glh.doc_sequence_value
, glh.creation_date
, ffvv.description
, led.NAME
UNION ALL
SELECT '6' flag
, led.NAME ledger
, NULL operating_unit
, glh.default_effective_date gl_date
, 'G' TYPE
, glh.doc_sequence_value voucher_no
, glh.creation_date voucher_date
, NULL check_number
, NULL check_date
, NULL vendor_name
, gll.description description
, TO_NUMBER(DECODE(
SUM(accounted_dr)
, NULL, 0
, SUM(accounted_dr)
)) receipts
, TO_NUMBER(DECODE(
SUM(accounted_cr)
, NULL, 0
, SUM(accounted_cr)
)) payments
, TO_NUMBER(DECODE(
SUM(accounted_cr)
, NULL, 0
, SUM(accounted_cr)
)) payments1
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description project_name
, NULL nature_of_payment
, NULL nature_of_receipt
, NULL check_id
, NULL Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM gl_je_headers glh
, gl_je_lines gll
, ce_bank_accounts cba
, gl_code_combinations_kfv glcc
, gl_code_combinations_kfv glcc1
, fnd_flex_values_vl ffvv
, gl_ledgers led
WHERE glh.je_header_id = gll.je_header_id
AND cba.asset_code_combination_id = glcc.code_combination_id
AND gll.code_combination_id = glcc1.code_combination_id
AND glcc.segment2 = glcc1.segment2
AND ffvv.flex_value = glcc1.segment1
AND ffvv.flex_value_set_id = 1013712
AND glh.ledger_id = gll.ledger_id
AND glh.ledger_id = led.ledger_id
AND glh.je_source = 'Payables'
GROUP BY glh.default_effective_date
, gll.description
, cba.bank_account_name
, cba.bank_account_num
, glh.doc_sequence_value
, glh.creation_date
, ffvv.description
, led.NAME
UNION ALL
SELECT '7' flag
, led.NAME ledger
, hou.NAME operating_unit
, DECODE(apc.future_pay_due_date, NULL, aip.accounting_date, apc.void_date) gl_date
, 'V' TYPE
, apc.doc_sequence_value voucher_no
, aip.creation_date voucher_date
, TO_CHAR(apc.check_number) check_number
, TO_CHAR(apc.check_date, 'DD-MON-YYYY') check_date
, apc.vendor_name vendor_name
, apc.description description
, TO_NUMBER(DECODE(
SIGN((SUM(aip.amount)))
, -1,SUM((aip.amount * NVL(apc.exchange_rate, 1))) * -1
, 0
)) receipts
, TO_NUMBER(DECODE(
SIGN((SUM(aip.amount)))
, 1,SUM((aip.amount * NVL(apc.exchange_rate, 1)))
, 0
)) payments
, SUM((aip.amount * NVL(apc.exchange_rate, 1))) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, ffvv.description project_name
, flv.meaning nature_of_payment
, NULL nature_of_receipt
, aip.check_id check_id
, apc.STATUS_LOOKUP_CODE Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM ap_invoice_payments_all aip
, ap_checks_all apc
, ce_bank_accounts cba
, ce_bank_acct_uses_all cbu
, po_vendors pov
, gl_code_combinations gl
, fnd_flex_values_vl ffvv
, gl_ledgers led
, hr_operating_units hou
, fnd_lookup_values_vl flv
WHERE pov.vendor_type_lookup_code = flv.lookup_code(+)
AND aip.check_id = apc.check_id
AND flv.lookup_type(+) = 'VENDOR TYPE'
AND apc.vendor_id = pov.vendor_id(+)
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = apc.org_id
AND apc.org_id <> 86
AND ffvv.flex_value = gl.segment1
AND ffvv.flex_value_set_id = 1013712
AND aip.accts_pay_code_combination_id = gl.code_combination_id
AND aip.check_id = apc.check_id
AND apc.ce_bank_acct_use_id = cbu.bank_acct_use_id
AND cba.bank_account_id = cbu.bank_account_id
AND apc.status_lookup_code = 'VOIDED'
AND aip.invoice_payment_type IS NULL
GROUP BY
DECODE(apc.future_pay_due_date, NULL, aip.accounting_date, apc.void_date)
, apc.doc_sequence_value
, aip.creation_date
, apc.check_number
, apc.check_date
, apc.vendor_name
, apc.description
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description
, flv.meaning
, led.NAME
, hou.NAME
, aip.check_id
, NVL(apc.exchange_rate, 1)
, apc.STATUS_LOOKUP_CODE
UNION ALL
SELECT '8' flag
, led.NAME ledger
, hou.NAME operating_unit
, aip.accounting_date gl_date
, 'P' TYPE
, apc.doc_sequence_value voucher_no
, apc.creation_date voucher_date
, TO_CHAR(apc.check_number) check_number
, TO_CHAR(apc.check_date, 'DD-MON-YYYY') check_date
, apc.vendor_name vendor_name
, apc.description description
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, -1,(apc.amount * NVL(apc.exchange_rate, 1)) * -1
, 0
)) receipts
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, 1,(apc.amount * NVL(apc.exchange_rate, 1))
, 0
)) payments
, TO_NUMBER(apc.amount * NVL(apc.exchange_rate, 1)) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, ffvv.description project_name
, flv.meaning nature_of_payment
, NULL nature_of_receipt
, aip.check_id check_id
, apc.STATUS_LOOKUP_CODE Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM APPS.XX_AP_CHECK_89i aip1
, ap_invoice_payments_all aip2
, ap_invoice_payments_all aip
, ap_checks_all apc
, ce_bank_accounts cba
, ce_bank_acct_uses_all cbu
, po_vendors pov
, gl_code_combinations gl
, fnd_flex_values_vl ffvv
, gl_ledgers led
, hr_operating_units hou
, fnd_lookup_values_vl flv
WHERE pov.vendor_type_lookup_code = flv.lookup_code(+)
AND aip.check_id = apc.check_id
AND aip1.check_id = apc.check_id
AND aip2.check_id = apc.check_id
AND aip1.ID = aip2.invoice_id
AND flv.lookup_type(+) = 'VENDOR TYPE'
AND apc.vendor_id = pov.vendor_id(+)
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = apc.org_id
AND apc.org_id <> 86
AND ffvv.flex_value = gl.segment1
AND ffvv.flex_value_set_id = 1013712
AND aip2.accts_pay_code_combination_id = gl.code_combination_id
AND aip.check_id = apc.check_id
AND apc.ce_bank_acct_use_id = cbu.bank_acct_use_id
AND cba.bank_account_id = cbu.bank_account_id
AND apc.status_lookup_code IN('NEGOTIABLE', 'CLEARED', 'RECONCILED UNACCOUNTED', 'RECONCILED', 'CLEARED BUT
UNACCOUNTED')
AND aip.invoice_payment_type IS NULL
GROUP BY aip.accounting_date
, apc.doc_sequence_value
, apc.creation_date
, apc.check_number
, apc.check_date
, apc.vendor_name
, apc.description
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description
, flv.meaning
, led.NAME
, hou.NAME
, aip.check_id
, apc.amount
, NVL(apc.exchange_rate, 1)
, apc.STATUS_LOOKUP_CODE
UNION ALL
SELECT '9' flag
, led.NAME ledger
, hou.NAME operating_unit
, aip.accounting_date gl_date
, 'P' TYPE
, apc.doc_sequence_value voucher_no
, apc.creation_date voucher_date
, TO_CHAR(apc.check_number) check_number
, TO_CHAR(apc.check_date, 'DD-MON-YYYY') check_date
, apc.vendor_name vendor_name
, apc.description description
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, -1,(apc.amount * NVL(apc.exchange_rate, 1)) * -1
, 0
)) receipts
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, 1,(apc.amount * NVL(apc.exchange_rate, 1))
, 0
)) payments
, TO_NUMBER(apc.amount * NVL(apc.exchange_rate, 1)) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
-- , ffvv.description project_name
, FIND_INVOICE_PROJECT_DESC(aip1.id) project_name
, flv.meaning nature_of_payment
, NULL nature_of_receipt
, aip.check_id check_id
, apc.STATUS_LOOKUP_CODE Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM APPS.XX_AP_CHECK_1910 aip1
, ap_invoice_payments_all aip
, ap_checks_all apc
, ce_bank_accounts cba
, ce_bank_acct_uses_all cbu
, po_vendors pov
, gl_ledgers led
, hr_operating_units hou
, fnd_lookup_values_vl flv
WHERE aip.ACCTS_PAY_CODE_COMBINATION_ID is null
AND cba.BANK_ACCOUNT_NAME not like 'Migration%'
AND pov.vendor_type_lookup_code = flv.lookup_code(+)
AND aip.check_id = apc.check_id
AND aip1.check_id = apc.check_id
AND aip1.ID = aip.invoice_id
AND flv.lookup_type(+) = 'VENDOR TYPE'
AND apc.vendor_id = pov.vendor_id(+)
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = apc.org_id
AND apc.org_id <> 86
AND apc.ce_bank_acct_use_id = cbu.bank_acct_use_id
AND cba.bank_account_id = cbu.bank_account_id
AND apc.status_lookup_code IN('NEGOTIABLE', 'CLEARED', 'RECONCILED UNACCOUNTED', 'RECONCILED', 'CLEARED BUT UNACCOUNTED') AND aip.invoice_payment_type IS NULL
GROUP BY aip.accounting_date
, apc.doc_sequence_value
, apc.creation_date
, apc.check_number
, apc.check_date
, apc.vendor_name
, apc.description
, cba.bank_account_name
, cba.bank_account_num
-- , ffvv.description
, FIND_INVOICE_PROJECT_DESC(aip1.id)
, flv.meaning
, led.NAME
, hou.NAME
, aip.check_id
, apc.amount
, NVL(apc.exchange_rate, 1)
, apc.STATUS_LOOKUP_CODE
UNION ALL
SELECT '91' flag
, led.NAME ledger
, hou.NAME operating_unit
, aip.accounting_date gl_date
, 'P' TYPE
, apc.doc_sequence_value voucher_no
, apc.creation_date voucher_date
, TO_CHAR(apc.check_number) check_number
, TO_CHAR(apc.check_date, 'DD-MON-YYYY') check_date
, apc.vendor_name vendor_name
, apc.description description
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, -1,(apc.amount * NVL(apc.exchange_rate, 1)) * -1
, 0
)) receipts
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, 1,(apc.amount * NVL(apc.exchange_rate, 1))
, 0
)) payments
, TO_NUMBER(apc.amount * NVL(apc.exchange_rate, 1)) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, FIND_INVOICE_PROJECT_DESC(aip1.id) project_name
, flv.meaning nature_of_payment
, NULL nature_of_receipt
, aip.check_id check_id
, apc.STATUS_LOOKUP_CODE Check_status
, NULL FUTURE_PAY_DUE_DATE
FROM APPS.XX_AP_CHECK_89i aip1
, ap_invoice_payments_all aip
, ap_checks_all apc
, ce_bank_accounts cba
, ce_bank_acct_uses_all cbu
, po_vendors pov
, gl_ledgers led
, hr_operating_units hou
, fnd_lookup_values_vl flv
WHERE aip.ACCTS_PAY_CODE_COMBINATION_ID is null
AND cba.BANK_ACCOUNT_NAME not like 'Migration%'
AND pov.vendor_type_lookup_code = flv.lookup_code(+)
AND aip.check_id = apc.check_id
AND aip1.check_id = apc.check_id
AND aip1.ID = aip.invoice_id
AND flv.lookup_type(+) = 'VENDOR TYPE'
AND apc.vendor_id = pov.vendor_id(+)
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = apc.org_id
AND apc.org_id <> 86
AND apc.ce_bank_acct_use_id = cbu.bank_acct_use_id
AND cba.bank_account_id = cbu.bank_account_id
AND apc.status_lookup_code IN('NEGOTIABLE', 'CLEARED', 'RECONCILED UNACCOUNTED', 'RECONCILED', 'CLEARED BUT UNACCOUNTED') AND aip.invoice_payment_type IS NULL
GROUP BY aip.accounting_date
, apc.doc_sequence_value
, apc.creation_date
, apc.check_number
, apc.check_date
, apc.vendor_name
, apc.description
, cba.bank_account_name
, cba.bank_account_num
-- , ffvv.description
, FIND_INVOICE_PROJECT_DESC(aip1.id)
, flv.meaning
, led.NAME
, hou.NAME
, aip.check_id
, apc.amount
, NVL(apc.exchange_rate, 1)
, apc.STATUS_LOOKUP_CODE
UNION ALL
SELECT '10' flag
, led.NAME ledger
, hou.NAME operating_unit
, apc.FUTURE_PAY_DUE_DATE gl_date
, 'P' TYPE
, apc.doc_sequence_value voucher_no
, apc.creation_date voucher_date
, TO_CHAR(apc.check_number) check_number
, TO_CHAR(apc.check_date, 'DD-MON-YYYY') check_date
, apc.vendor_name vendor_name
, apc.description description
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, -1,(apc.amount * NVL(apc.exchange_rate, 1)) * -1
, 0
)) receipts
, TO_NUMBER(DECODE(
SIGN((apc.amount))
, 1,(apc.amount * NVL(apc.exchange_rate, 1))
, 0
)) payments
, TO_NUMBER(apc.amount * NVL(apc.exchange_rate, 1)) payments1
, cba.bank_account_name bank_account_name
, cba.bank_account_num bank_account_num
, ffvv.description project_name
, flv.meaning nature_of_payment
, NULL nature_of_receipt
, aip.check_id check_id
, apc.STATUS_LOOKUP_CODE Check_status
, apc.FUTURE_PAY_DUE_DATE
FROM APPS.XX_AP_CHECK_1910 aip1
, ap_invoice_payments_all aip2
, ap_invoice_payments_all aip
, ap_checks_all apc
, ce_bank_accounts cba
, ce_bank_acct_uses_all cbu
, po_vendors pov
, gl_code_combinations gl
, fnd_flex_values_vl ffvv
, gl_ledgers led
, hr_operating_units hou
, fnd_lookup_values_vl flv
WHERE pov.vendor_type_lookup_code = flv.lookup_code(+)
AND aip.check_id = apc.check_id
AND aip1.check_id = apc.check_id
AND aip2.check_id = apc.check_id
AND aip1.ID = aip2.invoice_id
AND flv.lookup_type(+) = 'VENDOR TYPE'
AND apc.vendor_id = pov.vendor_id(+)
AND hou.set_of_books_id = led.ledger_id
AND hou.organization_id = apc.org_id
AND apc.org_id <> 86
AND ffvv.flex_value = gl.segment1
AND ffvv.flex_value_set_id = 1013712
AND aip2.accts_pay_code_combination_id = gl.code_combination_id
AND aip.check_id = apc.check_id
AND apc.ce_bank_acct_use_id = cbu.bank_acct_use_id
AND cba.bank_account_id = cbu.bank_account_id
AND apc.status_lookup_code IN('NEGOTIABLE', 'CLEARED', 'RECONCILED UNACCOUNTED', 'RECONCILED', 'CLEARED BUT UNACCOUNTED') -- added for Bug# 2449877
AND aip.invoice_payment_type IS NULL
AND apc.FUTURE_PAY_DUE_DATE is not null
GROUP BY
apc.doc_sequence_value
, apc.creation_date
, apc.check_number
, apc.check_date
, apc.vendor_name
, apc.description
, cba.bank_account_name
, cba.bank_account_num
, ffvv.description
, flv.meaning
, led.NAME
, hou.NAME
, aip.check_id
, apc.amount
, NVL(apc.exchange_rate, 1)
, apc.STATUS_LOOKUP_CODE
, apc.FUTURE_PAY_DUE_DATE
FOR i IN 1 .. r_type.count LOOP
PIPE ROW(r_type(i));
END LOOP;
end;
end;
while running showing the error:
ORA-06502: PL/SQL: numeric or value error: Bulk Bind: Truncated Bind
ORA-06512: at "XX", line 45
ORA-06512: at line 1
Horrible code. If defies logic and basic Oracle concepts...
Why even use a package when monolithic cr@p like this is written?
What is wrong with this code you may ask? Everything.
What is right with this code? Nothing.
How to fix this code? Cannot be fixed. It needs to be trashed. Every single infected byte. And new code needs to be designed and written that addresses the requirements logically, adheres to Oracle concepts, and applies fundamental software engineering principles.
Similar Messages
-
GetContentPane function shows error
The following program shows cannot resolve symbol at the getContentPane() function. CAn anybody tell me why this is happening
import javax.swing.*;
import java.io.*;
class Test extends JFrame
final String[] colhead = {"No","Name"};
final Object[][] data = new Object[10][2];
JTable table = null;
JFrame frame = null;
public Test()
super("Table");
data[0][0] = "1";
data[0][1] = "Sanil";
data[1][0] = "2";
data[1][1] = "Kenney";
frame = new JFrame();
table = new JTable(data,colhead);
Container content = frame.getContentPane();
content.setLayout(null);
}What package does Container belong to? Did you import the correct package?
-
Showing error in read_text function module
- Forcast ID Number: Read function module READ_TEXT where ID = Z001, Object = VBBK to get the Forcast ID. Display it on the output.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'Z001'
LANGUAGE =
NAME =
OBJECT = 'VBBK'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES =
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
its showing error---unable to interprete OBJECT.possible cases of spelling or comma errorLook at the Bold ones ... U need to give values for
language and name
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'Z001'
LANGUAGE = ' '
NAME = ' '
OBJECT = 'VBBK'
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER =
TABLES
LINES =
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Pipelined function with Union clause(Invalid Number(ORA-01722) error )
Hi,
I have a pipelined function.
I am fetching the data with the use of a REF cursor.
The query has two part: query1 and query2
when I am opeing the cursor with query1 UNION query2,it is giving me Invalid Number(ORA-01722) error.
but when I open the cursor separately for query1 and query2,I am getting the resultset for each of the query.
query1 and query2 are running fine with UNION in the sql editor.
But,when I put them into two variables (var1 :='query1' and var2:='query2' and try to open the cursor with var1 UNION var2 , it's giving me the error.
But when I put query2 as 'Select ..... from dual' and then try to open the cursor for query1 UNION query2,
then getting the result of query1 and one extra row for query2(dual).
The FROM table set is same for query1 and query2..
can anyone please help me , why this Invalid Number(ORA-01722) error is coming.query1 := 'SELECT to_char(st.store_no) STORE_NUMBER,pp.name PROGRAM_NAME, ''HBS'' DISPENSING_SYSTEM,
pt.PATIENT_SRC_NO SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, pt.last_name PATIENT_LAST_NAME, pt.first_name
PATIENT_FIRST_NAME, to_char(LPAD (pppd.rx_number, 7, '' '')|| ''-''|| LPAD (pppd.refill_number, 2, 0)) RX_REFILL
FROM
pega_patient_program_dispense pppd,pega_patient_program_reg pppr,health_care_profs hcp1,
health_care_profs hcp2,prescription_dispenses pd,prescriptions p, pega_program_status_reason ppsr ,master_doctors md,
prescription_disp_orders pdo, hbs_shipment_extract hse,stores st,master_stores ms,pega_programs pp,patients pt,master_patients mpt
WHERE
pppr.referring_hcp_id=md.id(+) and md.dispensing_system_id=hcp1.hcp_id and
pppr.ID=pppd.PEGA_PATIENT_PROGRAM_REG_ID and pppd.prescription_dispense_id=pd.id and pd.prescriptions_id=p.id and
p.hcp_id=hcp2.hcp_id and ppsr.ID=pppd.PEGA_PROGRAM_STATUS_REASON_ID and pppd.prescription_dispense_id = pdo.prescriptions_dispenses_id(+) AND
pdo.shipment_number = hse.shp_no(+) and pppd.store_id=ms.id and st.id=ms.dispensing_system_id and pppr.pega_program_id=pp.id
and pppr.patient_id=mpt.id and pt.patient_id=mpt.dispensing_system_id and pppd.dispensing_system=''HBS'' and pp.name LIKE ''REV%''
AND
((pppd.prescription_dispense_id IS NOT NULL AND pppd.quantity_dispensed > 0 AND pppd.reported_date IS NULL AND
pppd.src_delete_date IS NULL AND ((pppr.program_specific_patient_code IS NULL ) OR (hcp1.last_name IS NULL) OR
(hcp1.first_name IS NULL) OR (hcp2.first_name IS NULL) OR (hcp2.last_name IS NULL) OR (hcp2.address_1 IS NULL) OR
(hcp2.city IS NULL) OR (hcp2.state_cd IS NULL) OR (hcp2.zip_1 IS NULL)OR (pppr.referral_date is NULL) OR
(hcp1.state_cd IS NULL) OR (hcp1.zip_1 IS NULL)
OR (hcp2.zip_1 IS NULL) OR (pppr.last_status_change_date IS NULL) OR (pppr.varchar_1 IS NULL) OR
(pppr.varchar_7 IS NULL OR pppr.varchar_7 LIKE ''NOT AVAILABLE AT REFERRAL%'') OR (pppr.varchar_5 IS NULL OR
pppr.varchar_5 LIKE ''NOT AVAILABLE AT REFERRAL%'')) ) AND ppsr.INCLUDE_ON_EXCEPTION_RPT_IND=''Y'')
OR
((pppd.authorization_number IS NULL OR NVL(TRUNC(pdo.shipped_date),TRUNC(hse.shp_act_date_dt)) NOT BETWEEN
TRUNC(pppd.date_1) AND TRUNC(pppd.date_2)) OR (pppd.varchar_4 IS NULL OR NVL(TRUNC(pdo.shipped_date),
TRUNC(hse.shp_act_date_dt)) NOT BETWEEN TRUNC(pppd.date_3) AND TRUNC(pppd.date_5)))
OR
(pppr.pega_program_competitors_id IS NULL AND (ppsr.manufacturer_status=''TRIAGE'' AND ppsr.manufacturer_reason=''COMPETITOR''))
OR
(ppsr.manufacturer_reason IS NULL)
query2 := ' SELECT ''150'' STORE_NUMBER,''test'' PROGRAM_NAME , ''RX2000'' DISPENSING_SYSTEM
,''01'' SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, ''test'' PATIENT_LAST_NAME, ''test'' PATIENT_FIRST_NAME,
''rx01'' RX_REFILL
FROM
pega_patient_program_reg pppr,health_care_profs hcp1, pega_program_status_reason ppsr ,
master_doctors md,stores st,master_stores ms,pega_programs pp,patients pt,master_patients mpt
WHERE
pppr.referring_hcp_id=md.id(+) and md.dispensing_system_id=hcp1.hcp_id and
ppsr.ID=pppr.REFERRAL_STATUS_ID and st.store_type=''M'' and pppr.store_id=ms.id and st.id=ms.dispensing_system_id
and pppr.pega_program_id=pp.id and pppr.patient_id=mpt.id and pt.patient_id=mpt.dispensing_system_id and pp.name LIKE ''REV%''
AND
((((pppr.program_specific_patient_code IS NULL ) OR (hcp1.last_name IS NULL) OR (hcp1.first_name IS NULL) OR
(pppr.referral_date is NULL) OR (hcp1.state_cd IS NULL) OR (hcp1.zip_1 IS NULL) OR (pppr.last_status_change_date IS NULL)
OR (pppr.varchar_1 IS NULL) OR (pppr.varchar_7 IS NULL) OR (pppr.varchar_5 IS NULL OR pppr.varchar_5 LIKE
''NOT AVAILABLE AT REFERRAL%'')) ) AND ppsr.INCLUDE_ON_EXCEPTION_RPT_IND=''Y'')
OR
(pppr.pega_program_competitors_id IS NULL AND (ppsr.manufacturer_status=''TRIAGE'' AND ppsr.manufacturer_reason=''COMPETITOR''))
OR
(ppsr.manufacturer_reason IS NULL)
AND
pppr.id NOT IN(select pppd.PEGA_PATIENT_PROGRAM_REG_ID from PEGA_PATIENT_PROGRAM_DISPENSE pppd)';
BUT IF I put
query2 := ' SELECT ''150'' STORE_NUMBER,''test'' PROGRAM_NAME , ''RX2000'' DISPENSING_SYSTEM
,''01'' SOURCE_ID, null RX2000_PATIENT_IDENTIFIER, ''test'' PATIENT_LAST_NAME, ''test'' PATIENT_FIRST_NAME,
''rx01'' RX_REFILL
FROM DUAL';
then it is giving result. -
My CS6 photoshop started showing {cannot perform function programming error}
then it started freezing please help?Supply pertinent information for quicker answers
The more information you supply about your situation, the better equipped other community members will be to answer. Consider including the following in your question:
Adobe product and version number
Operating system and version number
The full text of any error message(s)
What you were doing when the problem occurred
Screenshots of the problem
Computer hardware, such as CPU; GPU; amount of RAM; etc. -
I have a function which populates a collection, pipe the elements in the collection and throws the piped table object. Its working fine.
But when I pass the collection to this function instead of populating them in the function. Its throwing a error message stating that unable to access rows from nested table.
How to overcome this.
Thanks in advanceThat's strange. When I tried your code on my system I didn't get the error. Here's what I did. Note that some object definitions were not provided so I had to replace some of your code with my own. Also, there was a typo in the definition of tabFun you provided, two "END;" lines were listed where only one was needed.
SQL> CREATE OR REPLACE TYPE myObj AS OBJECT
2 ( F1 INT,
3 F2 DATE,
4 F3 VARCHAR2(25)
5 );
6 /
Type created.
SQL> show errors
No errors.
SQL>
SQL>
SQL> CREATE OR REPLACE TYPE myTab AS TABLE OF myObj;
2 /
Type created.
SQL> show errors
No errors.
SQL>
SQL>
SQL> CREATE OR REPLACE FUNCTION tabFun(tab1 IN myTab)
2 RETURN myTab PIPELINED
3 IS
4 BEGIN
5 FOR i in 1 .. tab1.count
6 LOOP
7 PIPE ROW (myObj(tab1(i).F1,tab1(i).F2,tab1(i).F3));
8 END LOOP;
9 RETURN;
10 END;
11 /
Function created.
SQL> show errors
No errors.
SQL>
SQL>
SQL>
SQL> CREATE OR REPLACE PROCEDURE myProc
2 --(ref_cur out weakcur.cur_defn)
3 ( ref_cur out sys_refcursor )
4 AS
5 tab myTab;
6 BEGIN
7
8 select myobj( 1, sysdate, 'test' )
9 bulk collect into tab
10 from dual
11 ;
12
13 /*
14 SELECT myObj(case_id, creation_date, bo_id_cust)
15 bulk collect into tab
16 from ps_rc_case
17 where rownum < 10;
18 */
19
20 dbms_output.put_line(tab.count); --- While debugging its shows the value as 10
21
22 open ref_cur for select * from table(tabFun(tab));
23 --- Here I am getting the error "Unable to read rows from non nested table"
24
25 END;
26 /
Procedure created.
SQL> show errors
No errors.
SQL>
SQL> set serveroutput on
SQL>
SQL> variable v_ref_cursor refcursor
SQL>
SQL> execute myproc( :v_ref_cursor );
1
PL/SQL procedure successfully completed.
SQL>
SQL> print v_ref_cursor
F1 F2 F3
1 29-APR-06 testTry running the test case from a clean user. Perhaps some objects aren't really defined the way you expect them to be in the user you're currently testing under. -
PL/SQL Pipelined Function to Compare *ANY* 2 tables
I am trying to create a pipelined function in 10g R1 that will take the name of two tables, compare the the tables using dynamic SQL and pipe out the resulting rows using the appropriate row type. The pipelined function will be used in a DML insert statement.
For example:
create table a (f1 number, f2, date, f3 varchar2);
create table b (f1 number, f2, date, f3 varchar2);
create table c (f1 number, f2, date, f3 varchar2);
create or replace TYPE AnyCollTyp IS TABLE OF ANYTYPE;
create or replace TYPE CRowType IS c%ROWTYPE;
create or replace TYPE CRowTabType IS table of CRowType;
CREATE OR REPLACE FUNCTION compareTables (p_source IN VARCHAR2, p_dest IN VARCHAR2)
RETURN AnyCollTyp PIPELINED
IS
CURSOR columnCur (p_tableName IN user_tab_columns.table_name%TYPE)
IS
SELECT column_name, column_id
FROM user_tab_columns
WHERE table_name = p_tableName
ORDER BY column_id;
l_cur sys_refcursor;
l_rec ANYTYPE;
l_stmt VARCHAR2 (32767);
BEGIN
l_stmt := 'select ';
FOR columnRec IN columnCur (p_dest)
LOOP
l_stmt := l_stmt || CASE
WHEN columnRec.column_id > 1
THEN ','
ELSE ''
END || columnRec.column_name;
END LOOP;
l_stmt := l_stmt || ' from ' || p_source;
l_stmt := l_stmt || ' minus ';
l_stmt := l_stmt || ' select ';
FOR columnRec IN columnCur (p_dest)
LOOP
l_stmt := l_stmt || CASE
WHEN columnRec.column_id > 1
THEN ','
ELSE ''
END || columnRec.column_name;
END LOOP;
l_stmt := l_stmt || ' from ' || p_dest;
OPEN l_cur FOR l_stmt;
LOOP
FETCH l_cur
INTO l_rec;
PIPE ROW (l_rec);
EXIT WHEN l_cur%NOTFOUND;
END LOOP;
CLOSE l_cur;
RETURN;
END compareTables;
The pipelined function gets created without error. However, the testCompare procedure gets an error:
SQL> create or replace procedure testCompare is
begin
insert into c
select *
from (TABLE(CAST(compareTables('a','b') as cRowTabType)));
dbms_output.put_line(SQL%ROWCOUNT || ' rows inserted into c.');
end;
Warning: Procedure created with compilation errors.
SQL> show errors
Errors for PROCEDURE TESTCOMPARE:
LINE/COL ERROR
3/4 PL/SQL: SQL Statement ignored
5/47 PL/SQL: ORA-22800: invalid user-defined type
Does anyone know what I am doing wrong? Is there a better way to compare any two tables and get the resulting rows?904640 wrote:
Hi All,
Is it possible to post messages to weblogic JMS queue from pl/sql procedure/function?
From this Queue, message will be read by OSB interface.
Any help will be highly appreciated.
http://www.lmgtfy.com/?q=oracle+pl/sql+weblogic+jms+queue -
Pipelined function..please help
hi all...
i need a fuction which will split the data n insert into the table...
i created a fuction like this :
CREATE OR REPLACE FUNCTION FN_SPLIT(text IN VARCHAR2 DEFAULT NULL,delimiter IN VARCHAR2 DEFAULT ' ')
RETURN SPLIT_TYPE_TABLE PIPELINED
IS
PRAGMA AUTONOMOUS_TRANSACTION;
TYPE ref0 is REF CURSOR;
myCursor ref0;
out_rec SPLIT_TYPE := SPLIT_TYPE(null, null);
--CURSOR MSTFRC IS SELECT * FROM TEMP_SPLIT;
index_ NUMBER(10,0);
BEGIN
BEGIN
/*index_ := -1;
cnt:=0;
l_str:=text;
loop
l_n := instr( l_str, delimiter );
exit when (nvl(l_n,0) = 0);
cnt:=cnt+1;
INSERT INTO TEMP_SPLIT (ID,NAME)
VALUES (cnt,ltrim(rtrim(substr(l_str,1,l_n-1))));
l_str := substr( l_str, l_n+1 );
end loop;*/
Load_Temp_Splitting(text,delimiter);
open myCursor for select * from temp_split;
LOOP FETCH myCursor into out_rec.ID,out_rec.NAME;
EXIT WHEN myCursor%NOTFOUND;
PIPE ROW(out_rec);
END LOOP;
CLOSE myCursor;
RETURN;
END;
END FN_SPLIT;
it created succesfully without errors but when i run this function it showing an error like cannot evaluate pipelined function..
my requirement is to split the data like 'as,af,er,yt' split this by comma n insert into the table with row id like
1 as
2 af
3 er
like...
please help friends....
thnks in advance...
lol
Neethu> when i run this function it showing an error like cannot evaluate pipelined
function.
And that is one of the most important pieces of the puzzle - the actual error displayed. What is it? (full error, i.e. number + message)
As for the code in the function. That looks a bit like an ugly hack to me. Why the INSERT into table? Why not simply use a local collection or array?
And why a pipelined table function specifically?
The following code demonstrates a string split function:
SQL> create or replace type TStrings as table of varchar2(4000);
2 /
Type created.
SQL>
SQL> create or replace function tokenise( cString varchar2, cSeparator varchar2 DEFAULT ',' ) return TStrings AUTHID CURRENT_USER is
2 strList TStrings;
3 str varchar2(4000);
4 i integer;
5 l integer;
6
7 procedure AddString( cLine varchar2 ) is
8 begin
9 strList.Extend(1);
10 strList( strList.Count ) := cLine;
11 end;
12
13 begin
14 strList := new TStrings();
15
16 str := cString;
17 loop
18 l := LENGTH( str );
19 i := INSTR( str, cSeparator );
20
21 if i = 0 then
22 AddString( str );
23 else
24 AddString( SUBSTR( str, 1, i-1 ) );
25 str := SUBSTR( str, i+1 );
26 end if;
27
28 -- if the separator was on the last char of the line, there is
29 -- a trailing null column which we need to add manually
30 if i = l then
31 AddString( null );
32 end if;
33
34 exit when str is NULL;
35 exit when i = 0;
36 end loop;
37
38 return( strList );
39 end;
40 /
Function created.
SQL>
SQL> select tokenise( 'as,af,er,yt' ) from dual;
TOKENISE('AS,AF,ER,YT')
TSTRINGS('as', 'af', 'er', 'yt')
SQL>
SQL> select * from TABLE( tokenise( 'as,af,er,yt' ) );
COLUMN_VALUE
as
af
er
yt
SQL> -
Apex can't parse query on pipelined function
Hi,
I have a report based on a sql query which selects from a pipelined function. The pipeline function and the collection sql type it returns live in the parsing schema of the application.
I get the error: "Query cannot be parsed within the Builder." There is no ORA-xxxxx message.
If I check "generic columns" (parse at runtime), and run, it says "ORA-00904 <name of pipelined function>: invalid identifier".
If I qualify the name of the pipelined function with the schema name, it works.
Or, if I replace the bind variables with literals, it works.
Or, if I replace the columns with *, it works.
I'm using Apex 2.0
Does anyone have an ideas why I am seeing this behaviour?marnold,
Can you show the query you're using in your report?
I have used pipelined functions many times, you can see an example of how I've used them here -
http://jes.blogs.shellprompt.net/2006/05/25/generic-charting-in-application-express/
and I haven't encountered any significant problems. -
How to Passing clob to PL/SQL pipeline function
I have a PL/SQL stored function which takes clob as input parameter and sends the results in a pipe line.
create or replace function GetIds(p_list clob, p_del varchar2 := ',') return ideset_t pipelined is
I am using ojdbc14.jar (Oracle 10g driver) with oracle 9i (9.2.0.1.0).
I want to use the following SQL Query select * from table(GetIds(clob))
Now the question is how can I pass the clob from JDBC?
Here is my client code
PreparedStatement stmt = con.prepareStatement("SELECT COLUMN_VALUE FROM TABLE(GETIDS(?, ','))");
stmt.setCharacterStream(1, new StringReader(str), str.length());
stmt.executeQuery();
I get the following error when I try to run the program. The same thing works fine if the chracter lenght is less than some chaaracters.
java.sql.SQLException: ORA-01460: unimplemented or unreasonable conversion requested
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:623)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:181)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:420)
at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:896)
at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:452)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:986)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2888)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:2960)
at Test.main(Test.java:42)
Exception in thread "main"
The setChracterStream works for any insert/update clob. Example when I tried the query (INSERT INTO CLOB_TEST VALUES(?)) setCharacterStream just works fine.
Please any one can help me how to solve this.
Thanks in advance.Hóla LuÃs,
when you pick the PL/SQL function body returning a boolean, it implicitly means that TRUE means OK, while FALSE means error, always.
In order to associate such error to a given form field, you have to go back to the page definiton / validations and specify the name of the item in the corresponding field.
When you first create the validation rule, this value is not present even if you ask for the error message inline with the field.
The error message text can be specified in the validation definition, if I am not wrong.
When you need to return special error messages, including dynamic content for instance, you can use the Function Returning Error Message type, which reports an error when the string returned by the function is not null. This comes in handy when you want to display an item's code, for example, rather than generic text.
Even in this case, you must go back to the validation and specify the name of the field if you want to see it inline.
Hope it helps,
Flavio -
How to show error message in a report program
Hello Guys,
I am making a report using smartforms. I am successful in showing data but problem is if if i put a value in parameters that does not exist is database, the smartform runs and related fields shows as empty fields. But the form is running. I want to show error message if the parameter values dose not matches with the database values. The message will show as Document not exists
So i used related error msg here like
if sy-subrc ne 0.
message e357.
endif.
But it is not working for passing values to smartform. It works if i use in classical report. Plz help me on this issue.
Thanks,
Rosaline.>
Rosaline. wrote:
> Thanks all for reply. Should i have to use message before call function 'SSF_FUNCTION_MODULE_NAME' ? I tried it but not working.
>
>
if it_final[] is not initial.
>* if sy-subrc ne 0. ---> "Remove this condition check, it not required
> Message e000(8i) with 'Parameter value not found'.
> endif.
> * endif. ---> "remove this
>
Hi,
Sy-subrc doesnt need to be validated here, remove that If condition and check again.
Regards,
Karthik D -
Hi!
I have a problem with List View Report in mobile application (theme 50 in apex) after updating to apex 4.2.2. I created Report -> List View. I used select from pipelined function in Region Source. Then when page is running and submited three times (or refreshed three times) I get an error:
Error during rendering of region "LIST VIEW".
ORA-01007: variable not in select list
Technical Info (only visible for developers)
is_internal_error: true
apex_error_code: APEX.REGION.UNHANDLED_ERROR
ora_sqlcode: -1007
ora_sqlerrm: ORA-01007: variable not in select list
component.type: APEX_APPLICATION_PAGE_REGIONS
component.id: 21230833903737364557
component.name: LIST VIEW
error_backtrace:
ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 4613
ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 3220
I get this error only when I use select from pipelined function in Region Source (for example: "select value1, value2 from table(some_pipelined_function(param1, param2)) ").
You can check it on http://apex.oracle.com/pls/apex/f?p=50591 (login - demo, password - demo).
In this application:
- I created package TAB_TYPES_PKG:
create or replace PACKAGE TAB_TYPES_PKG IS
TYPE cur_rest_r IS RECORD (
STR_NAME VARCHAR2(128),
INFO VARCHAR2(128)
TYPE cur_rest_t IS TABLE OF cur_rest_r;
END TAB_TYPES_PKG;
- I created pipelined function TEST_FUNC:
create or replace
FUNCTION TEST_FUNC
RETURN TAB_TYPES_PKG.cur_rest_t PIPELINED IS
r_cur_rest TAB_TYPES_PKG.cur_rest_r;
BEGIN
r_cur_rest.STR_NAME := 'ROW 1';
r_cur_rest.INFO := '10';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 2';
r_cur_rest.INFO := '20';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 3';
r_cur_rest.INFO := '30';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 4';
r_cur_rest.INFO := '40';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 5';
r_cur_rest.INFO := '50';
PIPE ROW (r_cur_rest);
RETURN;
END TEST_FUNC;
- I created List View Report on Page 1:
Region Source:
SELECT str_name,
info
FROM TABLE (TEST_FUNC)
We can see error ORA-01007 after refresing (or submiting) Page 1 three times or more.
How to fix it?Hi all
I'm experiencing the same issue. Predictably on every third refresh I receive:
Error
Error during rendering of region "Results".
ORA-01007: variable not in select list
Technical Info (only visible for developers)
is_internal_error: true
apex_error_code: APEX.REGION.UNHANDLED_ERROR
ora_sqlcode: -1007
ora_sqlerrm: ORA-01007: variable not in select list
component.type: APEX_APPLICATION_PAGE_REGIONS
component.id: 6910805644140264
component.name: Results
error_backtrace: ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 4613 ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 3220
OK
I am running Application Express 4.2.2.00.11 on GlassFish 4 using Apex Listener 2.0.3.221.10.13.
Please note: this works perfectly using a classic report in my desktop application; however, no joy on the mobile side with a list view. I will use a classic report in the interim.
My region source is as follows:
SELECT description AS "DESCRIPTION", reference AS "REFERENCE" FROM TABLE(AUTOCOMPLETE_LIST_VIEW_FNC('RESULTS'))
The procedure:
FUNCTION AUTOCOMPLETE_LIST_VIEW_FNC(
p_collection_name IN VARCHAR2)
RETURN list_row_table_type
AS
v_tab list_row_table_type := list_row_table_type();
BEGIN
DECLARE
jsonarray json_list;
jsonobj json;
json_clob CLOB;
BEGIN
SELECT clob001
INTO json_clob
FROM apex_collections
WHERE collection_name = p_collection_name;
jsonobj := json(json_clob);
jsonarray := json_ext.get_json_list(jsonobj, 'predictions');
FOR i IN 1..jsonArray.count
LOOP
jsonobj := json(jsonArray.get(i));
v_tab.extend;
v_tab(v_tab.LAST) := list_row_type(json_ext.get_string(jsonobj, 'description'), json_ext.get_string(jsonobj, 'reference'));
END LOOP;
RETURN(v_tab);
END;
END AUTOCOMPLETE_LIST_VIEW_FNC;
Thanks!
Tim -
How to show error message on page #NOTIFICATION_MESSAGE#?
Hi,
Is it possible to show error message on a page, where apex substitutes #NOTIFICATION_MESSAGE# at page template, with a javascript call? My requirement is to report error messages which i get from ondemand process, these on-demand processes were called from my javascript code. If any error message is returned by on-demand process, as of now, I'm reporting the error message to user by javascript based alert dialog box, but it would much better if i could keep the error message reporting by my application in a consistent manner. So any suggestion please?
-KrishnaHi Roel,
Thanks, jumping in for help.
I tried your given code, i found that the page html source doesnt has any element with a name '#messages'. As per my understanding, its the apex engine which checks for any error, if found it shows it by adding an element id '#messages', but here on my requirement its not the apex engine which has detected the error, its my functional logic which wants to report a message. On a normal and error free page condition, we usually dont find '#message' element. I'm curious on how apex inbuilt engine is reporting an error to a page? -
Showing error while creating IT0000 ee record
Hi,
I am new to HR functional. Please do need full.
When i am creating record in infotype 0000, it is showing error like No entry in table T503 for 779.
I am giving value 7 fro employee group and 79 for employee subgroup.
Is there any where that i can enter value 779.
Thanks,
ThrilleswarHi ram,
Thanks so much..
this error is resolved but the other error is showing like Number range 01 is internal, do not enter a personnel number.
Is there any place that i can be able to make my number work here.
Thanks,
Thrilleswar -
PO is getting created but showing error is address with status of IDoc - 51
Hi Experts,
I am using IDoc type - PORDCR103
Process code - copy of IDOC_INPUT_PORDCR1 (Function Module)
After processing through WE19 it is generating an IDoc number with status - 51 showing error in Address , But it is creating a PO.
My requirement is In status -51 It should not create PO.
Inside IDOC_INPUT_PORDCR1 a Bapi 'BAPI_PO_CREATE1' is used for creating PO. Here In RETURN parameter of BAPI a Row is comming with Message type - E. Some other messages are also there of type 'S' and 'W'.
After processing , PO is getting created with staus - 51.
Please help me .
Thanks
Susanta
Edited by: Susanta22 on Oct 11, 2011 12:29 PMHi,
in ur code ur filling the idoc data rcord, control record ryt ..before u append data to idoc data , u r also validating and u might be doing in loop for appening the idoc data.
if there is any error in idoc then it won't distribute the data, it will be in error status only..u can only see the data in WE02. Then u can also change the data in WE02 and redistirbute it via BD87.
if u have any conerns let me know
Regards,
Nagaraj
Maybe you are looking for
-
Iphone 3GS all of a sudden will not charge!
I'm hoping to possibly get an solution to the following problem. I haven't seen too many of people posting about this problem. I've had my Iphone 32 gig 3gs for about 3 months. Everything has been working great. It has good battery life, syncs with i
-
I installed lv 6.1 on a windows 98 system. As I am having problems of stability (frequent crashes, much more than with the former release 6.0), I would like to know if there is some specific problem with windows 98 or there is some patch available.
-
Integration with Peoplesoft using OA adapter
Hi I am not experiened on integrating/consuming Peoplesoft functionality from external system/application/BPEL/OSB. What i understood after reading few messages that Peoplesoft Intergration Broker can be used to expose Peoplesoft component interface
-
Soundbooth CS5 5.1 DD-Spur neuabmischen
Hallo, ich habe von Minnetonka den Surcode für Dolby Digital 5.1 für CS5. Mein Ausgangsproblem ist, wie kann ich meine 5.1 Dolby Digital Tonspuren einzeln bearbeiten und dann wieder in 5.1 als z. B.: .aac File ausgeben? Ich habe hierzu in Soundboot
-
Link to learn step by step Oracle 9i AS portal version 902
Dear All, due to limited budget on memory, I want to study Oracle 9i AS Portal version 9.02. Does anybody know the link to learn how to develop portal on oracle 9.02 step by step? help me plz.... Regards Erie