Need to include header in csv file while using GUI_DOWNLOAD
Hi,
Iam using GUI_DOWNLOAD for downloading certain texts,its working fine.now i need to include the header(i'e) some text say 'This is a error file'at the top.how can i do this?
REPORT ZTEST12347 .
DATA: BEGIN OF ITAB OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
END OF ITAB.
SELECT VBELN
POSNR
FROM VBAP
UP TO 20 ROWS
INTO TABLE ITAB.
DATA: IT_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE.
IT_LINE-TDLINE = 'this is error file'.
append it_line.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:test.txt'
TABLES
DATA_TAB = IT_LINE
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'C:test.txt'
APPEND = 'X'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Similar Messages
-
Manipulating excel file while using GUI_DOWNLOAD
hi all,
while using GUI_UPLOAD i want to
1) fix the width of the column of excel file
2) define the font of the data in excel file
3) change background color of the cells in excel file.
please suggest as to how can this be done?using GUI_DOWNLOAD you can't change the data in excel sheet...if you want to do the things you need to use OLE concpets for downloading of data to Excel sheet wherein you can do most of the options excel can handle..
Check within SDN as there are blogs for downloading data to Excel sheet using OLE concepts.. -
How export to csv work in safari browser?
In my application export to csv open like a raw data in new tab.
But other browsers working great!.
Need to open in a csv file or save it as a csv file.
Please suggest me. Thank you in advance!.Hi Adrian,
Why don't you try any another software for opening CSV files then Notepad ? According to my experience, you can use these softwares to open an CSV files and they are:-
Microsoft Excel
Open Office Calc
Google Docs
Also there is an additional tool available known as CSV viewer. You may try this, download it from here http://www.csvviewer.com/
I've never used Notepad for opening CSV files, because sometimes it contains some symbols which are not not at all compatibile with Notepad.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. -
How to create a header in csv file
I´m still newbie in Labview, I just learnt it this week..
I want to make a data translation for temperature sensor..
I´m having trouble to create a header in csv file,can anybody help me ?
I also attach my csv file, what I wanted to make is like this :
dt ( ms )
channel 0
channel 1
channel 2
0,1
1
2
3
0,2
4
5
6
0,3
7
8
9
0,4
10
11
12
I also want to know how to make the time count from 0 not from the real time..
Solved!
Go to Solution.
Attachments:
my block diagram.jpg 266 KB
my csv file.jpg 508 KBI already solve the problem, It´s quite confusing, I must use ; instead of \t at the delimiter.
I have another question to ask :
- When I start the program,can I make the dt(ms) count from 0 ? What I can do is using the Format/Date time string, I don´t want the time count based on the real time.
This is what I made
dt(ms)
Ch0
10:04:2012 13:12:06,871
24,139404
10:04:2012 13:12:08,924
23,773193
10:04:2012 13:12:08,925
23,132324
10:04:2012 13:12:08,926
22,918701
What I want is like this :
dt(ms)
Ch0
0
24,139404
0,01
23,773193
0,02
23,132324
0,03
22,918701
Thx for the helps..
Regards
Citras
Attachments:
test_temp.vi 25 KB -
How to privacy text as header in csv file
how to add some privacy text ex:@copyright as header of csv file. when we down load as the report in csv format.
CSV is derived from download to data option, it uploads only data not any other views text appearing in compound layout
Make that text part of your table data, then it may be achievable -
Appending multiple *.csv files while retaining the original file name in the first column
Hi guys it's been awhile.
I'm trying to append multiple *.csv files while retaining the original file name in the first column, the actual data set is about 40 files.
file a.csv contains:
1, line one in a.csv
2, line two in a.csv
file b.csv contains:
1, line one in b.csv
2, line two in b.csv
output.csv result is this:
I would like this:
a.csv, 1, line one in a.csv
a.csv, 2, line two in a.csv
b.csv, 1, line one in b.csv
b.csv, 2, line two in b.csv
Any suggestions to speed up my hobbling attempts would be aprieciated
Thanks,
-SS
Solved!
Go to Solution.What you could do is given in the attachment.
Started with 2 files :
a.csv
copy of a.csv
Both with data :
1;1.123
2;2.234
3;3.345
Output :
a.csv;1;1.123
a.csv;2;2.234
a.csv;3;3.345
Copy of a.csv;1;1.123
Copy of a.csv;2;2.234
Copy of a.csv;3;3.345
If you have more questions, just shoot
Kind regards,
- Bjorn -
Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's
LabVIEW 5.1 - LabVIEW 2012
Attachments:
AppendingCSV.JPG 73 KB -
How can we a validate a CSV file in SSIS and log the error details in another CSV File by using Sript Task.
Please see:
http://www.bidn.com/blogs/DevinKnight/ssis/76/does-file-exist-check-in-ssis
http://social.msdn.microsoft.com/Forums/en-US/01ce7e4b-5a33-454b-8056-d48341da5eb2/vb-script-to-write-variables-to-text-file -
Type of error in the log file while using using call transaction mode u2018Eu2019
Hi Gurus,
Please Answer for this qusetion urgently
what type of error exactly you will be seeing in the log file while using call transaction mode u2018Eu2019?
Thanks/
Radha.Hi,
Can you be clear.
In call transaction , no error logs are created, you have to handle the errors explicitly using the structure BDCMSGCOLL.
Whenever you use E mode then if the transaction encounters any of the errors i.e. data type mismatching or invalid values etc, it will stop at that screen.
You can handle the errors in call transaction in the following method.
create a table using the structure BDCMSGCOLL.
then
loop at ......
CALL TRANSACTION 'XK01' USING I_BDCDATA MODE 'N' UPDATE 'S' MESSAGES INTO I_MESGTAB.
endloop.
SORT I_MESGTAB BY MSGID MSGV1 ASCENDING.
DELETE ADJACENT DUPLICATES FROM I_MESGTAB.
LOOP AT I_MESGTAB.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = I_MESGTAB-MSGID
LANG = I_MESGTAB-MSGSPRA
NO = I_MESGTAB-MSGNR
V1 = I_MESGTAB-MSGV1
V2 = I_MESGTAB-MSGV2
V3 = I_MESGTAB-MSGV3
V4 = I_MESGTAB-MSGV4
IMPORTING
MSG = MESG1.
IF I_MESGTAB-MSGTYP = 'S' .
WA_SUCCMESG-MESG = MESG1.
APPEND WA_SUCCMESG TO I_SUCCMESG.
else IF I_MESGTAB-MSGTYP = 'E' .
WA_ERRMESG-MESG = MESG1.
APPEND WA_ERRMESG TO I_ERRMESG.
ENDIF.
ENDLOOP.
Hope this is clear.
Thanks and Regards. -
Blank spaces while using GUI_DOWNLOAD for Chinese characters
Hi,
While using GUI_DOWNLOAD for chinese characters I have used a code page option of 8300 for Chinese.
The file which is getting downloaded in a notepad has some Chinese characters coming under some headings.
After that columns other columns are getting shifted towards the right.
This is working correctly for English characters.
Can someone please help me.
Now I am using CL_GUI_FRONT_END_SERVICES=>GUI_DOWNLOAD.
What special options should I pass now.
Regards,
SubhashiniHi,
I only solved my problem by using different code pages 8400 and 8300 for Chinese and Taiwanese characters.
I fixed the lengths of the fields by converting them to hexadecimal string and back to string using these function modules as below.
DATA:lv_xstring TYPE xstring,
lv_temp TYPE string.
DATA: lv_conv TYPE REF TO cl_abap_conv_in_ce.
lv_temp = p_name.
CALL FUNCTION 'HR_KR_STRING_TO_XSTRING'
EXPORTING
codepage_to = p_codepage
unicode_string = lv_temp
out_len = p_outlen
IMPORTING
xstring_stream = lv_xstring
EXCEPTIONS
invalid_codepage = 1
invalid_string = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
from_codepage = p_codepage
in_xstring = lv_xstring
out_len = p_outlen
IMPORTING
out_string = p_string.
Create a Conversion Instance
lv_conv = cl_abap_conv_in_ce=>create(
encoding = p_codepage
input = lv_xstring ).
v_conv->read( IMPORTING data = p_string ).
Regards,
Subhashini -
First Row Record is not inserted from CSV file while bulk insert in sql server
Hi Everyone,
I have a csv file that needs to be inserted in sql server. The csv file will be format will be like below.
1,Mr,"x,y",4
2,Mr,"a,b",5
3,Ms,"v,b",6
While Bulk insert it coniders the 2nd column as two values (comma separte) and makes two entries .So i used filelterminator.xml.
Now, the fields are entered into the column correctly. But now the problem is, the first row of the csv file is not reading in sql server. when i removed the terminator, i can get the all records. But i must use the above code terminator. If
am using means, am not getting the first row record.
Please suggests me some solution.
Thanks,
SelvamHi,
I have a csv file (comma(,) delimited) like this which is to be insert to sql server. The format of the file when open in notepad like below:
Id,FirstName,LastName,FullName,Gender
1,xx,yy,"xx,yy",M
2,zz,cc,"zz,cc",F
3,aa,vv,"aa,vv",F
The below is the bulk insert query which is used for insert above records,
EXEC(BULK INSERT EmployeeData FROM '''+@FilePath+'''WITH
(formatfile=''d:\FieldTerminator.xml'',
ROWTERMINATOR=''\n'',
FIRSTROW=2)'
Here, I have used format file for the "Fullname" which has comma(,) within the field. The format file is:
The problem is , it skip the first record (1,xx,yy,"xx,yy",M) when i use the format file. When i remove the format file from the query, it takes all the records but the "fullName" field makes the problem because of comma(,) within the
field. So i must use the format file to handle this. So please suggest me , why the first record skipped always when i use the above format file.
If i give the "FirstRow=1" in bulk insert, it shows the "String or binary data would be truncated.
The statement has been terminated." error. I have checked the datatype length.
Please update me the solution.
Regards,
Selvam. M -
Need help with query from .csv file
I am trying to import a csv file with only 1 column in it.
The column will only contain a 9 digit ID number. I want to read
the file then use the contents to query a table to get the names
and other information and display it. Here is what I have so far:
<cffile action="read" file="#form.FiletoUpload#"
variable="csvfile">
<cfloop index="index" list="#csvfile#">
<cfquery name="massimport" datasource="data1">
SELECT * FROM IDTable
WHERE CardNumber = ('#csvfile#')
</cfquery>
</cfloop>
<cfoutput>#Name# #ID# #Site#</cfoutput>
I get no errors but I am not getting any results. Just a
blank page. Does anyone know how to query directly from a csv
import? Thanks.You need to convert your file to a list somehow. Not sure if
this is the most efficient way but, you can use the cfhttp tag to
produce a query. Then your where clause becomes,
where cardnumber in (#quotedvaluelist(query.column)#)
and you won't need a loop. -
Include XSL file while using API
Hello,
I want to use the include tag to include a XSL Stylesheet to my RTF while using the API
If I run the report locally I use:
<?import:file:///C:/temp/htmlmarkup.xsl?>
If I run the report on APPS I use:
<?import:xdo://INV.HTMLMARKUP.de.DE?>
But what do I refer if I am in the context of the APIs? My XSL file is in the java-resource-tree available under:
com.my.application.bi.resource.style.htmlmarkup.xsl
But I allways get XML-22002: (Fatal Error) Error while processing include XSL file
Any hints for me?
Best Regards
AlexanderNo, you cannot do this. Using the Acrobat SDK a programmer can combine PDF files using OLE.
-
Need to load 2.4GB CSV file
I would like to load a portion of a 2.4gb csv file to a 10g table. The file is too large to open in notepad or excel. How can I load a portion of this file to a table?
Can I load the data into a generic table(do not define columns). Let the file dictate the colums. Is that possible? I'm not sure of the layout of the file because it is too large.
Thanks
SteveUnfortunately DOS doesn't have the stream tools available in shell programming, but you can install cygwin and use line editors or stream editors to perform this task, you could use the head or tail command or sed or grep to gather a few lines, redirect the output to a sample file.
You cannot have a partially or non defined table in Oracle, but once you have the sqlldr to perform the table load, you can create an external table based on the file and you can query just a row subset. In order for you to create an external table based on the sqlloader controlfile is by means of the external_table=generate_only clause of the sqlldr executable. -
Leading Spaces in CSV file while sending Email
Hi All,
Iam sending CSV file via email, Iam getting leading space for the first field from column second.
I have used the below code for appending internal table.
Concatenating all the fileds with comma separator and aded 'cl_abap_char_utilities=>newline' at the last.
For first column iam getting correctly, form second column onwards iam getting spaces in front of first field. I have used the FM, SO_NEW_DOCUMENT_ATT_SEND_API1 for sending the email. Please suggest. thanks.Hi,
Concatenate cl_abap_char_utilities=>cr_lf before every line/record of the file.
This should resolve the issue.
Thanks,
Anupam -
Csv file processing using external table
Dear All,
Our database is oracle 10g r2 and OS is solaris
We would receive csv files to a particular directory on server each day.
File Format look like:
H00,SOURCE_NAME,FILE_CREATED_DATE
RECORD_TYPE,EMP_ID,EMP_NAME,EMP_DOB(DDMMYYYY),EMP_HIRE_DATE(DDMMYYYY),EMP_LOCATION
T00,RECORD_COUNT
EMPLOYEE TABLE STRUCTURE
EMP_ID NOT NULL NUMBER ,
EMP_NAME NOT NULL VARCHAR2(10) ,
EMP_DOB DATE,
EMP_HIRE_DATE NOT NULL DATE,
EMP_LOCATION VARCHAR2(80)
Sample File:
H00,ABC,21092013
"R01",1,"EMP1","14021986","06072010","LOC1"
"R01",20000000000,"EMP2","14021-987","06072011",""
,***,"EMPPPPPPPPPPP3","14021988","060**012","LOC2"
"R01",4,4,"14021989","06072013",
T00,4
we need to validate each record excluding header and trailer for:
DATATYPE, LENGTH,OPTIONALITY, and other date validations such as EMP_HIRE_DATE can not be less than EMP_DOB
In case of any data errors we need to send a response file for corresponding source file.
we have predefined error codes to be sent in the response file.
ERR001 EMP_ID can not be null
ERR002 EMP_ID exceeds 10 digits
ERR003 EMP_ID is not a number
ERR004 EMP_NAME has to be text
ERR005 EMP_NAME length can not exceed 10
ERR006 EMP_NAME can not be null
ERR007 EMP_DOB is not a date
ERR008 EMP_DOB is not in ddmmyyyy format
ERR009 EMP_HIRE_DATE is not a date
ERR010 EMP_HIRE_DATE is not in ddmmyyyy format
ERR011 EMP_HIRE_DATE can not be null
ERR012 EMP_LOCATION has to be text
ERR013 EMP_LOCATION length can not exceed 80
ERR014 EMP_HIRE_DATE can not be less than EMP_DOB
ERR015 Field missing in the record
ERR016 More number of fields than allowed
1.Do I need to create external table before processing each file.(EMP1.txt,EMP2.txt)?
2.How to generate these error codes in case of respective failure scenarios and to log into an exception table?
3.response file needs to have entire record and a concatination of all the error codes in the next line.
4.what would be a better approach among
creating an external table with all char(2000) fields and writing a select statement
such as select * from ext_table where (emp id is not null and length(emp_id)<=10 and....to select only proper data);
or creating the external table to be same as employee table and creating a bad file? if this is the preferred how can I generate the custom error codes?
Could you please help me in achieving this!
Warm Regards,
Shankar.You can do a one-time creation of an external table. After that, you can either overwrite the existing text file or alter the location. In the example below I have split your original sample file into two files, in order to demonstrate altering the location. You can make the external table all varchar2 fields as large as they need to be to accommodate all possible data. If you then create a staging table and rejects table of the same structure, you can create a trigger on the staging table such that, when you insert from the external table to the staging table, it inserts into either the employee table or rejects table with the concatenated error list. If you want this in a file, then you can just spool a select from the rejects table or use some other method such as utl_file. The following is a partial example. Another alternative would be to use SQL*Loader to load directly into the staging table without an external table.
SCOTT@orcl12c> HOST TYPE emp1.txt
H00,ABC,21092013
"R01",1,"EMP1","14021986","06072010","LOC1"
"R01",20000000000,"EMP2","14021-987","06072011",""
T00,4
SCOTT@orcl12c> HOST TYPE emp2.txt
H00,ABC,21092013
,***,"EMPPPPPPPPPPP3","14021988","060**012","LOC2"
"R01",4,4,"14021989","06072013",
T00,4
SCOTT@orcl12c> CREATE OR REPLACE DIRECTORY my_dir AS 'c:\my_oracle_files'
2 /
Directory created.
SCOTT@orcl12c> CREATE TABLE external_table
2 (record_type VARCHAR2(10),
3 emp_id VARCHAR2(11),
4 emp_name VARCHAR2(14),
5 emp_dob VARCHAR2(10),
6 emp_hire_date VARCHAR2(10),
7 emp_location VARCHAR2(80))
8 ORGANIZATION external
9 (TYPE oracle_loader
10 DEFAULT DIRECTORY my_dir
11 ACCESS PARAMETERS
12 (RECORDS DELIMITED BY NEWLINE
13 LOAD WHEN ((1: 3) != "H00" AND (1:3) != 'T00')
14 LOGFILE 'test.log'
15 FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' LDRTRIM
16 MISSING FIELD VALUES ARE NULL
17 REJECT ROWS WITH ALL NULL FIELDS
18 (record_type, emp_id, emp_name, emp_dob, emp_hire_date, emp_location))
19 LOCATION ('emp1.txt'))
20 /
Table created.
SCOTT@orcl12c> CREATE TABLE staging
2 (record_type VARCHAR2(10),
3 emp_id VARCHAR2(11),
4 emp_name VARCHAR2(14),
5 emp_dob VARCHAR2(10),
6 emp_hire_date VARCHAR2(10),
7 emp_location VARCHAR2(80))
8 /
Table created.
SCOTT@orcl12c> CREATE TABLE employee
2 (emp_id NUMBER NOT NULL,
3 emp_name VARCHAR2(10) NOT NULL,
4 emp_dob DATE,
5 emp_hire_date DATE,
6 emp_location VARCHAR2(80))
7 /
Table created.
SCOTT@orcl12c> CREATE TABLE rejects
2 (record_type VARCHAR2(10),
3 emp_id VARCHAR2(11),
4 emp_name VARCHAR2(14),
5 emp_dob VARCHAR2(10),
6 emp_hire_date VARCHAR2(10),
7 emp_location VARCHAR2(80),
8 error_codes VARCHAR2(4000))
9 /
Table created.
SCOTT@orcl12c> CREATE OR REPLACE TRIGGER staging_air
2 AFTER INSERT ON staging
3 FOR EACH ROW
4 DECLARE
5 v_rejects NUMBER := 0;
6 v_error_codes VARCHAR2(4000);
7 v_num NUMBER;
8 v_dob DATE;
9 v_hire DATE;
10 BEGIN
11 IF :NEW.emp_id IS NULL THEN
12 v_rejects := v_rejects + 1;
13 v_error_codes := v_error_codes || ',' || 'ERR001';
14 ELSIF LENGTH (:NEW.emp_id) > 10 THEN
15 v_rejects := v_rejects + 1;
16 v_error_codes := v_error_codes || ',' || 'ERR002';
17 END IF;
18 BEGIN
19 v_num := TO_NUMBER (:NEW.emp_id);
20 EXCEPTION
21 WHEN value_error THEN
22 v_rejects := v_rejects + 1;
23 v_error_codes := v_error_codes || ',' || 'ERR003';
24 END;
25 IF :NEW.emp_name IS NULL THEN
26 v_rejects := v_rejects + 1;
27 v_error_codes := v_error_codes || ',' || 'ERR006';
28 ELSIF LENGTH (:NEW.emp_name) > 10 THEN
29 v_rejects := v_rejects + 1;
30 v_error_codes := v_error_codes || ',' || 'ERR005';
31 END IF;
32 BEGIN
33 v_dob := TO_DATE (:NEW.emp_dob, 'ddmmyyyy');
34 EXCEPTION
35 WHEN OTHERS THEN
36 v_rejects := v_rejects + 1;
37 v_error_codes := v_error_codes || ',' || 'ERR008';
38 END;
39 BEGIN
40 IF :NEW.emp_hire_date IS NULL THEN
41 v_rejects := v_rejects + 1;
42 v_error_codes := v_error_codes || ',' || 'ERR011';
43 ELSE
44 v_hire := TO_DATE (:NEW.emp_hire_date, 'ddmmyyyy');
45 END IF;
46 EXCEPTION
47 WHEN OTHERS THEN
48 v_rejects := v_rejects + 1;
49 v_error_codes := v_error_codes || ',' || 'ERR010';
50 END;
51 IF LENGTH (:NEW.emp_location) > 80 THEN
52 v_rejects := v_rejects + 1;
53 v_error_codes := v_error_codes || ',' || 'ERR013';
54 END IF;
55 IF v_hire IS NOT NULL AND v_dob IS NOT NULL AND v_hire < v_dob THEN
56 v_rejects := v_rejects + 1;
57 v_error_codes := v_error_codes || ',' || 'ERR014';
58 END IF;
59 IF :NEW.emp_id IS NULL OR :NEW.emp_name IS NULL OR :NEW.emp_dob IS NULL
60 OR :NEW.emp_hire_date IS NULL OR :NEW.emp_location IS NULL THEN
61 v_rejects := v_rejects + 1;
62 v_error_codes := v_error_codes || ',' || 'ERR015';
63 END IF;
64 IF v_rejects = 0 THEN
65 INSERT INTO employee (emp_id, emp_name, emp_dob, emp_hire_date, emp_location)
66 VALUES (:NEW.emp_id, :NEW.emp_name,
67 TO_DATE (:NEW.emp_dob, 'ddmmyyyy'), TO_DATE (:NEW.emp_hire_date, 'ddmmyyyy'),
68 :NEW.emp_location);
69 ELSE
70 v_error_codes := LTRIM (v_error_codes, ',');
71 INSERT INTO rejects
72 (record_type,
73 emp_id, emp_name, emp_dob, emp_hire_date, emp_location,
74 error_codes)
75 VALUES
76 (:NEW.record_type,
77 :NEW.emp_id, :NEW.emp_name, :NEW.emp_dob, :NEW.emp_hire_date, :NEW.emp_location,
78 v_error_codes);
79 END IF;
80 END staging_air;
81 /
Trigger created.
SCOTT@orcl12c> SHOW ERRORS
No errors.
SCOTT@orcl12c> INSERT INTO staging SELECT * FROM external_table
2 /
2 rows created.
SCOTT@orcl12c> ALTER TABLE external_table LOCATION ('emp2.txt')
2 /
Table altered.
SCOTT@orcl12c> INSERT INTO staging SELECT * FROM external_table
2 /
2 rows created.
SCOTT@orcl12c> SELECT * FROM employee
2 /
EMP_ID EMP_NAME EMP_DOB EMP_HIRE_DATE EMP_LOCATION
1 EMP1 Fri 14-Feb-1986 Tue 06-Jul-2010 LOC1
1 row selected.
SCOTT@orcl12c> COLUMN error_codes NEWLINE
SCOTT@orcl12c> SELECT * FROM rejects
2 /
RECORD_TYP EMP_ID EMP_NAME EMP_DOB EMP_HIRE_D EMP_LOCATION
ERROR_CODES
R01 20000000000 EMP2 14021-987 06072011
ERR002,ERR008,ERR015
*** EMPPPPPPPPPPP3 14021988 060**012 LOC2
ERR003,ERR005,ERR010
R01 4 4 14021989 06072013
ERR015
3 rows selected.
Maybe you are looking for
-
Ipod touch 4 gen is not recognised by itunes
my ipod touch 4 generation is not recognised by itunes even i have tried all the suggestions given in the ipod user including uninstalling and reinstalling itunes and some other stuff but nothing has happened
-
Annoying voice mail icon won't go away!! N73ME
Hi, I was just wondering if anyone could tell me of a way to get rid of the notification icon for voicemail. I was given a voicemail, got the icon appear, phoned my voicemail box, listened to the message, deleted the message but the icon and notifica
-
How do you delete pages from a PDF?
I have an 8 page Adobe PDF file that I need 4 pages deleted from. How can perform this task? Thanks!
-
Leopard's Safari parental controls should have kept Tiger's approach
Parental controls for Safari in Leopard do not work as well as Tiger's. Tiger had the option to allow only sites that are bookmarked. Now you have to add them in the parental control's dialog. But more annoying and worst behavior is that you must app
-
my code currently is this public class Stars // Prints a triangle shape using asterisks (stars) public static void main (String[] args) final int MAX_ROWS = 10; //when the number of rows is less than 10 (the max number of rows) then add