Question

Reading a csv file using plsql oracle 10g

Asked by: darrylf290567

Hi All,

I want to be able to skip the first line that has header column titles and only start reading the data in the second line and onwards. How can I do this can someone please help me. There must be  a generic way.

Please help.
darrylf290567

The example is:
first line of .csv file
SITE_ACCESS_CODE, MY_CODE, SITE_ID
second line of .csv file where I want to actually read the below data.
456T,ABC,123A

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-01-18 at 00:19:32ID23092749
Tags

plsql 10g

Topics

PL / SQL

,

Oracle 10.x

Participating Experts
3
Points
125
Comments
15

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Need help with plsql !!
    Hi 1) I try to write a plsql procedure which will recive variables via html and write it into a table. can any one send me plsql code ? 2) What is the BULK BINDS and when should i use it ? {*|*} ^ Regards NIKO hagais@yahoo.com
  2. PLSQL protection
    is there a way to stop someone copying PLSQL from one machine to another? Is there something unique about an Oracle database that I can hard code into my PLSQL? thanks
  3. Oracle PLSQL
    I am having a problem with an oracle procedure. I am trying to populate a cursor in PLSQL then loop through it to determine what to do. The data is being passed in via a website, and can have 1, or more numbers, thus the "in" part of the select stmt. It works when...
  4. plsql
    can u please send some plsql code to do the follwoing: run a select query for a list of employee_ids (that should be read from my c: drive or any other drive. the employee_id must be read from a csv file in column A).
  5. plsql - unix
    I am strating on a new job tomorow for plsql and unix. I have refeashed plsql concepts , but am not familar with how unix is exactly used by plsql programmers. Please suggest some free tuturial (links) for this - for a plsql developer role so that I can perform well in my new...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: sujith80Posted on 2008-01-18 at 00:34:52ID: 20688765

What tool are you using to load the data?
If you are using sqlloader, you can use the key word SKIP, your control line will look like :

LOAD DATA (SKIP 1)
.
.

 

by: sonicefuPosted on 2008-01-18 at 00:55:37ID: 20688826

PL/SQL programs can read and write operating system text files
http://download-west.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_file.htm#sthref14093

Or

Use External Table as follws

-----------------
1)
--friends.csv---located at c:\  root directory
empId Lnam Fname SSN     email                 exp 
001,Hutt,Jabba,896743856,jabba@thecompany.com,18
002,Simpson,Homer,382947382,homer@thecompany.com,20
003,Kent,Clark,082736194,superman@thecompany.com,5
004,Kid,Billy,928743627,billythkid@thecompany.com,9
005,Stranger,Perfect,389209831,nobody@thecompany.com,23
006,Zoidberg,Dr,094510283,crustacean@thecompany.com,1
------------------
2)
connect as a DBA user for example system or sys or any other DBA user
SQL> conn system/password
-------------------
3)
SQL> create or replace directory external_data_dir
  2  as 'c:\';
------------------
4)
SQL> grant read,write on directory external_data_dir to scott;
-----------------
5)
SQL> connect scott/tiger
-----------------
6)
SQL> create table external_friends
         ( empl_id varchar2(3),
           last_name varchar2(50),
           first_name varchar2(50),
           ssn varchar2(9),
          email_addr varchar2(100),
           years_of_service number(2,0)
         )
         organization external
        ( default directory external_data_dir
          access parameters
         ( records delimited by newline
           skip 1                 -- will skip first one row
           fields terminated by ','
         )
         location ('friends.csv')  
     );
--------------------------
you can create external table using PL/SQL block
 
.....
....
Begin
....
...
 
execute immediate 'create table external_friends..........';
 
...
....
.......
End;

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:

Select allOpen in new window

 

by: sdstuberPosted on 2008-01-18 at 05:49:39ID: 20690045

How you do it will depend on how you are reading the csv file.

1-
If you're using pl/sql, can I assume you're using utl_file?
If so, simply include a get_line as the first line of your procedure and simply ignore the results.
Then enter your loop to process the rest of the file.

2-
If you are using dbms_lob with bfiles, then use dbms_lob.instr to find the first end-of-line delimiter.
might be carrriage return, might be new line, might be both.  Depends on your format.

Then start looping through your lines starting at that lob index +1.

3-
If you are using an external table and it has the headers in csv format too, that's easiest of all.
Simply exclude the first row in your cursor query.

