Home » Applications » Oracle Fusion Apps & E-Business Suite » Equivalent SQL query from R11 to R12
Equivalent SQL query from R11 to R12 [message #462134] Tue, 22 June 2010 22:24 Go to next message
xhyrruz
Messages: 14
Registered: June 2010
Location: Philippines
Junior Member

Hi Everyone,

Anyone help me to convert the query below from R11 to R12. Some tables in R11 were changed in R12.

SQL Query 1:
select a.check_id, a.bank_account_id,upper(nvl(a.attribute3,a.vendor_name)) cv_pay_to, 
 to_char(a.creation_date,'FMMONTH DD, YYYY') cv_date,
a.doc_sequence_value cv_number,
'*'||ltrim(to_char(a.amount,'999,999,990.90')) ||'*' cv_net_amount,
'**'||apps.kcc_amt_to_words(a.amount,a.currency_code) ||'**' cv_pesos,
a.current_bank_account_name cv_bank_name,
a.check_number cv_check_number,
case when a.future_pay_due_date is null then
     a.check_date
	 else 
	 a.future_pay_due_date
end cv_check_date,
b.invoice_num, b.invoice_date, b.description invoice_desc 
from apps.ap_checks_v a, apps.ap_invoice_payments_v b
where a.bank_account_id = :p_bank_acctno
and a.status_lookup_code <> 'VOIDED'
and a.check_number between :p_chk_number and  :p_to_chk_number
and a.check_id=b.check_id(+)

SQL Query 2:
select check_id, account, description, sum(debit) debit, sum(credit) credit
from 
(select a.check_id, 
	   c.segment2||'-'||c.segment3 account,
	   d.description, 
	   a.amount debit,
	   null credit 
from apps.ap_invoice_payments_v a, apps.ap_invoices_v b, apps.gl_code_combinations c, apps.fnd_flex_values_vl d
where b.invoice_id = a.invoice_id
and c.code_combination_id = b.accts_pay_code_combination_id
and d.flex_value = c.segment2
and d.flex_value_set_id = 1007699
union all
select a.check_id, 
	   d.segment2||'-'||d.segment3 account, 
	   e.description,
	   null debit,
	   b.amount_withheld credit
from apps.ap_invoice_payments_v a, apps.ap_invoices_v b, apps.ap_tax_codes c, apps.gl_code_combinations d, apps.fnd_flex_values_vl e
where a.invoice_id = b.invoice_id
and c.name = b.awt_group_name
and d.code_combination_id = c.tax_code_combination_id
and e.flex_value = d.segment2
and e.flex_value_set_id = 1007699
union all
select a.check_id, 
	   d.segment2||'-'||d.segment3 account,
	   e.description,
	   null debit, c.amount credit  
from apps.ap_checks_v a, apps.ap_bank_accounts b, apps.ap_invoice_payments c, apps.gl_code_combinations d, apps.fnd_flex_values_vl e
where b.bank_account_id = a.bank_account_id
and c.check_id = a.check_id
and d.code_combination_id = b.cash_clearing_ccid
and e.flex_value = d.segment2
and e.flex_value_set_id = 1007699)
group by check_id, description, account
order by debit, account, description

Any help appreciated.

Thanks.
Cyrus
Re: Equivalent SQL query from R11 to R12 [message #462157 is a reply to message #462134] Wed, 23 June 2010 01:30 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:
Some tables in R11 were changed in R12.

No backward compatibility, moreover regarding the fact that these are very close releases? From my point of view - very strange. However, as I don't use Oracle Apps. and know nothing about that software product, let me remain puzzled in my ignorance. I hope you'll get the answer.
Re: Equivalent SQL query from R11 to R12 [message #462176 is a reply to message #462157] Wed, 23 June 2010 01:46 Go to previous messageGo to next message
xhyrruz
Messages: 14
Registered: June 2010
Location: Philippines
Junior Member

Yes, it is a fact that many table structure were totally changed in this new Oracle Apps Release. Want to know, if those tables and views in my SQL query were still actively used in this release? If not, what are those tables or view that can be used as replacement?

Hope I can find any answer here.

Any help much appreciated.
Re: Equivalent SQL query from R11 to R12 [message #462217 is a reply to message #462176] Wed, 23 June 2010 03:57 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
Cyrus,
I think you can run the same sql statements in R12 too.
All the views are available in R12.
ap_checks_v
ap_invoice_payments_v
ap_invoices_v
All the synonyms or tables also available in R12.
ap_tax_codes
ap_invoice_payments
ap_bank_accounts
gl_code_combinations
fnd_flex_values_vl
Frankly, I didn't understand what problem you are facing to use the same sql statements in R12.
But I suspect two issues.
1. kcc_amt_to_words is a custom function, you may have noticed it already.
2. You don't see any rows because of Multi-Org issue. Refer the Forum Guide for "Is count(*) giving 0 rows? (Or) Isn't SELECT giving desired output?".

By
Vamsi
Re: Equivalent SQL query from R11 to R12 [message #462292 is a reply to message #462217] Wed, 23 June 2010 07:17 Go to previous messageGo to next message
xhyrruz
Messages: 14
Registered: June 2010
Location: Philippines
Junior Member

Hi Vamsi,

I find it very useful and helpful the link you post regarding to "Multi-Org issue" because at first when I execute my SQL query inside SQL*plus it found no record. It must be set what org_id should I worked on and that's it works. But how to specify org_id inside oracle forms?

Thank you so much.

Cyrus
Re: Equivalent SQL query from R11 to R12 [message #462317 is a reply to message #462292] Wed, 23 June 2010 08:47 Go to previous messageGo to next message
vamsi kasina
Messages: 2112
Registered: October 2003
Location: Cincinnati, OH
Senior Member
I think you may need to set the following profiles.
MO: Default Operating Unit
MO: Operating Unit
MO: Security Profile
By
Vamsi
Re: Equivalent SQL query from R11 to R12 [message #462390 is a reply to message #462317] Wed, 23 June 2010 22:44 Go to previous message
xhyrruz
Messages: 14
Registered: June 2010
Location: Philippines
Junior Member

Hi Vamsi,

Thank you so much for your post. I can now see the records after running the query.

Cyrus.
Previous Topic: Average Cost
Next Topic: Advance pricing
Goto Forum:
  


Current Time: Sat May 04 06:39:21 CDT 2024