Debug a package
Hello,
I am trying to debug a package.
The package is invooked through a table function like
select * from table(hrs_vu_hrs_vu_xx_fn.get_hrs_vu_xx_fn_lst(2009,8))
where sub_section_id = 33
How can I debug this package, please advise,
Thanks
IQ wrote:
select * from table(hrs_vu_hrs_vu_xx_fn.get_hrs_vu_xx_fn_lst(2009,8))
where sub_section_id = 33 You are aware that having the where clause there like that, will cause the pipelined table function to have to return all rows, right?
Whenever I select from a table function, there's never a where-clause. I supply all necessary context to it, so that it only returns (pipes) the rows that are required.
So in this case, I would:
select *
from table(hrs_vu_hrs_vu_xx_fn.get_hrs_vu_xx_fn_lst(2009,8,33)) -- added third parameter hereAnd change the code of GET_HRS_VU_XX_FN_LST to only pipe the rows that are needed.
Not a answer to your question, just a comment on your code.
Toon
Similar Messages
-
Cannot Debug SSIS packages in 64 bit mode.
Hi,
To anyone who may be able to help. We are using SQL server 2014 Enterprise addition. Visual studio 2013, SSDT latest version installed, all 64 bit tools installed. I have tried to run my packages with the "Run64bitRuntime"
set to true ( project properties-->Debugging-->Run64BitRuntime = True). Initially I thought it an issues with my package (we migrated them from SSIS 2008R2, they run fine with no issues within the 32 bit memory constraints) so I created
a super simple package with VS 2013 in the SSIS 2014 environment from scratch, a lookup and an OLEDB Data source that's it. Same problem. No matter what I do when I debug in SSIS the 32 bit process (DtsDebugHost.exe (32 bit)) fires up,
even though I have selected debug in 64 bit runtime I cannot get the 64 bit version of DtsDebugHost to run. This is an issue because I am debugging projects that will utilise more than 4GB of memory for say a particular set of lookups. Curiously
when I schedule the projects to run in the scheduler, it fires up a 64 bit process, and the package executes successfully, however if I can't debug in 64 bit mode and leverage the extra memory at the design stage,
this is useless. I have checked obvious things like the path environment variable, thinking perhaps SSIS debug doesn't know where the 64 bit exe is, but it is all fine paths are as they should be. All 64 bit tools/dll's are installed. I
have tested this directly on the server, and on the client machine that I use and the issue is the same. If no one can help me here I guess I can log a support ticket.
thanks in advance.Hi des_77,
According to your description, you can only debug your SSIS package in 32 bit mode.
Based on my research, I think the issue is caused by 64bit SSIS runtime is not installed on your machine. We can verify the issue by seeing if DtsDebugHost.exe under <Installation Drive>\Program Files\Microsoft SQL Server\120\DTS\Binn or not.
To fix this issue, please install SQL Server and select Integration Services for installation, Setup installs all available 64-bit Integration Services features and tools. Then we can set the Debug Options property Run64BitRuntime to “True”, view the processes
in Windows Task Manager to verify the version of DTDebugHost.exe when debugging the package.
Besides, if the issue still existed, it is my pleasure to help you to reflect your recommendation to the proper department for their consideration. Please feel free to submit your situation on our product to the following link
https://connect.microsoft.com/SQLServer/. Your feedback is valuable for us to improve our products and increase the level of service provided.
References:
http://blogs.msdn.com/b/dataaccesstechnologies/archive/2014/05/22/ssis-packages-executed-from-visual-studio-business-intelligence-development-studio-bids-design-time-on-a-64bit-development-server-goes-to-unresponsive-state-during-package-execution.aspx
http://dougbert.com/blog/post/64-bit-considerations-for-sql-server-integration-services-final.aspx
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
How to debug a Package / function in PL SQL developer ??
How can we debug a Package / function in PL SQL developer ??
i want to debug a code line by lineKarthick_Arp wrote:
This question does not belong to this fourm. We have a {forum:id=260} forum for such question.Not even there Karthick. PL/SQL Developer is a 3rd party tool, not Oracle's SQL Developer, so it doesn't even belong on the Oracle forums. -
Compile for Debug Proc/Package Size
Was attempting to debug a package on a DB but when compiling for debug got a message along the lines of 'Pacakge to large' and the compilation finished with warnings.
Is there a max size the compile for debug can handle and if so what is it.
Thanks
PaulGoogle gave me this from the Oracle 11.1 PL/SQL Langauge Reference:
>
In the shared memory pool, a package spec, object type spec, standalone subprogram, or anonymous block is limited to 67108864 (2**26) DIANA nodes which correspond to tokens such as identifiers, keywords, operators, and so on. This allows for <b>~6,000,000 lines of code</b>...
>
http://download-west.oracle.com/docs/cd/B28359_01/appdev.111/b28370/limits.htm -
Can we trace the values in a cursor if we debug the package?
Can we trace the values in a cursor if we debug the package having a cursor?
Does it shows cursor attributes like %rowcount,%notfound,%found etc?
Because i am debugging a pachage , and I am getting the exception.
And its after the fetching of a cursor I am hitting on the exception.
If I click the profilier after I debug, its showing the error ora 1775::looping chain of synonyms.
The scenario is after the fetching of cursor, i am hitting the exception and after debug If i see the profilier I am getting the error 1775::looping chain of synonyms.Firslty, thanks for your time.
I am using the PLSQL developer.
The select command in the cursor picks tha value but when it fetches, it is showing the error.
Any idea what could be the reason.?
FETCH get_notices ----would show ( rowcount =0,%open,first iteration), does that mean cursor is not picking any value?
Because i have checked the select statement and it picks the value. -
Debug of package results in ORA-30683
I'm having a problem trying to debug any package with SQL Developer.
Environment : Windows SQLDeveloper 1.1 to Unix database with SID "eai"
It's returning the following error messages :-
Connecting to the database eai.
Executing PL/SQL: ALTER SESSION SET PLSQL_DEBUG=TRUE
Executing PL/SQL: ALTER SESSION SET PLSQL_COMPILER_FLAGS=INTERPRETED Executing PL/SQL: CALL DBMS_DEBUG_JDWP.CONNECT_TCP( '127.0.0.1', '3717' )
ORA-30683: failure establishing connection to debugger
ORA-12541: TNS:no listener
ORA-06512: at "SYS.DBMS_DEBUG_JDWP", line 68
ORA-06512: at line 1
Process exited.
Disconnecting from the database eai.
Listener is OK.
tnsnames.ora file works and the list of databases comes up in the "new connection".
I'd be grateful for any assistance you could provide.The database needs to connect back to your PC for debugging. Sometimes sqldeveloper can't determine the address to pass to the database.
Go to Tools -> Preference -> Debugger and select Prompt for Debugger Host for Database Debugger.
You may still have problems if there is a firewall between you and the server. -
We are trying to create a project using the api code pa_project_pub.create_project. But we are unable to create due to some unexpected error status flag when pa_project_pvt.add_class_categories is executed. We tried by going through the code but it was in vain.
So couple of questions from our side.
1) Can we debug the package procedure pa_project_pvt.add_class_categories by any chance?
2) If yes, then what is the debugging process?
Any help in this regard would be helpful.
Thanks in advance.Hi,
you may try to enable debugging via Sysadmin responsibility by setting following profile options, either for a certain user (preferred) or a certain responsibility:
- "FND: Debug Log Enabled" set it to yes
- "FND: Debug Log Level" set it to 1 (but only temporarily, as it generates lots of loggings)
- "FND: Debug Log Module" set it to "pa" or "PA"
You'll have to log off and login to apps again for the profile options to come into effect.
Before you start your process, have a look at fnd_log_messages table (write down last value LOG_SEQUENCE,
so you can identify the loggings for your process easier) by filtering column log_sequence, module and user_id
(which is the user_id coming from fnd_user table).
Make sure that you set apps context (fnd_global.apps_initialize) correctly before the logic of your api call starts.
Regards. -
Output Error When Debugging the Package
Hi,
I just created my first SSIS Package, with OLE DB Connection pointing to our Oracle server and using SQL SERVER Destination. When I Debug, I get the following error:
SSIS package "C:\Users\Documents\SQL Server Management Studio\Packageload.dtsx" starting.
Information: 0x4004300A at Load Season, SSIS.Pipeline: Validation phase is beginning.
Error: 0xC0209303 at Packageload, Connection manager "ABCDEF": The requested OLE DB provider MSDAORA.1 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode. Error code: 0x00000000.
An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered".
Error: 0xC020801C at Load Season, OLE DB Source [46]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "ABCDEF" failed with error code 0xC0209303. There may
be error messages posted before this with more information on why the AcquireConnection method call failed.
Error: 0xC0047017 at Load Season, SSIS.Pipeline: OLE DB Source failed validation and returned error code 0xC020801C.
Error: 0xC004700C at Load Season, SSIS.Pipeline: One or more component failed validation.
Error: 0xC0024107 at Load Season: There were errors during task validation.
Warning: 0x80019002 at Packageload: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (5) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches
the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors.
SSIS package "C:\Users\Documents\SQL Server Management Studio\Packageload.dtsx" finished: Failure.
I tried setting the DelayValidation property to True, but still getting same error.
Thanks
ParulHi Parul,
Regarding the error “Unable to bulk copy data. You may need to run this package as an administrator”, it is described in the KB article
http://support.microsoft.com/kb/2009672:
On systems where UAC is enabled, when an application (like SSIS) is launched by an account that is a member of the Administrators group, it gets two security tokens, one a low privileged token and another an elevated token. The elevated token is only
used when the application is explicitly run under an Administrator account by choosing “Run as Administrator” option. By default SSIS always uses the low privileged token resulting in a failure when connecting to a SQL Destination.
The solution is launch the tool (SQL Server Management Studio or Business Intelligence Development Studio or DTExecUI.exe or Command Prompt) as administrator.
Regarding the original error “The requested OLE DB provider MSDAORA.1 is not registered. If the 64-bit driver is not installed, run the package in 32-bit mode”, it is because Microsoft OLE DB Provider for Oracle has only 32-bit version. To avoid this issue,
you can either run the package in 32-bit runtime mode as you have done or install the 64-bit Oracle Provider for OLE DB.
If you use Enterprise edition of SSIS 2008 or higher, you can also install the Microsoft Connector for Oracle by Attunity:
http://www.microsoft.com/en-in/download/details.aspx?id=29283
Regards,
Mike Yin
TechNet Community Support -
Compile debug causes package to become invalid
We're running 10.2.0.4.0 and I have a large package (7730 lines) which compiles fine on it's own. However, if I try to enable debug mode, I get an error:
SQL> alter package mypkg compile debug package;
Warning: Package altered with compilation errors.
SQL> show errors;
No errors.
If I perform another alter command without the debug parameter, then it compiles fine:
SQL> alter package mypkg compile package;
Package altered.
Also, if I compile this package using the "Compile for Debug" button in SQL Developer then I actually get an error message:
Error(1): PLS-00707: unsupported construct or internal error [2603]
Does anyone have any idea what's going on here? I've spent the past couple days searching for a solution and while I've seen many cases of people having the PLS-00707 error, I wasn't able to find anyone who only receives it when compiling for debug.SQL> CONN SCOTT
Connected.
SQL> SELECT * fROM V$VERSION;
BANNER
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
SQL> ALTER PACKAGE P1 COMPILE DEBUG;
Package altered.
SQL> alter session set events='10938 trace name context level 14';
Session altered.
SQL> SELECT P1.ADD_NUM(5,6) FROM DUAL;
SELECT P1.ADD_NUM(5,6) FROM DUAL
ERROR at line 1:
ORA-03113: end-of-file on communication channel
SQL> SELECT NAME FROM V$DATABASE;
SELECT NAME FROM V$DATABASE
ERROR at line 1:
ORA-03114: not connected to ORACLE
SQL> SELECT SYSDATE FROM DUAL;
SELECT SYSDATE FROM DUAL
ERROR at line 1:
ORA-03114: not connected to ORACLE
can one tell me how to solve this problem? thanks in advance. -
Debugging of packages on XE10 / ODT11 doesnt seem to work
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
ODT 11.1.7.20
Microsoft Visual Studio 2008
Version 9.0.21022.8 RTM
Microsoft .NET Framework
Version 3.5 SP1
Installed Edition: Professional
Microsoft Visual Basic 2008 91605-270-0762051-60359
Microsoft Visual Basic 2008
Microsoft Visual C# 2008 91605-270-0762051-60359
Microsoft Visual C# 2008
Microsoft Visual C+ 2008 91605-270-0762051-60359+
Microsoft Visual C+ 2008+
Microsoft Visual Studio 2008 Tools for Office 91605-270-0762051-60359
Microsoft Visual Studio 2008 Tools for Office
Microsoft Visual Web Developer 2008 91605-270-0762051-60359
Microsoft Visual Web Developer 2008
Crystal Reports AAJ60-G0MSA4K-68000CF
Crystal Reports Basic for Visual Studio 2008
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB944899) KB944899
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/944899.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB945282) KB945282
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/945282.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946040) KB946040
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946040.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946308) KB946308
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946308.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946344) KB946344
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946344.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946581) KB946581
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/946581.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947171) KB947171
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947171.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947173) KB947173
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947173.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947180) KB947180
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947180.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947540) KB947540
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947540.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947789) KB947789
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/947789.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB948127) KB948127
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/948127.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB952241) KB952241
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/952241.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB953256) KB953256
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/953256.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB971091) KB971091
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/971091.
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB973674) KB973674
This hotfix is for Microsoft Visual Studio 2008 Professional Edition - ENU.
If you later install a more recent service pack, this hotfix will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/973674.
Oracle Developer Tools for Visual Studio 11.1.0.7.20
Oracle Developer Tools for Visual Studio Copyright (c) 2005, 2009
+.NET Reflector+
Visual Studio add-in that integrates .NET Reflector into Visual Studio to allow you to seamlessly debug into third-party code and assemblies, even if you don't have the source code for them.
Visit www.red-gate.com for more information.
Copyright (c) 2009-2010 Red Gate Software Inc.
Xsd2Code
For more information about , see the website at
http://www.codeplex.com/Xsd2Code
Copyright (c) Pascal Cabanel 2009 Inc.
I followed all instructions here http://cshay.blogspot.com/2006/07/plsql-debugger-in-visual-studio.html
(even the application debugging ones which I didnt think I'd need)
I've set breakpoints and Run Debug. I've also tried Step Into
Visual Studio just hangs..
If I set a breakpoint in the C# app code, press play, I see that my PLSQL breakpoints are invisible circles with warning messages "No breakpoints will be hit: no symbols loaded"
Packaged procedures just run without breaking on point
ODT10 and VS2005 used to allow me to debug..(always have to ask about the debug :)
have you tried it in developer? may be a DEBUG CONNECT SESSION privilege (see below)
also Check this:
tools-> Options -> Oracle Developer Tools -> pl/sql Debugging--> is the correct database connection selected
http://www.oracle.com/technology/software/tech/dotnet/odt10202rn.html
snippet...
Configuring PL/SQL debugging for first use
Please see the online help for information detailing what configuration steps are required before PL/SQL debugging is possible. This includes the following database side configurations:
* The database must be an Oracle database release 9.2 or later.
* Requirements for Oracle Database 10g Release 1 (10.1) and later:
o The connected user must have the DEBUG CONNECT SESSION privilege to connect to a debugger, for example, GRANT DEBUG CONNECT SESSION TO HR.
o The connected user must have the DEBUG ANY PROCEDURE privilege to debug any PL/SQL program or have DEBUG and EXECUTE privileges on the PL/SQL program being debugged, for example, GRANT DEBUG ANY PROCEDURE TO HR.
* Requirements for Oracle9i Release 2 (9.2):
o The connected user must have the DEBUG ANY PROCEDURE privilege, for example, GRANT DEBUG ANY PROCEDURE TO HR.
For additional information on troubleshooting PL/SQL debugging problems, see "Features Not Covered By Documentation" below. -
Help for debug un package PL/SQL error at line 723 Encountered
create or replace package body SPR_AP_FUSION_EXTRACT_PKG is
PROCEDURE MAIN_FUSION_EXTRACT(
pv_errbuff IN OUT VARCHAR2,
pn_retcode IN OUT NUMBER
IS
lv_ligne VARCHAR2 (500);
lv_rep VARCHAR2 (260); --:= '/usr/tmp';
ln_retcode NUMBER;
vv_separator VARCHAR2 (2) := ';';
ln_compteur_lignes NUMBER := 0; -- nombre de lignes insérées dans le fichier
ln_counteur NUMBER := 0;
vv_buffer VARCHAR2 (32000);
vv_buffer_et VARCHAR2 (32000);
vv_buffer_etold VARCHAR2 (32000);
lt_id UTL_FILE.file_type;
ln_counter NUMBER (24, 0);
lv_seq VARCHAR2 (30);
lv_num_paiement VARCHAR2 (10);
flag_ecriture VARCHAR2 (1);
lv_filler_ligne VARCHAR2 (500);
ln_long_buff NUMBER := 0;
ln_compteur_factures NUMBER := 0;
lv_name VARCHAR2 (500);
vv_entete VARCHAR2 (500);
LV_INVOICE_ID ap_invoices_all.invoice_id%type;
ln_compteur_hold NUMBER := 0;
lv_hode_reason VARCHAR2 (500);
lv_release_reason VARCHAR2 (500);
lv_societe_absorbee VARCHAR2 (500);
lv_societe_absorbante VARCHAR2 (500);
ln_org_id NUMBER := 0;
lv_date_fusion DATE;
err_non_parameter Exception;
err_Soc_sr Exception;
err_file_write Exception;
err_file_invalid_path Exception;
err_ecriture_file Exception;
CURSOR cur_ap_hold_invoices
( LV$invoice_id IN AP_invoices_all.Invoice_Id%TYPE)
IS
SELECT aha.hold_reason, aha.release_reason
from ap_holds_all aha
where aha.invoice_id = LV$invoice_id
rec_ap_hold_invoices cur_ap_hold_invoices%ROWTYPE;
--Enregistrement "DESTINATAIRE"
CURSOR cur_fusion_extract_AP_invoice
( LV$Societe_absorbee IN cgey_parameters.VARCHAR2_VALUE%Type,
LV$Societe_absorbant IN cgey_parameters.VARCHAR2_VALUE%Type,
LV$Date_fusion IN cgey_parameters.DATE_VALUE%Type
IS
SELECT
Aia.Invoice_Id
, Aia.Invoice_Num
, Aia.Invoice_Type_Lookup_Code
, Aia.Invoice_Date
, Pv.Vendor_Id
, Pv.Segment1
, Pv.Vendor_Name
, pvsa.Vendor_Site_Id
, Pvsa.Vendor_Site_Code
, aia.invoice_amount
, aia.amount_paid
-- RG3: Montant repris = valeur restante a regler
, ROUND (NVL(SUM(Apsa.Amount_Remaining),0),2) Amount_Remaining
, Ap_Invoices_Utility_Pkg.get_approval_status(aia.invoice_id,aia.invoice_amount,aia.payment_status_flag,aia.invoice_type_lookup_code) STATUT
, aia.invoice_currency_code
, aia.exchange_rate
, aia.exchange_rate_type
, aia.exchange_date
, Ate.Name Terms_Name
, aia.terms_date
, aia.source
, aia.doc_category_code
, aia.payment_method_lookup_code
, aia.pay_group_lookup_code
, aia.gl_date
, Aia.Doc_Sequence_Id
, aia.accts_pay_code_combination_id
, CGEY_TOOLS_PKG.get_segments_from_ccid(Aia.Accts_Pay_Code_Combination_Id) Cle_Comptable_Founisseur
, aia.org_id
, aia.payment_cross_rate_type
, aia.payment_cross_rate_date
, aia.payment_cross_rate
, aia.payment_currency_code
, aia.attribute_category
, Aia.Attribute1
, Aia.Attribute2
, Aia.Attribute3
, Aia.Attribute4
, Aia.Attribute5
, Aia.Attribute6
, Aia.Attribute7
, Aia.Attribute8
, Aia.Attribute9
, Aia.Attribute10
, Aia.Attribute11
, Aia.Attribute12
, Aia.Attribute13
, Aia.Attribute14
, Aia.Attribute15
, Aia.Global_Attribute_Category
, Aia.Global_Attribute1
, Aia.Global_Attribute2
, Aia.Global_Attribute3
, Aia.Global_Attribute4
, Aia.Global_Attribute5
, Aia.Global_Attribute6
, Aia.Global_Attribute7
, Aia.Global_Attribute8
, Aia.Global_Attribute9
, Aia.Global_Attribute10
, Aia.Global_Attribute11
, Aia.Global_Attribute12
, Aia.Global_Attribute13
, Aia.Global_Attribute14
, Aia.Global_Attribute15
, Aia.Global_Attribute16
, Aia.Global_Attribute17
, Aia.Global_Attribute18
, Aia.Global_Attribute19
, Aia.Global_Attribute20
FROM
Ap_Invoices_All Aia
, Ap_Payment_Schedules_All Apsa
, Po_Vendor_Sites_All Pvsa
, Ap_Terms Ate
, Po_Vendors Pv
WHERE
1=1
-- RG1: Type de la facture
AND Aia.invoice_type_lookup_code IN ('STANDARD', 'CREDIT', 'DEBIT')
AND Apsa.Invoice_Id = Aia.Invoice_Id
AND Pvsa.Vendor_Site_Id = Aia.Vendor_Site_Id
AND Ate.Term_Id = Aia.Terms_Id
AND Pv.Vendor_Id = Aia.Vendor_Id
-- RG 1: pour les factures créées antétieur à la date de fusion
AND Aia.Creation_Date < LV$Date_fusion
-- RG1: Ensemble des lignes de la facture postees
AND NOT EXISTS ( SELECT 'x'
FROM
Ap_Invoice_Distributions_All Aida
WHERE
Aida.Invoice_id = Aia.Invoice_Id
AND NVL(Aida.Accrual_Posted_Flag,'N') <> 'Y' )
-- pour la société absorbée
AND aia.org_id = (select ORGANIZATION_ID from HR_ALL_ORGANIZATION_UNITS HAOU
where HAOU.Name = LV$Societe_absorbee
GROUP BY
Aia.Invoice_Id
, Aia.Invoice_Num
, Aia.Invoice_Type_Lookup_Code
, Aia.Invoice_Date
, Pv.Vendor_Id
, Pv.Segment1
, Pv.Vendor_Name
, pvsa.Vendor_Site_Id
, Pvsa.Vendor_Site_Code
, aia.invoice_amount
, aia.amount_paid
-- RG3: Montant repris = valeur restante a regler
, Apsa.Amount_Remaining
, aia.payment_status_flag
, aia.invoice_currency_code
, aia.exchange_rate
, aia.exchange_rate_type
, aia.exchange_date
, Ate.Name
, aia.terms_date
, aia.source
, aia.doc_category_code
, aia.payment_method_lookup_code
, aia.pay_group_lookup_code
, aia.gl_date
, Aia.Doc_Sequence_Id
, aia.accts_pay_code_combination_id
, aia.org_id
, aia.payment_cross_rate_type
, aia.payment_cross_rate_date
, aia.payment_cross_rate
, aia.payment_currency_code
, aia.attribute_category
, Aia.Attribute1
, Aia.Attribute2
, Aia.Attribute3
, Aia.Attribute4
, Aia.Attribute5
, Aia.Attribute6
, Aia.Attribute7
, Aia.Attribute8
, Aia.Attribute9
, Aia.Attribute10
, Aia.Attribute11
, Aia.Attribute12
, Aia.Attribute13
, Aia.Attribute14
, Aia.Attribute15
, Aia.Global_Attribute_Category
, Aia.Global_Attribute1
, Aia.Global_Attribute2
, Aia.Global_Attribute3
, Aia.Global_Attribute4
, Aia.Global_Attribute5
, Aia.Global_Attribute6
, Aia.Global_Attribute7
, Aia.Global_Attribute8
, Aia.Global_Attribute9
, Aia.Global_Attribute10
, Aia.Global_Attribute11
, Aia.Global_Attribute12
, Aia.Global_Attribute13
, Aia.Global_Attribute14
, Aia.Global_Attribute15
, Aia.Global_Attribute16
, Aia.Global_Attribute17
, Aia.Global_Attribute18
, Aia.Global_Attribute19
, Aia.Global_Attribute20
HAVING NVL(SUM(Apsa.Amount_Remaining),0) <> 0
UNION ALL
SELECT
Aia.Invoice_Id
, Aia.Invoice_Num
, Aia.Invoice_Type_Lookup_Code
, Aia.Invoice_Date
, Pv.Vendor_Id
, Pv.Segment1
, Pv.Vendor_Name
, pvsa.Vendor_Site_Id
, Pvsa.Vendor_Site_Code
, aia.invoice_amount
, aia.amount_paid
-- RG3: Montant repris = valeur restante a regler
, Ap_Invoices_Utility_PKG.get_prepay_amount_remaining (Aia.invoice_Id) "Amount_Remaining"
, Ap_Invoices_Utility_Pkg.get_approval_status(aia.invoice_id,aia.invoice_amount,aia.payment_status_flag,aia.invoice_type_lookup_code) STATUT
, aia.invoice_currency_code
, aia.exchange_rate
, aia.exchange_rate_type
, aia.exchange_date
, Ate.Name Terms_Name
, aia.terms_date
, aia.source
, aia.doc_category_code
, aia.payment_method_lookup_code
, aia.pay_group_lookup_code
, aia.gl_date
, Aia.Doc_Sequence_Id
, aia.accts_pay_code_combination_id
, CGEY_TOOLS_PKG.get_segments_from_ccid(Aia.Accts_Pay_Code_Combination_Id) Cle_Comptable_Founisseur
, aia.org_id
, aia.payment_cross_rate_type
, aia.payment_cross_rate_date
, aia.payment_cross_rate
, aia.payment_currency_code
, aia.attribute_category
, Aia.Attribute1
, Aia.Attribute2
, Aia.Attribute3
, Aia.Attribute4
, Aia.Attribute5
, Aia.Attribute6
, Aia.Attribute7
, Aia.Attribute8
, Aia.Attribute9
, Aia.Attribute10
, Aia.Attribute11
, Aia.Attribute12
, Aia.Attribute13
, Aia.Attribute14
, Aia.Attribute15
, Aia.Global_Attribute_Category
, Aia.Global_Attribute1
, Aia.Global_Attribute2
, Aia.Global_Attribute3
, Aia.Global_Attribute4
, Aia.Global_Attribute5
, Aia.Global_Attribute6
, Aia.Global_Attribute7
, Aia.Global_Attribute8
, Aia.Global_Attribute9
, Aia.Global_Attribute10
, Aia.Global_Attribute11
, Aia.Global_Attribute12
, Aia.Global_Attribute13
, Aia.Global_Attribute14
, Aia.Global_Attribute15
, Aia.Global_Attribute16
, Aia.Global_Attribute17
, Aia.Global_Attribute18
, Aia.Global_Attribute19
, Aia.Global_Attribute20
FROM
Ap_Invoices_All Aia
, Po_Vendor_Sites_All Pvsa
, Ap_Terms Ate
, Po_Vendors Pv
WHERE 1=1
-- RG2: Type de la facture
AND Aia.invoice_type_lookup_code = 'PREPAYMENT'
-- RG2: Amount_Paid <> Invoice_Amount
AND NVL(Aia.Invoice_Amount,0) = NVL(Aia.Amount_Paid,0)
AND Pvsa.Vendor_Site_Id = Aia.Vendor_Site_Id
AND Ate.Term_Id = Aia.Terms_Id
AND Pv.Vendor_Id = Aia.Vendor_Id
-- RG2: Ensemble des lignes de la facture postees
AND NOT EXISTS ( SELECT 'x'
FROM
Ap_Invoice_Distributions_All Aida
WHERE
Aida.Invoice_id = Aia.Invoice_Id
AND NVL(Aida.Accrual_Posted_Flag,'N') <> 'Y' )
-- pour la société absorbée
AND aia.org_id = (select ORGANIZATION_ID from HR_ALL_ORGANIZATION_UNITS HAOU
where HAOU.Name = LV$Societe_absorbee
-- RG 1: pour les factures créées antétieur à la date de fusion
AND Aia.Creation_Date < LV$Date_fusion
GROUP BY
Aia.Invoice_Id
, Aia.Invoice_Num
, Aia.Invoice_Type_Lookup_Code
, Aia.Invoice_Date
, Pv.Vendor_Id
, Pv.Segment1
, Pv.Vendor_Name
, pvsa.Vendor_Site_Id
, Pvsa.Vendor_Site_Code
, aia.invoice_amount
, aia.amount_paid
, aia.payment_status_flag
, aia.invoice_currency_code
, aia.exchange_rate
, aia.exchange_rate_type
, aia.exchange_date
, Ate.Name
, aia.terms_date
, aia.source
, aia.doc_category_code
, aia.payment_method_lookup_code
, aia.pay_group_lookup_code
, aia.gl_date
, Aia.Doc_Sequence_Id
, aia.accts_pay_code_combination_id
, aia.org_id
, aia.payment_cross_rate_type
, aia.payment_cross_rate_date
, aia.payment_cross_rate
, aia.payment_currency_code
, aia.attribute_category
, Aia.Attribute1
, Aia.Attribute2
, Aia.Attribute3
, Aia.Attribute4
, Aia.Attribute5
, Aia.Attribute6
, Aia.Attribute7
, Aia.Attribute8
, Aia.Attribute9
, Aia.Attribute10
, Aia.Attribute11
, Aia.Attribute12
, Aia.Attribute13
, Aia.Attribute14
, Aia.Attribute15
, Aia.Global_Attribute_Category
, Aia.Global_Attribute1
, Aia.Global_Attribute2
, Aia.Global_Attribute3
, Aia.Global_Attribute4
, Aia.Global_Attribute5
, Aia.Global_Attribute6
, Aia.Global_Attribute7
, Aia.Global_Attribute8
, Aia.Global_Attribute9
, Aia.Global_Attribute10
, Aia.Global_Attribute11
, Aia.Global_Attribute12
, Aia.Global_Attribute13
, Aia.Global_Attribute14
, Aia.Global_Attribute15
, Aia.Global_Attribute16
, Aia.Global_Attribute17
, Aia.Global_Attribute18
, Aia.Global_Attribute19
, Aia.Global_Attribute20
HAVING Ap_Invoices_Utility_PKG.get_prepay_amount_remaining (Aia.invoice_Id) <> 0
AND Ap_Invoices_Utility_Pkg.get_approval_status(aia.invoice_id,aia.invoice_amount,aia.payment_status_flag,aia.invoice_type_lookup_code) = 'AVAILABLE'
Rec_fusion_extract_AP_invoice cur_fusion_extract_AP_invoice%ROWTYPE;
BEGIN
---------Initialisation
pn_retcode := 0;
pv_errbuff := NULL;
ln_compteur_lignes := 0;
lv_societe_absorbee := CGEY_TOOLS_PKG.get_varchar2_parameter ('SPR_FUSION_AP_SOCIETE', 'SOC_SR');
lv_societe_absorbante :=CGEY_TOOLS_PKG.get_varchar2_parameter ('SPR_FUSION_AP_SOCIETE', 'SOC_CB');
lv_date_fusion := CGEY_TOOLS_PKG.get_date_parameter ('SPR_FUSION_AP_SOCIETE', 'DATE_FUSION');
lv_rep := cgey_tools_pkg.get_varchar2_parameter ('SPR_FUSION_AP_SOCIETE', 'REPERTOIRE_SORTIE');
----err_non_parameter
IF lv_societe_absorbee is null or lv_societe_absorbante is null or lv_date_fusion is null or lv_rep is null
THEN raise err_non_parameter;
select NVL(ORGANIZATION_ID, 'NULL')
INTO ln_org_id
from HR_ALL_ORGANIZATION_UNITS HAOU
where HAOU.Name = lv_societe_absorbee
----err_Soc_sr
IF ln_org_id ='NULL'
THEN Raise err_Soc_sr;
BEGIN
----Création du fichier sorti
cgey_tools_pkg.put_log_message ('Création et Ouverture du fichier en lecture');
lv_name := 'FUSION_fac_AP_EXTRAIRE' || TO_CHAR(SYSDATE, 'DDMMYYYY_HH24MISS') || '.txt';
cgey_tools_pkg.put_log_message ('Fichier sortie est '|| lv_name );
lt_id := UTL_FILE.FOPEN(lv_rep, lv_name, 'w');
IF UTL_FILE.IS_OPEN(lt_id) THEN
cgey_tools_pkg.put_log_message (cv_line);
cgey_tools_pkg.put_log_message('Creation OK du fichier: ' || lv_name);
ELSE
cgey_tools_pkg.put_log_message(cv_line);
cgey_tools_pkg.put_log_message('Probleme ouverture du fichier ' ||lv_name);
END IF;
----EXCEPTION UTL_FILE.WRITE_ERROR, UTL_FILE.INVALID_PATH
EXCEPTION
WHEN UTL_FILE.WRITE_ERROR
THEN raise err_file_write;
WHEN UTL_FILE.INVALID_PATH
THEN raise err_file_invalid_path;
----Création du fichier sorti
END;
BEGIN
UTL_FILE.PUT_LINE(lt_id, vv_entete);
----CURSOR FACTURE A EXTRAIRE
OPEN cur_fusion_extract_AP_invoice
(lv_societe_absorbee,
lv_societe_absorbante,
lv_date_fusion
LOOP
FETCH cur_fusion_extract_AP_invoice
INTO rec_fusion_extract_AP_invoice;
EXIT WHEN cur_fusion_extract_AP_invoice%NOTFOUND;
LV_INVOICE_ID := rec_fusion_extract_AP_invoice.Invoice_Id;
ln_compteur_hold := 0;
lv_hode_reason := null;
lv_release_reason := null;
OPEN cur_ap_hold_invoices (rec_fusion_extract_AP_invoice.Invoice_Id);
LOOP
FETCH cur_ap_hold_invoices
INTO rec_ap_hold_invoices;
EXIT WHEN cur_ap_hold_invoices%NOTFOUND;
----La première blocage à traiter
IF ln_compteur_hold =0 THEN
lv_hode_reason := nvl(rec_ap_hold_invoices.hold_reason, ' ') ;
lv_release_reason := nvl(rec_ap_hold_invoices.release_reason, ' ');
----concatener des autres blocages suivants pour la même facture
Else
lv_hode_reason := lv_hode_reason||nvl(rec_ap_hold_invoices.hold_reason, ' ');
lv_release_reason := lv_release_reason||nvl(rec_ap_hold_invoices.release_reason, ' ');
END IF;
ln_compteur_hold := ln_compteur_hold +1;
END LOOP;
CLOSE cur_ap_hold_invoices;
vv_buffer :=
NVL(lv_societe_absorbee, ' ') ||vv_separator||
NVL(lv_societe_absorbante, ' ') ||vv_separator||
NVL(to_char(lv_date_fusion,'dd/mm/yyyy' ), ' ') ||vv_separator||
NVL(to_char(rec_fusion_extract_AP_invoice.Invoice_Id), ' ') ||vv_separator
UTL_FILE.PUT_LINE(lt_id, vv_buffer);
ln_compteur_lignes := ln_compteur_lignes + 1;
END LOOP;
cgey_tools_pkg.put_log_message(to_char(ln_compteur_lignes) ||
' lignes inserees dans le fichier ' ||lv_rep||'/'
|| lv_name);
CLOSE cur_fusion_extract_AP_invoice;
UTL_FILE.FCLOSE(lt_id);
cgey_tools_pkg.put_log_message(' ');
cgey_tools_pkg.put_log_message(cv_line);
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
Raise err_ecriture_file;
END ;
EXCEPTION_
WHEN err_non_parameter THEN
pn_retcode := SQLCODE;
cgey_tools_pkg.put_log_message ('error'||SQLCODE);
cgey_tools_pkg.put_log_message ('error parameter : Veuillez vous verifier la configuration dans la table CGEY_PARAMETERS!');
WHEN err_Soc_sr THEN
pn_retcode := SQLCODE;
cgey_tools_pkg.put_log_message ('error'||SQLCODE);
cgey_tools_pkg.put_log_message ('error société_absorbée : Veuillez vous verifier le parameter de la société absorbée !');
WHEN err_file_write THEN
UTL_FILE.FCLOSE(lt_id);
pv_errbuff := SQLERRM;
pn_retcode := SQLCODE;
cgey_tools_pkg.put_log_message ('error'||SQLCODE);
cgey_tools_pkg.put_log_message('erreur write_error:'||pv_errbuff);
WHEN err_file_invalid_path THEN
UTL_FILE.FCLOSE(lt_id);
pn_retcode := SQLCODE;
pv_errbuff := SQLERRM;
cgey_tools_pkg.put_log_message ('error'||SQLCODE);
cgey_tools_pkg.put_log_message('erreur invalid_path:'||pv_errbuff);
WHEN err_ecriture_file THEN
UTL_FILE.FCLOSE(lt_id);
pn_retcode := SQLCODE;
pv_errbuff := SQLERRM;
cgey_tools_pkg.put_log_message ('error'||SQLCODE);
cgey_tools_pkg.put_log_message('err_ecriture_file:'||pv_errbuff);
WHEN OTHERS THEN
cgey_tools_pkg.put_log_message ('Une Erreur inconnue arrive lors que l''extraction du FUSION_fac_AP_EXTRAIRE!!');
END MAIN_FUSION_EXTRACT;
END SPR_AP_FUSION_EXTRACT_PKG;
error at line 723 PLS-100103 "EXCEPTION"
when expecting one of the following Error. Please help me!!
Thanks a lot
Edited by: kinkichin on 11 mars 2010 03:19Hi ,
I have made some changes to the code search for --check condition* and check if the condition is correct.
CREATE OR REPLACE PACKAGE BODY spr_ap_fusion_extract_pkg
IS
PROCEDURE main_fusion_extract (
pv_errbuff IN OUT VARCHAR2,
pn_retcode IN OUT NUMBER
IS
lv_ligne VARCHAR2 (500);
lv_rep VARCHAR2 (260); --:= '/usr/tmp';
ln_retcode NUMBER;
vv_separator VARCHAR2 (2) := ';';
ln_compteur_lignes NUMBER := 0;
-- nombre de lignes insérées dans le fichier
ln_counteur NUMBER := 0;
vv_buffer VARCHAR2 (32000);
vv_buffer_et VARCHAR2 (32000);
vv_buffer_etold VARCHAR2 (32000);
lt_id UTL_FILE.file_type;
ln_counter NUMBER (24, 0);
lv_seq VARCHAR2 (30);
lv_num_paiement VARCHAR2 (10);
flag_ecriture VARCHAR2 (1);
lv_filler_ligne VARCHAR2 (500);
ln_long_buff NUMBER := 0;
ln_compteur_factures NUMBER := 0;
lv_name VARCHAR2 (500);
vv_entete VARCHAR2 (500);
lv_invoice_id ap_invoices_all.invoice_id%TYPE;
ln_compteur_hold NUMBER := 0;
lv_hode_reason VARCHAR2 (500);
lv_release_reason VARCHAR2 (500);
lv_societe_absorbee VARCHAR2 (500);
lv_societe_absorbante VARCHAR2 (500);
ln_org_id NUMBER := 0;
lv_date_fusion DATE;
err_non_parameter EXCEPTION;
err_soc_sr EXCEPTION;
err_file_write EXCEPTION;
err_file_invalid_path EXCEPTION;
err_ecriture_file EXCEPTION;
CURSOR cur_ap_hold_invoices (
lv$invoice_id IN ap_invoices_all.invoice_id%TYPE
IS
SELECT aha.hold_reason, aha.release_reason
FROM ap_holds_all aha
WHERE aha.invoice_id = lv$invoice_id;
rec_ap_hold_invoices cur_ap_hold_invoices%ROWTYPE;
--Enregistrement "DESTINATAIRE"
CURSOR cur_fusion_extract_ap_invoice (
lv$societe_absorbee IN cgey_parameters.varchar2_value%TYPE,
lv$societe_absorbant IN cgey_parameters.varchar2_value%TYPE,
lv$date_fusion IN cgey_parameters.date_value%TYPE
IS
SELECT aia.invoice_id, aia.invoice_num,
aia.invoice_type_lookup_code, aia.invoice_date, pv.vendor_id,
pv.segment1, pv.vendor_name, pvsa.vendor_site_id,
pvsa.vendor_site_code, aia.invoice_amount, aia.amount_paid
-- RG3: Montant repris = valeur restante a regler
ROUND (NVL (SUM (apsa.amount_remaining), 0),
2
) amount_remaining,
ap_invoices_utility_pkg.get_approval_status
(aia.invoice_id,
aia.invoice_amount,
aia.payment_status_flag,
aia.invoice_type_lookup_code
) statut,
aia.invoice_currency_code, aia.exchange_rate,
aia.exchange_rate_type, aia.exchange_date,
ate.NAME terms_name, aia.terms_date, aia.SOURCE,
aia.doc_category_code, aia.payment_method_lookup_code,
aia.pay_group_lookup_code, aia.gl_date, aia.doc_sequence_id,
aia.accts_pay_code_combination_id,
cgey_tools_pkg.get_segments_from_ccid
(aia.accts_pay_code_combination_id
) cle_comptable_founisseur,
aia.org_id, aia.payment_cross_rate_type,
aia.payment_cross_rate_date, aia.payment_cross_rate,
aia.payment_currency_code, aia.attribute_category,
aia.attribute1, aia.attribute2, aia.attribute3,
aia.attribute4, aia.attribute5, aia.attribute6,
aia.attribute7, aia.attribute8, aia.attribute9,
aia.attribute10, aia.attribute11, aia.attribute12,
aia.attribute13, aia.attribute14, aia.attribute15,
aia.global_attribute_category, aia.global_attribute1,
aia.global_attribute2, aia.global_attribute3,
aia.global_attribute4, aia.global_attribute5,
aia.global_attribute6, aia.global_attribute7,
aia.global_attribute8, aia.global_attribute9,
aia.global_attribute10, aia.global_attribute11,
aia.global_attribute12, aia.global_attribute13,
aia.global_attribute14, aia.global_attribute15,
aia.global_attribute16, aia.global_attribute17,
aia.global_attribute18, aia.global_attribute19,
aia.global_attribute20
FROM ap_invoices_all aia,
ap_payment_schedules_all apsa,
po_vendor_sites_all pvsa,
ap_terms ate,
po_vendors pv
WHERE 1 = 1
-- RG1: Type de la facture
AND aia.invoice_type_lookup_code IN
('STANDARD', 'CREDIT', 'DEBIT')
AND apsa.invoice_id = aia.invoice_id
AND pvsa.vendor_site_id = aia.vendor_site_id
AND ate.term_id = aia.terms_id
AND pv.vendor_id = aia.vendor_id
-- RG 1: pour les factures créées antétieur à la date de fusion
AND aia.creation_date < lv$date_fusion
-- RG1: Ensemble des lignes de la facture postees
AND NOT EXISTS (
SELECT 'x'
FROM ap_invoice_distributions_all aida
WHERE aida.invoice_id = aia.invoice_id
AND NVL (aida.accrual_posted_flag, 'N' = 'Y')
--check condition
-- pour la société absorbée
AND aia.org_id =
(SELECT organization_id
FROM hr_all_organization_units haou
WHERE haou.NAME = lv$societe_absorbee)
GROUP BY aia.invoice_id,
aia.invoice_num,
aia.invoice_type_lookup_code,
aia.invoice_date,
pv.vendor_id,
pv.segment1,
pv.vendor_name,
pvsa.vendor_site_id,
pvsa.vendor_site_code,
aia.invoice_amount,
aia.amount_paid
-- RG3: Montant repris = valeur restante a regler
apsa.amount_remaining,
aia.payment_status_flag,
aia.invoice_currency_code,
aia.exchange_rate,
aia.exchange_rate_type,
aia.exchange_date,
ate.NAME,
aia.terms_date,
aia.SOURCE,
aia.doc_category_code,
aia.payment_method_lookup_code,
aia.pay_group_lookup_code,
aia.gl_date,
aia.doc_sequence_id,
aia.accts_pay_code_combination_id,
aia.org_id,
aia.payment_cross_rate_type,
aia.payment_cross_rate_date,
aia.payment_cross_rate,
aia.payment_currency_code,
aia.attribute_category,
aia.attribute1,
aia.attribute2,
aia.attribute3,
aia.attribute4,
aia.attribute5,
aia.attribute6,
aia.attribute7,
aia.attribute8,
aia.attribute9,
aia.attribute10,
aia.attribute11,
aia.attribute12,
aia.attribute13,
aia.attribute14,
aia.attribute15,
aia.global_attribute_category,
aia.global_attribute1,
aia.global_attribute2,
aia.global_attribute3,
aia.global_attribute4,
aia.global_attribute5,
aia.global_attribute6,
aia.global_attribute7,
aia.global_attribute8,
aia.global_attribute9,
aia.global_attribute10,
aia.global_attribute11,
aia.global_attribute12,
aia.global_attribute13,
aia.global_attribute14,
aia.global_attribute15,
aia.global_attribute16,
aia.global_attribute17,
aia.global_attribute18,
aia.global_attribute19,
aia.global_attribute20
HAVING NVL (SUM (apsa.amount_remaining), 0) <>
0
--check condition
UNION ALL
SELECT aia.invoice_id, aia.invoice_num,
aia.invoice_type_lookup_code, aia.invoice_date,
pv.vendor_id, pv.segment1, pv.vendor_name,
pvsa.vendor_site_id, pvsa.vendor_site_code,
aia.invoice_amount, aia.amount_paid
-- RG3: Montant repris = valeur restante a regler
ap_invoices_utility_pkg.get_prepay_amount_remaining
(aia.invoice_id)
"Amount_Remaining",
ap_invoices_utility_pkg.get_approval_status
(aia.invoice_id,
aia.invoice_amount,
aia.payment_status_flag,
aia.invoice_type_lookup_code
) statut,
aia.invoice_currency_code, aia.exchange_rate,
aia.exchange_rate_type, aia.exchange_date,
ate.NAME terms_name, aia.terms_date, aia.SOURCE,
aia.doc_category_code,
aia.payment_method_lookup_code,
aia.pay_group_lookup_code, aia.gl_date,
aia.doc_sequence_id,
aia.accts_pay_code_combination_id,
cgey_tools_pkg.get_segments_from_ccid
(aia.accts_pay_code_combination_id
) cle_comptable_founisseur,
aia.org_id, aia.payment_cross_rate_type,
aia.payment_cross_rate_date,
aia.payment_cross_rate, aia.payment_currency_code,
aia.attribute_category, aia.attribute1,
aia.attribute2, aia.attribute3, aia.attribute4,
aia.attribute5, aia.attribute6, aia.attribute7,
aia.attribute8, aia.attribute9, aia.attribute10,
aia.attribute11, aia.attribute12, aia.attribute13,
aia.attribute14, aia.attribute15,
aia.global_attribute_category,
aia.global_attribute1, aia.global_attribute2,
aia.global_attribute3, aia.global_attribute4,
aia.global_attribute5, aia.global_attribute6,
aia.global_attribute7, aia.global_attribute8,
aia.global_attribute9, aia.global_attribute10,
aia.global_attribute11, aia.global_attribute12,
aia.global_attribute13, aia.global_attribute14,
aia.global_attribute15, aia.global_attribute16,
aia.global_attribute17, aia.global_attribute18,
aia.global_attribute19, aia.global_attribute20
FROM ap_invoices_all aia,
po_vendor_sites_all pvsa,
ap_terms ate,
po_vendors pv
WHERE 1 = 1
-- RG2: Type de la facture
AND aia.invoice_type_lookup_code = 'PREPAYMENT'
-- RG2: Amount_Paid Invoice_Amount
AND NVL (aia.invoice_amount, 0) =
NVL (aia.amount_paid, 0)
AND pvsa.vendor_site_id = aia.vendor_site_id
AND ate.term_id = aia.terms_id
AND pv.vendor_id = aia.vendor_id
-- RG2: Ensemble des lignes de la facture postees
AND NOT EXISTS (
SELECT 'x'
FROM ap_invoice_distributions_all aida
WHERE aida.invoice_id = aia.invoice_id
AND NVL (aida.accrual_posted_flag, 'N') =
'Y')
--check condition
-- pour la société absorbée
AND aia.org_id =
(SELECT organization_id
FROM hr_all_organization_units haou
WHERE haou.NAME = lv$societe_absorbee)
-- RG 1: pour les factures créées antétieur à la date de fusion
AND aia.creation_date < lv$date_fusion
GROUP BY aia.invoice_id,
aia.invoice_num,
aia.invoice_type_lookup_code,
aia.invoice_date,
pv.vendor_id,
pv.segment1,
pv.vendor_name,
pvsa.vendor_site_id,
pvsa.vendor_site_code,
aia.invoice_amount,
aia.amount_paid,
aia.payment_status_flag,
aia.invoice_currency_code,
aia.exchange_rate,
aia.exchange_rate_type,
aia.exchange_date,
ate.NAME,
aia.terms_date,
aia.SOURCE,
aia.doc_category_code,
aia.payment_method_lookup_code,
aia.pay_group_lookup_code,
aia.gl_date,
aia.doc_sequence_id,
aia.accts_pay_code_combination_id,
aia.org_id,
aia.payment_cross_rate_type,
aia.payment_cross_rate_date,
aia.payment_cross_rate,
aia.payment_currency_code,
aia.attribute_category,
aia.attribute1,
aia.attribute2,
aia.attribute3,
aia.attribute4,
aia.attribute5,
aia.attribute6,
aia.attribute7,
aia.attribute8,
aia.attribute9,
aia.attribute10,
aia.attribute11,
aia.attribute12,
aia.attribute13,
aia.attribute14,
aia.attribute15,
aia.global_attribute_category,
aia.global_attribute1,
aia.global_attribute2,
aia.global_attribute3,
aia.global_attribute4,
aia.global_attribute5,
aia.global_attribute6,
aia.global_attribute7,
aia.global_attribute8,
aia.global_attribute9,
aia.global_attribute10,
aia.global_attribute11,
aia.global_attribute12,
aia.global_attribute13,
aia.global_attribute14,
aia.global_attribute15,
aia.global_attribute16,
aia.global_attribute17,
aia.global_attribute18,
aia.global_attribute19,
aia.global_attribute20
HAVING ap_invoices_utility_pkg.get_prepay_amount_remaining
(aia.invoice_id) <>
0
AND ap_invoices_utility_pkg.get_approval_status
(aia.invoice_id,
aia.invoice_amount,
aia.payment_status_flag,
aia.invoice_type_lookup_code
) = 'AVAILABLE');
--check condition;
rec_fusion_extract_ap_invoice cur_fusion_extract_ap_invoice%ROWTYPE;
BEGIN
---------Initialisation
pn_retcode := 0;
pv_errbuff := NULL;
ln_compteur_lignes := 0;
lv_societe_absorbee :=
cgey_tools_pkg.get_varchar2_parameter ('SPR_FUSION_AP_SOCIETE',
'SOC_SR'
lv_societe_absorbante :=
cgey_tools_pkg.get_varchar2_parameter ('SPR_FUSION_AP_SOCIETE',
'SOC_CB'
lv_date_fusion :=
cgey_tools_pkg.get_date_parameter ('SPR_FUSION_AP_SOCIETE',
'DATE_FUSION'
lv_rep :=
cgey_tools_pkg.get_varchar2_parameter ('SPR_FUSION_AP_SOCIETE',
'REPERTOIRE_SORTIE'
----err_non_parameter
IF lv_societe_absorbee IS NULL
OR lv_societe_absorbante IS NULL
OR lv_date_fusion IS NULL
OR lv_rep IS NULL
THEN
RAISE err_non_parameter;
END IF;
SELECT NVL (organization_id, 'NULL')
INTO ln_org_id
FROM hr_all_organization_units haou
WHERE haou.NAME = lv_societe_absorbee;
----err_Soc_sr
IF ln_org_id = 'NULL'
THEN
RAISE err_soc_sr;
END IF;
BEGIN
----Création du fichier sorti
cgey_tools_pkg.put_log_message
('Création et Ouverture du fichier en lecture');
lv_name :=
'FUSION_fac_AP_EXTRAIRE'
|| TO_CHAR (SYSDATE, 'DDMMYYYY_HH24MISS')
|| '.txt';
cgey_tools_pkg.put_log_message ('Fichier sortie est ' || lv_name);
lt_id := UTL_FILE.fopen (lv_rep, lv_name, 'w');
IF UTL_FILE.is_open (lt_id)
THEN
cgey_tools_pkg.put_log_message (cv_line);
cgey_tools_pkg.put_log_message ( 'Creation OK du fichier: '
|| lv_name
ELSE
cgey_tools_pkg.put_log_message (cv_line);
cgey_tools_pkg.put_log_message
( 'Probleme ouverture du fichier '
|| lv_name
END IF;
----EXCEPTION UTL_FILE.WRITE_ERROR, UTL_FILE.INVALID_PATH
EXCEPTION
WHEN UTL_FILE.write_error
THEN
RAISE err_file_write;
WHEN UTL_FILE.invalid_path
THEN
RAISE err_file_invalid_path;
----Création du fichier sorti
END;
BEGIN
UTL_FILE.put_line (lt_id, vv_entete);
----CURSOR FACTURE A EXTRAIRE
OPEN cur_fusion_extract_ap_invoice (lv_societe_absorbee,
lv_societe_absorbante,
lv_date_fusion
LOOP
FETCH cur_fusion_extract_ap_invoice
INTO rec_fusion_extract_ap_invoice;
EXIT WHEN cur_fusion_extract_ap_invoice%NOTFOUND;
lv_invoice_id := rec_fusion_extract_ap_invoice.invoice_id;
ln_compteur_hold := 0;
lv_hode_reason := NULL;
lv_release_reason := NULL;
OPEN cur_ap_hold_invoices
(rec_fusion_extract_ap_invoice.invoice_id);
LOOP
FETCH cur_ap_hold_invoices
INTO rec_ap_hold_invoices;
EXIT WHEN cur_ap_hold_invoices%NOTFOUND;
----La première blocage à traiter
IF ln_compteur_hold = 0
THEN
lv_hode_reason :=
NVL (rec_ap_hold_invoices.hold_reason, ' ');
lv_release_reason :=
NVL (rec_ap_hold_invoices.release_reason, ' ');
----concatener des autres blocages suivants pour la même facture
ELSE
lv_hode_reason :=
lv_hode_reason
|| NVL (rec_ap_hold_invoices.hold_reason, ' ');
lv_release_reason :=
lv_release_reason
|| NVL (rec_ap_hold_invoices.release_reason, ' ');
END IF;
ln_compteur_hold := ln_compteur_hold + 1;
END LOOP;
CLOSE cur_ap_hold_invoices;
vv_buffer :=
NVL (lv_societe_absorbee, ' ')
|| vv_separator
|| NVL (lv_societe_absorbante, ' ')
|| vv_separator
|| NVL (TO_CHAR (lv_date_fusion, 'dd/mm/yyyy'), ' ')
|| vv_separator
|| NVL (TO_CHAR (rec_fusion_extract_ap_invoice.invoice_id),
|| vv_separator;
UTL_FILE.put_line (lt_id, vv_buffer);
ln_compteur_lignes := ln_compteur_lignes + 1;
END LOOP;
cgey_tools_pkg.put_log_message
( TO_CHAR (ln_compteur_lignes)
|| ' lignes inserees dans le fichier '
|| lv_rep
|| '/'
|| lv_name
CLOSE cur_fusion_extract_ap_invoice;
UTL_FILE.fclose (lt_id);
cgey_tools_pkg.put_log_message (' ');
cgey_tools_pkg.put_log_message (cv_line);
EXCEPTION
WHEN OTHERS
THEN
ROLLBACK;
RAISE err_ecriture_file;
END;
EXCEPTION
WHEN err_non_parameter
THEN
pn_retcode := SQLCODE;
cgey_tools_pkg.put_log_message ('error' || SQLCODE);
cgey_tools_pkg.put_log_message
('error parameter : Veuillez vous verifier la configuration dans la table CGEY_PARAMETERS!'
WHEN err_soc_sr
THEN
pn_retcode := SQLCODE;
cgey_tools_pkg.put_log_message ('error' || SQLCODE);
cgey_tools_pkg.put_log_message
('error société_absorbée : Veuillez vous verifier le parameter de la société absorbée !'
WHEN err_file_write
THEN
UTL_FILE.fclose (lt_id);
pv_errbuff := SQLERRM;
pn_retcode := SQLCODE;
cgey_tools_pkg.put_log_message ('error' || SQLCODE);
cgey_tools_pkg.put_log_message ('erreur write_error:' || pv_errbuff);
WHEN err_file_invalid_path
THEN
UTL_FILE.fclose (lt_id);
pn_retcode := SQLCODE;
pv_errbuff := SQLERRM;
cgey_tools_pkg.put_log_message ('error' || SQLCODE);
cgey_tools_pkg.put_log_message ('erreur invalid_path:' || pv_errbuff);
WHEN err_ecriture_file
THEN
UTL_FILE.fclose (lt_id);
pn_retcode := SQLCODE;
pv_errbuff := SQLERRM;
cgey_tools_pkg.put_log_message ('error' || SQLCODE);
cgey_tools_pkg.put_log_message ('err_ecriture_file:' || pv_errbuff);
WHEN OTHERS
THEN
cgey_tools_pkg.put_log_message
('Une Erreur inconnue arrive lors que l''extraction du FUSION_fac_AP_EXTRAIRE!!'
END main_fusion_extract;
END spr_ap_fusion_extract_pkg;*009*
Edited by: 009 on Mar 11, 2010 3:31 AM -
How to change color of rows count dispalyed while debugging ssis packages
Hello,
in visual 2013 ssdt version I have row count displayed in white color on pale background: bit.ly/1oWP1Cm
I'd like to have it in black. I know it should be changeable in Options -> Fonts and Colors, but what option should I change from myriads available?
Thank you in advance.My colleague had the same issue in that we couldn't see the numbers. We couldn't figure out why we couldn't see the numbers and the design screen was white. It looked like the numbers were displaying in white over the connections lines. So
we changed the color scheme to light and the numbers appeared in black. WHen we switched the color scheme back to dark, the canvas turned dark and the text was in white.
So there must be a bug when selecting the color scheme on the first run of Visual Studio 2013 in that it doesn't set the correct canvas color for the SSIS designer. Luckily toggling the color scheme resolves the issue.
Christian Jones Software Developer, former Network/Sys Admin -
EA2: bug in package run/debug dialog
The PL/SQL block is not (re)generated correctly when switching between implementations of an overloaded func/proc:
Whenever you run/debug a package from sql developer a dialog box is opened in which you can select a TARGET (any of the public function/procedures for the package).
A pl/sql block to execute the the selected TARGET is then dynamically generated.
If you have an overload procedure it is presented as
FUNC1(1)
FUNC1(2)
FUNC2
FUNC3
If you switch between 2 overloads, the parameters to the left actually changes correctly. So it does notice the change
However the PL/SQL below is unchanged. The variables are still valid for FUNC(1) instead of FUNC(2)
Edited by: apodictus on Dec 11, 2010 10:08 PMI already noticed the bug is probably a bit more delicate then originally stated.
I extended the original overload procedure for which I found the bug with a few more formal parameters.
To my surprise after that alteration, the PL/SQL block was suddenly generated correctly.
Might have been an initial invocation then... -
When debugging package, local variables always listed as 'null'
When I'm debugging a package procedure, if I try to inspect any local variables by hovering the mouse cursor over them, the floating text that appears always says they're set to null - even though I know (because the procedure works as expected) that there must be a value there. Also, local variables don't appear in the 'Data' debug tab; and if I drag the local variables into the 'Watch' tab, their value is listed as null.
Using v1.1.2.25 against a 9.2.0.6 db - anyone have any ideas..?
Cheers,
JamesLocal variables should be used whenever you need a value only in a single method and don't need to remember it's value between two invocations of that method.
A perfect example would be the counter in a for-loop. -
Debug Package/Procedure in Oracle
Hi,
Please let me know the procedure to debug a package/procedure in oracle ( Apart from dbms_output commands). We are using Toad.
Other option would be to
1. Set tracing on for a particular session and analyze logs generated through tkprof
2. Turn on Logon trigger for a user to capture all the SQLs fired.
The issue with above options is that all system fired SQL's are also captured. It would be a tough task to wade through all the SQL's fired.
PLease suggest the best option to debug a complex procedure/package.
Thanks in advance.Create one table and caputure all results in that... Thanks!
Maybe you are looking for
-
How do i transver one lybary to another
how do i transver one of my liebarys music to the other one while keeping both computers music
-
Web Sharing broken after Restore System from Time Machine
If you do a complete System Restore from a Time Machine backup, and had Web Sharing turned on, it won't work after the restore. The problem is the restore doesn't put back a folder for Apache logs. It should be in /var/log (or /private/var/log). With
-
Total Score in Sum Total not correct
We are using Captivate 4 and the Sum Total LMS. Our course consists of 2 lessons which are not scored and an assessment which is scored. The settings for the lessons are Slide Views Only so the lessons have the Topic Status Complete or Incomplete o
-
Aperture 2 corrupted by an update.
I use Aperture 2 and have a lot of photos in the library. Suddenly, a few weeks ago, Aperture wouldn't start unless I upgraded my library to be an Aperture 3 library. I am given the options "quit" or "upgrade". Upon "quit" Aperture quits and I am una
-
Airport Extreme- accessing a printer
I have connected my PC to my Airport Extreme using an Ethernet cable. Can I access my Wifi printer using this method or is the only way to connect the printer to the USB port on the Airport Extreme?