select * from (select rownum rn, external_table.* from external_table)
where rn > 1

or, like the utl_file solution,  fetch once, then ignore the results before entering the loop to process the rest of the cursor.

 

by: darrylf290567Posted on 2008-01-19 at 02:59:09ID: 20696817

Hi All,

ststuber, Can you actually show me in code how i would do the reading of the example data i have given you in this question using PLSQL code using the UTL_FILE package?

Please can you help by actually doing the code for this example data and I will take it from there.

How do you ignore the first line using plsql, and then continue reading the second line, using the example data in the question.

Kindest Regards
darrylf290567

 

by: sonicefuPosted on 2008-01-19 at 15:25:07ID: 20699471

<<I want to be able to skip the first line that has header column.......................................>>
Following link will guide you with PL/SQL code
http://www.oracle-base.com/articles/9i/UTL_FILERandomAccessOfFiles9i.php

 

by: darrylf290567Posted on 2008-01-20 at 15:52:40ID: 20703017

Hi sdstuber,

How do you do this in the PLSQL code:

1-
If you're using pl/sql, can I assume you're using utl_file?
If so, simply include a get_line as the first line of your procedure and simply ignore the results.
Then enter your loop to process the rest of the file.

Would you put get_line inside the loop or just before the loop starts?
How would getline inside the loop know NOT to read the first line? Will there be some sort of flag?

PLEASE HELP
darrylf290567

 

by: darrylf290567Posted on 2008-01-20 at 16:01:16ID: 20703034

Hi sdstuber,

here is the file:

SITE_ASSET_ID,MONP_CODE,FTYP_CODE,MEA_CODE,REA_DT_PRIMARY,REA_VALUE,REA_ORIGIN,QI
100448,1,MTR,CONN,20070728080000,16.288,odca,V
100448,1,MTR,CONN,20070729080000,20.032,odca,V
100448,1,MTR,CONN,20070730080000,21.032,odca,V
100448,1,MTR,CONN,20070731080000,18.496,odca,V
100448,1,MTR,CONN,20070801080000,20.48,odca,V
100448,1,MTR,CONN,20070802080000,15.086,odca,V
100448,1,MTR,CONN,20070803080000,15.086,odca,V
100448,1,MTR,CONN,20070804080000,15.086,odca,V
100448,1,MTR,CONN,20070805080000,15.086,odca,V
100448,1,MTR,CONN,20070806080000,15.086,odca,V
100448,1,MTR,CONN,20070807080000,15.086,odca,V
100448,1,MTR,CONN,20070808080000,15.086,odca,V
100448,1,MTR,CONN,20070809080000,15.086,odca,V
100448,1,MTR,CONN,20070810080000,24.03866667,odca,V
100448,1,MTR,CONN,20070811080000,24.03866667,odca,V
100448,1,MTR,CONN,20070813080000,24.03866667,odca,V
100448,1,MTR,CONN,20070814080000,24.03866667,odca,V
100448,1,MTR,CONN,20070815080000,24.03866667,odca,V
100448,1,MTR,CONN,20070816080000,24.03866667,odca,V
100448,1,MTR,CONN,20070817080000,23.35866667,odca,V
100448,1,MTR,CONN,20070818080000,23.35866667,odca,V
100448,1,MTR,CONN,20070820080000,23.35866667,odca,V
100448,1,MTR,CONN,20070821080000,23.35866667,odca,V
100448,1,MTR,CONN,20070822080000,23.35866667,odca,V
100448,1,MTR,CONN,20070823080000,23.35866667,odca,V
100448,1,MTR,CONN,20070824080000,23.35866667,odca,V
100448,1,MTR,CONN,20070825080000,23.35866667,odca,V
100448,1,MTR,CONN,20070826080000,23.35866667,odca,V
100448,1,MTR,CONN,20070827080000,23.35866667,odca,V
100448,1,MTR,CONN,20070828080000,23.35866667,odca,V
100448,1,MTR,CONN,20070829080000,23.35866667,odca,V
100448,1,MTR,CONN,20070830080000,23.35866667,odca,V
100448,1,MTR,CONN,20070831080000,24.472,odca,V
100448,1,MTR,CONN,20070901080000,24.472,odca,V
100448,1,MTR,CONN,20070902080000,24.472,odca,V
100448,1,MTR,CONN,20070903080000,24.472,odca,V
100448,1,MTR,CONN,20070904080000,24.472,odca,V
100448,1,MTR,CONN,20070905080000,24.472,odca,V
100448,1,MTR,CONN,20070906080000,27.1152,odca,V
100448,1,MTR,CONN,20070907080000,27.1152,odca,V
100448,1,MTR,CONN,20070908080000,27.1152,odca,V
100448,1,MTR,CONN,20070909080000,27.1152,odca,V
100448,1,MTR,CONN,20070912080000,27.1152,odca,V
100448,1,MTR,CONN,20070913080000,25.13942857,odca,V
100448,1,MTR,CONN,20070914080000,25.13942857,odca,V
100448,1,MTR,CONN,20070915080000,25.13942857,odca,V
100448,1,MTR,CONN,20070916080000,25.13942857,odca,V
100448,1,MTR,CONN,20070917080000,25.13942857,odca,V
100448,1,MTR,CONN,20070918080000,25.13942857,odca,V
100448,1,MTR,CONN,20070919080000,25.13942857,odca,V

