In search of a logical solution for my problem

Hello Experts,
I have this piece of complex code with a big big issue.
ok first thing first
Here is a sample of my file:
Retailer Number:  200113              Terminal Number:  20011300       Retailer Name:  Mini Prix Boutique
                -------Net------ -----Net----- --------Cancels------- ----------Cashes--------- ----------Claims--------- ---------Returns--------- ------Ticket Charges----- ------Ticket Refunds----- --Ticket Charge Refunds-- --Free Prize Issued-- ------Free Promo----- ----Promo Credits---- ---Returns--- -----Net----- ----Sales---- -----Cash---- -------Net------
Product         ------Sales----- --Adjustment-     Cnt         Amount     Cnt            Amount     Cnt            Amount     Cnt            Amount     Cnt            Amount     Cnt            Amount     Cnt            Amount     Cnt    Cash Value     Cnt    Cash Value     Cnt        Amount ---Commiss--- --Discounts-- ---Commiss--- ---Commiss--- -------Due------
=============== ================ ============= ======= ============== ======= ================= ======= ================= ======= ================= ======= ================= ======= ================= ======= ================= ======= ============= ======= ============= ======= ============= ============= ============= ============= ============= ================
Loto                     820.00          0.00       0           0.00      26         -3,766.00       0              0.00       0              0.00       0              0.00       0              0.00       0              0.00       0          0.00       0          0.00       0          0.00          0.00          0.00        -41.00        -38.00        -3,025.00
Inst Tk                4,000.00          0.00       0           0.00      38         -2,060.00       0              0.00                      0.00       0              0.00       0              0.00       0              0.00       0          0.00       0          0.00       0          0.00          0.00          0.00       -200.00         -9.00         1,731.00
Totals                  4,820.00          0.00       0           0.00      64         -5,826.00       0              0.00       0              0.00       0              0.00       0              0.00       0              0.00       0          0.00       0          0.00       0          0.00          0.00          0.00       -241.00        -47.00        -1,294.00
Retailer Number:  200114              Terminal Number:  20011400       Retailer Name:  Hotel Cassim
                -------Net------ -----Net----- --------Cancels------- ----------Cashes--------- ----------Claims--------- ---------Returns--------- ------Ticket Charges----- ------Ticket Refunds----- --Ticket Charge Refunds-- --Free Prize Issued-- ------Free Promo----- ----Promo Credits---- ---Returns--- -----Net----- ----Sales---- -----Cash---- -------Net------
Product         ------Sales----- --Adjustment-     Cnt         Amount     Cnt            Amount     Cnt            Amount     Cnt            Amount     Cnt            Amount     Cnt            Amount     Cnt            Amount     Cnt    Cash Value     Cnt    Cash Value     Cnt        Amount ---Commiss--- --Discounts-- ---Commiss--- ---Commiss--- -------Due------
=============== ================ ============= ======= ============== ======= ================= ======= ================= ======= ================= ======= ================= ======= ================= ======= ================= ======= ============= ======= ============= ======= ============= ============= ============= ============= ============= ================
Loto                  11,700.00          0.00       0           0.00     178        -24,960.00       0              0.00       0              0.00       0              0.00       0              0.00       0              0.00       0          0.00       0          0.00       0          0.00          0.00          0.00       -585.00       -250.00       -14,095.00
Inst Tk               36,000.00          0.00       0           0.00     258        -19,780.00       0              0.00                      0.00       0              0.00       0              0.00       0              0.00       0          0.00       0          0.00       0          0.00          0.00          0.00     -1,800.00       -119.00        14,301.00
Totals                 47,700.00          0.00       0           0.00     436        -44,740.00       0              0.00       0              0.00       0              0.00       0              0.00       0              0.00       0          0.00       0          0.00       0          0.00          0.00          0.00     -2,385.00       -369.00           206.00This is how my file is. I need to insert those values in a table and this is done correctly.
Now i have some major issues.
In my code i search for the retailer number and then look for loto, inst tk and totals.( it works fine when i have loto, inst tk and totals)
issue1: if for a retailer i dont have an entry for loto it skips the whole line which is not good coz i have entries for inst tk
issue2: if i dont have entry for inst tk then it skips the entry for totals
How can i overcome this.
please can anyone plz help me with some assistance

