Somtimes, we will need to debug some SQLs and try to run them within environment parameters.
It will be complex to debug in PL/SQL by setting fnd_client_infor or else.
Following is the way to run debug SQL quickly within the right environgment you want:
(1) Login any application or form. to the situation you want to chek SQL data (e.g. Enter 'Inventory' resp, change organization to M1 and open Receiving Transaction form. and go on with following steps)
(2) Click menu 'Help' - 'Diagnostics' - 'Examine'
(3) Imput apps password and OK
(4) Enter the following information in 'Examine Field and Variable Values' window:
-- Block = *SELECT*
-- Field = Input you SQL here and TAB , you will get the SQL result
Kep points: this function has lots of limitation and please find the tips below
(A)For only 1 field of just 1 row: Suggest you to try the following 'Field' to get the sense of it:
--Right Test case1:sysdate
--Right Test case2:(Select count(*) from po_headers_all)
--Right Test case3:(Select segment1 from po_headers_all where segment1 like 'TAG%' and rownum=1)
--Wrong test case 4: (Select segment1,creation_date from po_headers_all)
--Wrong test case 5: (Select segment1,creation_date from po_headers_all and rownum=1)
--Right test case 6: (Select segment1 from po_headers_all and rownum=1)
Solution: If you want to select multi rows or columns, you should change condition and select to run more times.
(B)SQL length is limited to 80
--Right Test case3:(Select segment1 from po_headers_all where segment1 like 'TAG%' and rownum=1) --Length is 79 < 80 and OK
--Wrong Test case3:(Select NVL(segment1,'88') from po_headers_all where segment1 like 'TAG%' and rownum=1) --Length overflow
Solution: If we need to run a big SQL which is more than 80 (e.g. 1000 chars), we can create a view in PL/SQL(e.g. CPO_TAG_TEST1_V) and use the view for a single query (e.g. Select segment1 from CPO_TAG_TEST1_V where rownum=1)
Hope it will be helpful in your work, especially in View debug and test data inquiry.
作者：pan_tian 发表于2012-4-6 17:01:33 原文链接
Link URL: http://blog.csdn.net/pan_tian/article/details/7433043
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/26687597/viewspace-721776/，如需转载，请注明出处，否则将追究法律责任。