kindest regards
darrylf290567

 

by: sdstuberPosted on 2008-01-20 at 18:07:54ID: 20703427

CREATE OR REPLACE DIRECTORY CSV_IMPORT_DIR AS 'your_directory_path_here';

GRANT READ, WRITE ON DIRECTORY CSV_IMPORT_DIR TO 'your_schema_here';


CREATE OR REPLACE PROCEDURE read_csv(p_filename IN VARCHAR2)
IS
    v_filehandle       UTL_FILE.file_type;
    v_text             VARCHAR2(4000);
    v_eof              BOOLEAN            := FALSE;
    v_temp             VARCHAR2(100);
    v_site_asset_id    NUMBER;
    v_monp_code        NUMBER;
    v_ftyp_code        VARCHAR2(3);
    v_mea_code         VARCHAR2(4);
    v_rea_dt_primary   DATE;
    v_rea_value        NUMBER;
    v_rea_origin       VARCHAR2(4);
    v_qi               VARCHAR2(1);
BEGIN
    v_filehandle    := UTL_FILE.fopen('CSV_IMPORT_DIR', p_filename, 'r');

    BEGIN
        -- read header line
        -- do nothing with the text
        UTL_FILE.get_line(v_filehandle, v_text);
    EXCEPTION
        WHEN NO_DATA_FOUND
        THEN
            v_eof    := TRUE;
    END;

    WHILE NOT v_eof
    LOOP
        BEGIN
            UTL_FILE.get_line(v_filehandle, v_text);
            v_text    := TRIM(v_text);

            IF v_text IS NOT NULL
            THEN
                -- Extract 1st element
                v_temp              := SUBSTR(v_text, 1, INSTR(v_text, ',', 1, 1) - 1);
                v_site_asset_id     := TO_NUMBER(v_temp);
                -- Extract 2nd element
                v_temp              :=
                    SUBSTR(v_text,
                           INSTR(v_text, ',', 1, 1) + 1,
                           INSTR(v_text, ',', 1, 2) - 1 - INSTR(v_text, ',', 1, 1)
                          );
                v_monp_code         := TO_NUMBER(v_temp);
                -- Extract 3rd element
                v_temp              :=
                    SUBSTR(v_text,
                           INSTR(v_text, ',', 1, 2) + 1,
                           INSTR(v_text, ',', 1, 3) - 1 - INSTR(v_text, ',', 1, 2)
                          );
                v_ftyp_code         := v_temp;
                -- Extract 4th element
                v_temp              :=
                    SUBSTR(v_text,
                           INSTR(v_text, ',', 1, 3) + 1,
                           INSTR(v_text, ',', 1, 4) - 1 - INSTR(v_text, ',', 1, 3)
                          );
                v_mea_code          := v_temp;
                -- Extract 5th element
                v_temp              :=
                    SUBSTR(v_text,
                           INSTR(v_text, ',', 1, 4) + 1,
                           INSTR(v_text, ',', 1, 5) - 1 - INSTR(v_text, ',', 1, 4)
                          );
                v_rea_dt_primary    := TO_DATE(v_temp, 'yyyymmddhh24miss');
                -- Extract 6th element
                v_temp              :=
                    SUBSTR(v_text,
                           INSTR(v_text, ',', 1, 5) + 1,
                           INSTR(v_text, ',', 1, 6) - 1 - INSTR(v_text, ',', 1, 5)
                          );
                v_rea_value         := TO_NUMBER(v_temp);
                -- Extract 7th element
                v_temp              :=
                    SUBSTR(v_text,
                           INSTR(v_text, ',', 1, 6) + 1,
                           INSTR(v_text, ',', 1, 7) - 1 - INSTR(v_text, ',', 1, 6)
                          );
                v_rea_origin        := v_temp;
                -- Extract last element
                v_temp              := SUBSTR(v_text, INSTR(v_text, ',', 1, 7) + 1);
                v_qi                := v_temp;
               
                --  Do something with the data...
                DBMS_OUTPUT.put_line('v_site_asset_id: ' || v_site_asset_id);
                DBMS_OUTPUT.put_line('v_monp_code: ' || v_monp_code);
                DBMS_OUTPUT.put_line('v_ftyp_code: ' || v_ftyp_code);
                DBMS_OUTPUT.put_line('v_mea_code: ' || v_mea_code);
                DBMS_OUTPUT.put_line('v_rea_dt_primary: ' || v_rea_dt_primary);
                DBMS_OUTPUT.put_line('v_rea_value: ' || v_rea_value);
                DBMS_OUTPUT.put_line('v_rea_origin: ' || v_rea_origin);
                DBMS_OUTPUT.put_line('v_qi: ' || v_qi);
                DBMS_OUTPUT.put_line('------------------------------------------------------------------');
            END IF;
        EXCEPTION
            WHEN NO_DATA_FOUND
            THEN
                v_eof    := TRUE;
            WHEN OTHERS
            THEN
                DBMS_OUTPUT.put_line('*************************************************************');
                DBMS_OUTPUT.put_line(SQLERRM);
                DBMS_OUTPUT.put_line(v_text);
                DBMS_OUTPUT.put_line(v_temp);
                DBMS_OUTPUT.put_line('*************************************************************');
        END;
    END LOOP;

    UTL_FILE.fclose(v_filehandle);
    RETURN;