below is my code
Declare
l_start_file_name varchar2(50) := 'daily_sales_detail_report_c';
l_end_file_name varchar2(50)   := '_english.rep';
l_file_name varchar2(100);
l_sql long;
BEGIN
for i in 425..425
loop
l_file_name := l_start_file_name||'00425'||l_end_file_name;
l_sql :=  'create table cdc_file_temp                 '||
            '(line varchar2(4000))                     '||
              'ORGANIZATION EXTERNAL (                 '||
              ' TYPE oracle_loader                     '||
               ' DEFAULT DIRECTORY GTECHFILES          '||
               ' ACCESS PARAMETERS (                   '||
               '   RECORDS DELIMITED BY NEWLINE        '||
               '      CHARACTERSET WE8MSWIN1252        '||
               '   BADFILE ''cdc_file.bad''            '||
               '   DISCARDFILE ''cdc_file.dis''        '||
               '   LOGFILE ''cdc_file.log''            '||
               '   FIELDS TERMINATED BY X''0D'' RTRIM  '||
               '  MISSING FIELD VALUES ARE NULL        '||
               '   REJECT ROWS WITH ALL NULL FIELDS    '||
               '     (                                 '||
               '     line char(4000)                   '||
               '     )                                 '||
               '   )                                   '||
               '   LOCATION ('''||l_file_name||''')    '||
               ' )                                     '||
               'PARALLEL                               '||
               'REJECT LIMIT UNLIMITED ';
--        dbms_output.put_line('Val iS :'||l_Sql);        
        execute immediate l_sql;

Similar Messages

  • TA24002 My 500 GB can't verify nor repair. I have photoshop work that I need to recover. I would like to know which erase option would be the best solution for this problem.

    My 500 GB can't verify nor repair. I have photoshop work that I need to recover. I would like to know what option would be the best solution for this problem?

    You appear to have two issues: 1) a hard drive that is not working properly and 2) files you wish to recover.
    Re 1) you need to answer Kappy's questions.
    Re 2) does the drive load and can you see your photo files? If so can you copy them to another drive?
    Do you not have a backup of the photo files?

  • I have problems in the initiation of the Encore process when opening presents the following error message : "Encore CS6 Cannot Run in Non-Royalty Serialized".... What is the best solution for this problem ?

    Help Me.
    What is the best solution for this problem ?

    Encore is activated when you activate Premiere Pro... so, as Stan asked, how did you install P-Pro?
    Ask for serial number http://forums.adobe.com/thread/1234635 has a FAQ link
    -and a fix for Encore http://forums.adobe.com/thread/1421765?tstart=0 in reply #7
    -plus more Encore http://helpx.adobe.com/encore/kb/cant-write-image-fie-larger1.html

  • I bought my iphone 5 in Houston Texas May 15 2013 IMEI Nr. 013428009645399.The problem is that in the Greece the country which I live the 4G is not working.If you have any solution for this problem pls. let me know.My email is philcoueth@yahoo.gr Thank yo

    I bought my iphone 5 in Houston on May 15 2013.
    IMEI 013428009645399.The problem I have is that in the country
    which I live GREECE the 4G is
    not working.Please if you have any solution for this
    problem let me know.My email is [email protected]
    Thanking you in advance
    Philip Couridis

    iPhones purchased in the US are NOT guaranteed to work with 4G bands outside of North America.
    For what crazy reason did you purchase an iPhone in the US if you live in Greece?  If your phone needs servicing, it will have to be brought back to the US.  You cannot get that phone serviced in Greece.

  • My display has quit working.  Does anyone have a solution for this problem?

    I have had my Verizon Jetpack MiFi 5510L for a couple of months now.  It has worked fine until a few days ago the display on it started looking strange and now has finally gone blank.  Does anyone have a solution for the problem?

    You can do both, whatever is more convenient to you.  As long as VZW gets its hands on the old device you will be good to go.  Replacements under the warranrty require the user to turn in the old device to VZW.  If your old device is not returned then you will be charged a fee for an entirely new device.  Purchasing a tracking number for a shipment of this kind would be a good idea if you choose to send it in.  Otherwise dropping it off at a store is the safest route you can take. 
    I would suggest contacting VZW phone support on this one and running through your options.  The VZW phone rep can coordinate a delivery to your local VZW store if they do not already have one in stock.  You can also turn in the old device in person to rule out any non-returned device fees.

  • Anyone has a solution for the problem: typing keywords and suddenly it does not work anymore. Mostly I have to restart my iphone 4Gs

    Does anyone has a solution for this problem?
    Since I updated to iOS 6 sometimes my keywords did not work.
    I always have to restart my iPhone to have it work.
    It's ridiculous to always restart my phone.
    If you also have this problem you can repost + give some tips.
    Thanks and greetings,
    Max Louis

    Hi Alo816,
    I'm sorry to hear you are having such extensive issues with Messages on your iPhone. If you continue having issues sending or receiving Messages, you may find the troubleshooting steps outlined in the following article helpful:
    iOS: Troubleshooting Messages - Apple Support
    If you continue to have issues with Messages after that troubleshooting, especially if it is still having or crashing, you may want to make sure you have a current backup of your data in iTunes, then try restoring your iPhone to factory settings and testing it in that default condition to see if the issues persist before restoring your data. You may find this article useful:
    Use iTunes to restore your iOS device to factory settings - Apple Support
    Regards,
    - Brenden

  • For last one month I am facing problem in watching online videos on my iPod touch. It is opening or can say loading the online videos. Earlier it used to be work absolutely fine. Any solution for my problem.

    For last one month I am facing problem in watching online videos on my iPod touch. It is opening or can say loading the online videos. Earlier it used to be work absolutely fine. Any solution for my problem.

    For last one month I am facing problem in watching online videos on my iPod touch. It is not opening or can say loading the online videos. Earlier it used to be work absolutely fine. Any solution for my problem.

  • Can anyone solve (or) give me a solution for this problem.....?

    Hi Everyone!
    Can anyone solve (or) give me a solution for this problem.....?
    We have used two folders Source & Finalwork. We have get image from Source folder and put silo path & Moved to Finalwork folder.
    Is this possible to check whether both folder images Embedded color profile same or not.
    -yajiv

    Could you elaborate what you mean by this
    We have get image from Source folder and put silo path & Moved to Finalwork folder.
    Possibly again with a screenshot to illustrate the task?
    // 2012, use it at your own risk;
    #target photoshop
    var theFolder = Folder.selectDialog ("select source folder");
    if (theFolder) {
    var theFiles = theFolder.getFiles(/\.(jpg|tif|eps|psd)$/i)
    var theOtherFolder = Folder.selectDialog ("select target folder");
    if (theOtherFolder) {
    var theOtherFiles = theOtherFolder.getFiles(/\.(jpg|tif|eps|psd)$/i)
    var missingFiles = new Array;
    var unmatchedProfiles = new Array;
    // work through files;
    for (var m = 0; m < theFiles.length; m++) {
              var check = false;
              var theFile = theFiles[m];
    // find name of the same name;
              for (var n = 0; n < theOtherFiles.length; n++) {
                        var theOtherFile = theOtherFiles[n];
    // if one is found;
                        if (theFile.name == theOtherFile.name) {
                                  check = true;
                                  var oneFile = app.open(File(theFile));
                                  var otherFile = app.open(File(theOtherFile));
    // check profiles;
                                  if (oneFile.colorProfileName == otherFile.colorProfileName) {
    // collect umages with unmatched profiles;
                                  else {unmatchedProfiles.push(theFile)};
    // collect missing files;
              if (check == false) {alert ("hahaha");missingFiles.push(theFile)}
    // alert of problems;
    if (unmatchedProfiles.length > 0) {
    alert ("the corresponding files for these do have a different color space:\n"+unmatchedProfiles.join("\n\n"));
    if (missingFiles.length > 0) {
    alert ("these files miss corresponding ones:\n"+missingFiles.join("\n\n"));
    ////// get psds, tifs and jpgs from files //////
    function getFiles (theFile) {
        if (theFile.name.match(/\.(jpg|tif|psd|pdf|)$/i)) {
            return true

  • I have my Adobe ID and the Adobe Digital Editions. But when I download an EPUB-ebook, I don´t see the ebook or "My Digital Editions-Bibliothek".What is the solution for this problem?

    @I have my Adobe ID and the Adobe Digital Editions. But when I download an EPUB-ebook, I don´t see the ebook or "My Digital Editions-Bibliothek".What is the solution for this problem?

    how can we solve the problem?
    I have my adob.e ID, downloaded Adobe Digital Editions.
    Whren I download EPUB-ebooks and want to use
    Digital Editions, nothing happens and appears!??
    Please give me a short feedback and help

  • When I try to install PSE11, I keep getting error 1935, does anyone have a solution for this problem

    When I try to install PSE11, I keep getting error 1935, does anyone have a solution for
    this problem?

    This thread from the Premiere Elements forum may help:
    http://forums.adobe.com/thread/1286807?tstart=0

  • Hi! Did anyone happen that AppStore simply disappear? Anyone have a solution for this problem? Thanks!

    Hi!
    Did anyone happen that AppStore simply disappear?
    Have anyone a solution for this problem?
    thanks! bbj

    Hi.
    Do you mean that App Store has disappeared from the Dock? If so it'll still be in Applications. Select it in Applications, when it opens in the Dock move it one or more places, it will then stay there to access next time you want it.
    If you don't mean the above, see if you have accidentally moved the application to the Trash.
    Good luck,
    Adrian

  • HT4484 i used to have an app store and lost it and i created a new one and i can not update the iphoto app because it was updated with the old account, is there a solution for this problem?

    i used to have an app store and lost it and i created a new one and i can not update the iphoto app on my macbook pro because it was updated with the old account, is there a solution for this problem?

    Content and Apple IDs -
    Content is forever tied to the Apple ID that bought it. Apple does not transfer content from one Apple ID to another. Apple does not merge Apple IDs. You will never be able to access your content bought with one Apple ID with a new Apple ID.

  • I have sent a message to a friend. Afterwards, I created a new message. And the message I have sent a while ago appears even if I haven't type anything. Can you find a solution for my problem please? :(

    I have sent a message to a friend. Afterwards, I created a new message again. And the message I have sent a while ago appears again even if I haven't type anything. Can you find a solution for my problem please?

    You're welcome! Glad you got things sorted out.

  • Kelsey Anderson I may have a solution for your problem

    Kelsey I may have a solution for your problem.

    McAfee Site Advisor 3.4.0 just came out of the addons blocklist, and you have SiteAdvisor and even though that is the current version; nevertheless, you should uninstall it and reinstall it as noted in https://community.mcafee.com/message/203466 for a fresh version with only current files.
    Also refer to http://kb.mozillazine.org/Problematic_extensions relating to McAfee Site Advisor 3.4.0 for more specific instructions.
    <br><small>Please mark "Solved" one answer that will best help others with a similar problem -- hope this was it.</small>

  • What is teh best solution for my Problem??

    hello everyone
    i'am planing to develop a Patient Management System (PMS)
    since i 'm not that guru in the J technologies i would like you to get me some help with this decision:
    what is the best solution for developeing an intranet "PMS" which should handles data (connection to postgresql) and runs some algorithm (for planing puropose) im background ??
    1 developeing a web based solution (servlet and jsp and and ..)
    2 developeing an application wich will be manging everything ??? (a kind of programm with its own GUI)
    3 you may have an other idea solution and ill be gald for any advices
    ps sorry for my english its not that great ;)

    Web applications are all the rage these days and IMO rightly so as they greatly reduce deployment cost and headaches.
    They do have some drawbacks though which for you might be important.
    I can imagine that sooner or later (probably sooner in my experience) a requirement to interface with hardware installed on the client machines will emerge.
    Whether this is a barcode scanner or a chipcard reader to get client information from some form of card issued to the client, or maybe a label printer to print out labels for medication bottles doesn't matter, you need to access the client machine directly.
    Web applications have great difficulty with that (in fact, it's all but impossible).
    You could go for an applet solution but that's contrived at best and still leaves the same problems.
    So in your situation an old-fashioned client/server application (maybe using web services to communicate with the serverside application) is likely the best longterm solution.
    You'd have the database remote so everyone has access to the same data, being accessed through processes run on the server and called by the clients. These can also do most of the business logic, leaving the clients relatively dumb responsible mainly for data validation and entry and presentation of the results.

Maybe you are looking for

  • Open delivery values in S067 table showing as -ve

    Hi All Open delivery values in S067 table showing as -ve. Could u please explain , what are the reasons! Regards Raj

  • Dynamic action on "Change" of Radio group value

    Hi, I'm using Apex 4.1 on XE 11G. If I create a simple dynamic action which shows/hides a field on the change of an item of type select list this works great. So for example if the value of the select list is 1 then show another field and otherwise h

  • Line items not printed in check printing payment advice

    Hi, this is the first time i am implementing check printing module so need some help. I have used standard print program RFFOUS_C and sapscript form F110_PRENUM_CHEK when I create an invoice from FB60 and make payments through F-58, on printing it pr

  • Graphics.drawImage(Image, int, int, Observer) fails on custom CompositeMode

    We created some custom CompositeModes for which the following trivial example code is representative: import java.awt.*; import java.awt.image.*; public class AddARGBComposite implements Composite      static private AddARGBComposite instance = new A

  • Is it possible to add Fortigate 620B to CS-MARS v6.0?

    Hi all, I have a firewall Fortigate 620B and I want to add to CS-MARS. The link below to add it to mars: http://firewallguru.blogspot.com/2008/09/fortinet-and-cisco-mars-integration.html When I completed, it stay standalone, not connect to any networ