EXCEPTION
    WHEN OTHERS
    THEN
        IF UTL_FILE.is_open(v_filehandle)
        THEN
            UTL_FILE.fclose(v_filehandle);
        END IF;

        RAISE;
END read_csv;

 

by: sdstuberPosted on 2008-01-20 at 20:31:17ID: 20703897

Can I ask, why only a "B"?  what else did you need?

 

by: darrylf290567Posted on 2008-01-23 at 01:08:51ID: 20721837

hi sdstuber,

What about if the data is using comma as the delimiter BUT the data in each column is shorter or longer is there a way that we can write a generic PLSQL to handle all comma delimited files with varying data column sizes.

Please can you help
darrylf290567

 

by: sdstuberPosted on 2008-01-23 at 04:37:31ID: 20722757

The code I sent above doesn't consider fixed length data.  It adjusts for every element.  When you extract the data you have to put it "somewhere" so your variables need to be large enough to handle the biggest possible field.  I defined the v_xxxxxx variables to match the data I saw in your examples but for unknown data I would increase the varchar2 variables  to 32767

 

by: darrylf290567Posted on 2008-01-23 at 15:17:53ID: 20728993

Hi sdstuber,

What I mean by a generic csv reader is that when the PLSQL code is reading the data it might start of identifying that the first comma is at position 6 (meaning that the data is 5 characters in length before the comma) in the first line. Whereas another csv file will have the first comma on the first line positioned at position 9 (meaning that the data is 8 characters in length before the comma). Can the code in your answer that you have supplied to me handle these issues?

Can you please help sdstuber? I really appreciate this.

data file:
SITE_ASSET_ID,MONP_CODE,FTYP_CODE,MEA_CODE,REA_DT_PRIMARY,REA_VALUE,REA_CREATED_BY,REA_ORIGIN
101007,w4,STO,OPTIMUM,20070704120000,112800,GDI,Excel
101007,w4,STO,OPTIMUM,20070711120000,119900,GDI,Excel
101007,w4,STO,OPTIMUM,20070718120000,128400,GDI,Excel
101007,w4,STO,OPTIMUM,20070725120000,137900,GDI,Excel
101007,w4,STO,OPTIMUM,20070801120000,148400,GDI,Excel
101007,w4,STO,OPTIMUM,20070808120000,158000,GDI,Excel
101007,w4,STO,OPTIMUM,20070815120000,167900,GDI,Excel
101007,w4,STO,OPTIMUM,20070822120000,177900,GDI,Excel
101007,w4,STO,OPTIMUM,20070829120000,187600,GDI,Excel
101007,w4,STO,OPTIMUM,20070905120000,192400,GDI,Excel
101007,w4,STO,OPTIMUM,20070912120000,197000,GDI,Excel
101007,w4,STO,OPTIMUM,20070919120000,202500,GDI,Excel
101007,w4,STO,OPTIMUM,20070926120000,208300,GDI,Excel
101007,w4,STO,OPTIMUM,20071003120000,213900,GDI,Excel
101007,w4,STO,OPTIMUM,20071010120000,218000,GDI,Excel
101007,w4,STO,OPTIMUM,20071017120000,222900,GDI,Excel
101007,w4,STO,OPTIMUM,20071024120000,227600,GDI,Excel
101007,w4,STO,OPTIMUM,20071031120000,232100,GDI,Excel
101007,w4,STO,OPTIMUM,20071107120000,233900,GDI,Excel
101007,w4,STO,OPTIMUM,20071114120000,234800,GDI,Excel

data file 2:
SITE_ASSET_ID,MONP_CODE,FTYP_CODE,MEA_CODE,REA_DT_PRIMARY,REA_VALUE,REA_ORIGIN
17101,2,PWR,PMRKW,20000718120000,27788,SR693596
17101,2,PWR,PMRKW,20000818120000,27866,SR693596
17101,2,PWR,PMRKW,20000918120000,27913,SR693596
17101,2,PWR,PMRKW,20001018120000,28094,SR693596
17101,2,PWR,PMRKW,20001101120000,28224,SR693596
17101,2,PWR,PMRKW,20001108120000,28285,SR693596
17101,2,PWR,PMRKW,20001114120000,28340,SR693596
17101,2,PWR,PMRKW,20001122120000,28432,SR693596
17101,2,PWR,PMRKW,20001129120000,28538,SR693596
17101,2,PWR,PMRKW,20001205120000,28605,SR693596
17101,2,PWR,PMRKW,20001213120000,28695,SR693596

data file 3:
Site,mp,fac,meas,Reading Date,TARCON,origin
9714,1,MTR,TARCON,20070701120000,93035,SR695367
9714,1,MTR,TARCON,20070702120000,93035,SR695367
9714,1,MTR,TARCON,20070703120000,93035,SR695367
9714,1,MTR,TARCON,20070704120000,93035,SR695367
9714,1,MTR,TARCON,20070705120000,93035,SR695367
9714,1,MTR,TARCON,20070706120000,93035,SR695367
9714,1,MTR,TARCON,20070707120000,93035,SR695367
9714,1,MTR,TARCON,20070708120000,93035,SR695367
9714,1,MTR,TARCON,20070709120000,93035,SR695367
9714,1,MTR,TARCON,20070710120000,93035,SR695367
9714,1,MTR,TARCON,20070711120000,93035,SR695367


Kindest Regards
darrylf290567

 

by: sdstuberPosted on 2008-01-23 at 16:17:54ID: 20729436

You can't do dynamic variable declarations, so you can't create a 5-char variable for one file and 9-char variable for another file.

You can create a 32767-char variable and then read whatever you want.

The code I sent doesn't care how long the data is.  Change all my variables to 32767 and it'll work for any file (up to 32767, of course)

If, you're looking for something that will enforce size rules on an entire file based on the contents of the first line of that file, that's something different.  It's possible,  post a new question with all of the rules you're looking for.  I'll try to get to it sometime tonight or early tomorrow morning.

 

by: sdstuberPosted on 2008-01-23 at 16:19:26ID: 20729458

I am still curious as to why you only scored a "B", didn't I answer what you asked?  Maybe not what you wanted, but what you asked?

The standard is supposed to "A" grade,  with B and C denoting degrees of failure.  If my answer failed, I'd like to know why.

 

by: darrylf290567Posted on 2008-01-23 at 16:55:34ID: 20729669

Hi sdstuber,

I do apologise but you did deserve an A grade. I msinterpreted the marking system and I apologise.

I will post another question right now.

kind regards
darrylf290567

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...