Upload .txt file into Database Table
Hi,
I was wondering if someone could please point me in the right direction. I've been looking around the forum but can't find anything to help me achieve the following.
I would like to be able to upload a .txt file using a webpage. Then store the information inside this file into database tables.
eg. contents of mytextfile.txt:
richard
10 anywhere street, anytown, somewhere
111 222 333 444
joe
9 somestreet, elsewhere
999 888 777 666
peter
214 nearby lane, overhere
555 555 555 555
I would like to insert this data into a table.
eg. table name = CONTACTS
userid = primary key (using sequence)
username = (line 1 - richard, joe, peter)
address = (line 2)
phone_no = (line 3)
As you can see the records will appear 1 at a time and will have a blank line between records. Is there anyway for me to upload a file like this and have it placed into tables?
I have seen http://otn.oracle.com/products/database/htmldb/howtos/howto_file_upload.html but this seems to be for uploading a whole file and downloading the same file, rather than extracting data from the file.
I hope I have managed to explain my problem.
Many thanks,
Richard.
Richard,
HTML DB allows you to upload CSV files via the Data Workshop. That data would then be parsed and inserted into a specific table. Alternatively, if you have your data in an Excel spreadsheet, and it is less than 32k, you can copy & paste the data directly into HTML DB's Data Workshop, which will then parse and import it into the Oracle database.
The one obstacle you may have to overcome is converting your data from the format you outlined to CSV format. Specifically, you would have to make this:
richard
10 anywhere street, anytown, somewhere
111 222 333 444
Look something like this:
"richard","10 anywhere street, anytown, somewhere","111 222 333 444"
Hope this helps,
- Scott -
Similar Messages
-
SQL Loader problem while loading records from txt file to database table.
I am getting following error while loading records from flat txt file into database table with the help of 'sqlldr' command. I have executed catldr.sql from RDBMS folder but it is still showing same error. I am setting DIRECT = TRUE while issuing sqlldr command. If I try with DIRECT = FALSE then it works fine. Database is Oracle 8i.
SQL*Loader-951: Error calling once/load initialization
ORA-24329: invalid character set identifier
F1 Please.Hello,
Direct path load, can only be used with SQL*Loader and Database have the same version.
Care to tell the database version and sql*loader version you are using.
-Sri -
Help Required:How Upload Excel file Into Oracle Table Using PLSQL Procedure
Please Help , Urgent Help Needed.
Requirement is to Upload Excel file Into Oracle Table Using PLSQL Procedure/Package.
Case's are :
1. Excel File is On Users/ Client PC.
2. Application is on Remote Server(Oracle Forms D2k).
3. User Is Using Application Using Terminal Server LogIn.
4. So If User Will Use to GET_FILE_NAME() function of D2K to Get Excel File , D2k Will Try to pick File from That Remote Server(Bcs User Logind from Terminal Server Option).
5. Cannot Use Util_File Package Or Oracle Directory to Place That File on Server.
6. we are Using Oracle 8.7
So Need Some PL/SQL Package or Fuction/ Procedure to Upload Excel file on User's Pc to Oracle Table.
Please Guide me wd some Code. or with Some Pl/SQL Package, or With SOme Hint. Or any Link ....
Jus help to Sort This Issue ........
you can also write me on :
[email protected], [email protected]TEXT_IO is a PL/SQL package available only in Forms (you'll want to post in the Forms forum for more information). It is not available in a stored procedure in the database (where the equivalent package is UTL_FILE).
If the Terminal Server machine and the database machine do not have access to the file system on the client machine, no application running on either machine will have access to the file. Barring exceptional setups (like the FTP server on the client machine), your applications are not going to have more access to the client machine than the operating system does.
If you map the client drives from the Terminal Server box, there is the potential for your Forms application to access those files. If you want the files to be accessible to a stored procedure in the database, you'll need to move the files somewhere the database can access them.
Justin -
Loading XML files into Database table
Loading XML files into Database table
Hi I have some XML files say 100 files in a virtual directory created using "Create or replace directory command" and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packagesCheck out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
Ben -
How to batch upload PDF files into database BLOB
Hello.
I have a requirement to batch upload PDF files into BLOB column of an Oracle 8.1.7 table from Forms 6i Web. The content of the blob column (ie. the PDF content) MUST be displayable from all client software (eg. Oracle Web forms, HTML forms, etc.)
Our environment is
Middle-tier is 9iAS on Windows/2000
Database is Oracle 8.1.7.0.0 on VMS
Oracle Web Forms 6i Patch 10
Basically my Oracle web form program will display a list of PDF files to upload and then the user can click on the <Upload> button to do the batch upload. I have experimented the following approaches but with no luck.
1. READ_IMAGE_FILE forms built-in = does NOT work because it cannot read PDF file. I got error FRM-47100: Cannot read image file
2. OCX and OLE form item = cannot use this because it does NOT work on the Web. I got error FRM-41344 OLE object not defined
3. I cannot use DBMS_LOB to do the load because the PDF files are not in the database machine.
4. Metalink Note 1682771.1 (How to upload binary documents back to database blob column from forms). When I used this, I got ORA-6502 during the hextoraw conversion. In using this solution, I have downloaded a bin2hex.exe from the Google site. I've noticed that when I looked at the converted HEX file, each line has the character : (colon) at the beginning of each line. I know the PDF file has been converted correctly to HEX format because when I convert the HEX file back to BIN format using hex2bin.exe, I'm able to display the converted bin file in Acrobat Reader. When I removed the : (colon) in the HEX file, I did NOT get the ORA-6502 error but I CANNOT display the file in Acrobat Reader. It gives an error "corrupted file".
5. upload facility in PL/SQL Web toolkit - I tried to automatically submit the html form (with htp.p) but it does NOT load the contents of the file. I called the URL from Oracle forms using web.show_document. There seems to be issues with Oracle Web forms (JInitiator) and HTML (+ htp.p).
The other options I can think of at this point are:
1. Use SQL*Loader to do the batch upload via SQL*Net connection and use HOST() built-in from Oracle Webforms to execute SQL*Loader from the 9iAS.
2. Write a Visual Basic program that reads a binary file and output the contents of the file into a byte array. Then build a DLL that can be called from Oracle webforms 6i via ORA_FFI. I don't prefer this because it means the solution will only work for Windows.
3. Write a JSP program that streams the PDF file and insert the contents of the PDF file into blob column via JDBC. Call JSP from forms using web.show_document. With this I have to do another connection to the database when I load the file.
4. Maybe I can use dbms_lob by using network file system (NFS) between the application server and VMS. But this will be network resource hungry as far as I know because the network connection has to be kept open.
Please advise. Thank you.
Regards,
ArmandoI have downloaded a bin2hex.exe from the Google site.
... each line has the character : (colon) at the
beginning of each line. I'm afraid it isn't a correct utility. I hope you'll find the source code of a correct one at metalink forum:
Doc ID: 368771.996
Type: Forum
Subject: Uploading Binary Files: bin2hex and hex2bin do not reproduce the same file
There is some links to metalink notes and some example about working with BLOB at http://www.tigralen.spb.ru/oracle/blob/index.htm. Maybe it helps. Sorry for my English. If there is any problem with code provided there, let me know by e-mail. -
Uploading csv file into database using apex
Dear all
I am using apex 4 and oracle express 10g, i need to upload .csv file into the database for one of my appls, i have referred discussion forum for solutions, i found also, but some how its not working for me.
below mentioned is error and the code
ERROR:
ORA-06550: line 38, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 38, column 8: PL/SQL: Statement ignored ORA-06550: line 39, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 39, column 8: PL/SQL: Statement ignored ORA-06550: line 40, column 8: PLS-00221: 'V_DATA_ARRAY' is not a procedure or is undefined ORA-06550: line 40, column 8: PL/SQL: Statement ignored ORA-06550: line 41, column 8: PLS-00221: 'V_DATA_ARRAY' is not a proc
Error
OK
CODE:
DECLARE
v_blob_data BLOB;
v_blob_len NUMBER;
v_position NUMBER;
v_raw_chunk RAW(10000);
v_char CHAR(1);
c_chunk_len number := 1;
v_line VARCHAR2 (32767) := NULL;
v_data_array wwv_flow_global.vc_arr2;
BEGIN
-- Read data from wwv_flow_files
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv';
v_blob_len := dbms_lob.getlength(v_blob_data);
v_position := 1;
-- Read and convert binary to char
WHILE ( v_position <= v_blob_len ) LOOP
v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
v_line := v_line || v_char;
v_position := v_position + c_chunk_len;
-- When a whole line is retrieved
IF v_char = CHR(10) THEN
-- Convert comma to : to use wwv_flow_utilities
v_line := REPLACE (v_line, ',', ':');
-- Convert each column separated by : into array of data
v_data_array := wwv_flow_utilities.string_to_table (v_line);
-- Insert data into target table
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11);
-- Clear out
v_line := NULL;
END IF;
END LOOP;
END;
what i understand from this is system does not identify v_data_array as array for some reasons, please help me.
initially system was giving error for hex_to_decimal, but i managed to get this function on discussion forum and now it seems to be ok. but v_data_array problem is still there.
thanks in advance
regards
UdayHi,
Mistakes in your sample I did correct
Problem 1
select blob_content into v_blob_data
from wwv_flow_files where filename = 'DDNEW.csv'; to
select blob_content into v_blob_data
from wwv_flow_files where name = :P1_FILE;Problem 2
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4);
v_data_array(5);
v_data_array(6);
v_data_array(7);
v_data_array(8);
v_data_array(9);
v_data_array(10);
v_data_array(11); to
EXECUTE IMMEDIATE 'insert into TABLE_X (v1, v2, v3, v4 ,v5, v6, v7,v8 ,v9, v10, v11)
values (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11)'
USING
v_data_array(1),
v_data_array(2),
v_data_array(3),
v_data_array(4),
v_data_array(5),
v_data_array(6),
v_data_array(7),
v_data_array(8),
v_data_array(9),
v_data_array(10),
v_data_array(11); And I did create missing table
CREATE TABLE TABLE_X
v1 VARCHAR2(255),
v2 VARCHAR2(255),
v3 VARCHAR2(255),
v4 VARCHAR2(255),
v5 VARCHAR2(255),
v6 VARCHAR2(255),
v7 VARCHAR2(255),
v8 VARCHAR2(255),
v9 VARCHAR2(255),
v10 VARCHAR2(255),
v11 VARCHAR2(255)
);Regards,
Jari
Edited by: jarola on Nov 19, 2010 3:03 PM -
Uploading .txt file to z table
Hai Friends,
I want to upload a .txt file to Z table which contains around 27 fields. but .txt file contains data in two lines by as follows.
4.5 2.36 21.56 25 36.14 47.00 145.3 1247.6
10.2 4.6 23.5 589.1 20.1 45.6
Is it possible to upload the .txt file.Hi,
It is possible to upload txt file to ztable. You need to write small program for that.
Please see the example code below. Here from excel they are converting to internal table, use 'GUI_UPLOAD' to convert text file data to internal table and use this internal table to upload data into ztable. use MODIFY ZTABLE FROM TABLE ITAB.
Also maintain the internal table structure and structure of the ZTABLE should match.
**& Report Z_DEMO_FILL_TABLE
report z_demo_fill_table no standard page heading line-size 255.
selection-screen begin of block b1 with frame title text-003.
selection-screen skip.
*File Name
selection-screen begin of line.
selection-screen comment 5(28) text-001 for field p_file.
parameters: p_file type rlgrap-filename.
selection-screen end of line.
selection-screen skip.
selection-screen end of block b1.
data declarations.
*data: get_po_header type standard table of BAPIEKKOC,
get_PO_HEADER_ADD_DATA type standard table of BAPIEKKOA,
get_PO_ITEMS type standard table of BAPIEKPOC,
get_PO_ITEM_ADD_DATA type standard table of BAPIEKPOA,
data: get_poheader type standard table of bapimepoheader,
get_poitem type standard table of bapimepoitem,
it_data type table of alsmex_tabline initial size 0.
data: wa_poheader like line of get_poheader,
wa_poitem like line of get_poitem,
wa_data like line of it_data,
*tables used for catching messages returned by bapi
gt_return type standard table of bapiret2,
gt_return1 type standard table of bapiret2.
types: begin of x_po_tab,
doc_date type bapimepoheader-doc_date,
comp_code type bapimepoheader-comp_code,
purch_org type bapimepoheader-purch_org,
pur_group type bapimepoheader-pur_group,
vendor type bapimepoheader-vendor,
po_number type bapimepoheader-po_number,
pmnttrms type bapimepoheader-pmnttrms,
po_item type bapimepoitem-po_item,
material type bapimepoitem-material,
plant type bapimepoitem-plant,
stge_loc type bapimepoitem-stge_loc,
tax_code type bapimepoitem-tax_code,
end of x_po_tab.
Search help for file *
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
field_name = 'P_FILE'
importing
file_name = p_file.
START-OF-SELECTION *
start-of-selection.
perform for uploading Excel file
perform upload_file_path.
perform for transfering Excel data to Internal table
perform excel_to_itab.
perform int_process.
*& Form upload_file_path
text
--> p1 text
<-- p2 text
form upload_file_path .
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = p_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 12
i_end_row = 5000
tables
intern = it_data
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
if sy-subrc <> 0.
message e000(zdbm) with 'Error in getting filename'.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform. " upload_file_path
*& Form excel_to_itab
text
--> p1 text
<-- p2 text
form excel_to_itab .
loop at it_data into wa_data.
at new row.
clear: wa_poheader, wa_poitem.
endat.
case wa_data-col.
when '001'.
move wa_data-value to wa_poheader-doc_date.
when '002'.
move wa_data-value to wa_poheader-comp_code.
when '003'.
move wa_data-value to wa_poheader-purch_org.
when '004'.
move wa_data-value to wa_poheader-pur_group.
when '005'.
move wa_data-value to wa_poheader-vendor.
when '006'.
move wa_data-value to wa_poheader-po_number.
when '007'.
move wa_data-value to wa_poheader-pmnttrms.
when '008'.
move wa_data-value to wa_poitem-po_item.
when '009'.
move wa_data-value to wa_poitem-material.
when '010'.
move wa_data-value to wa_poitem-plant.
when '011'.
move wa_data-value to wa_poitem-stge_loc.
when '012'.
move wa_data-value to wa_poitem-tax_code.
endcase.
at end of row.
append wa_poheader to get_poheader.
append wa_poitem to get_poitem.
endat.
clear: wa_data.
endloop.
endform. " excel_to_itab
*& Form Int_process
text
--> p1 text
<-- p2 text
form int_process .
loop at get_poheader into wa_poheader.
read table get_poitem into wa_poitem index 1.
call function 'BAPI_PO_CREATE1'
exporting
poheader = wa_poheader
POHEADERX =
POADDRVENDOR =
TESTRUN =
MEMORY_UNCOMPLETE =
MEMORY_COMPLETE =
POEXPIMPHEADER =
POEXPIMPHEADERX =
VERSIONS =
NO_MESSAGING =
NO_MESSAGE_REQ =
NO_AUTHORITY =
NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER =
EXPHEADER =
EXPPOEXPIMPHEADER =
tables
RETURN =
poitem = get_poitem
POITEMX =
POADDRDELIVERY =
POSCHEDULE =
POSCHEDULEX =
POACCOUNT =
POACCOUNTPROFITSEGMENT =
POACCOUNTX =
POCONDHEADER =
POCONDHEADERX =
POCOND =
POCONDX =
POLIMITS =
POCONTRACTLIMITS =
POSERVICES =
POSRVACCESSVALUES =
POSERVICESTEXT =
EXTENSIONIN =
EXTENSIONOUT =
POEXPIMPITEM =
POEXPIMPITEMX =
POTEXTHEADER =
POTEXTITEM =
ALLVERSIONS =
POPARTNER =
POCOMPONENTS =
POCOMPONENTSX =
POSHIPPING =
POSHIPPINGX =
POSHIPPINGEXP =
endloop.
endform. " Int_process -
Getting Issue while uploading CSV file into internal table
Hi,
CSV file Data format as below
a b c d e f
2.01E14 29-Sep-08 13:44:19 2.01E14 SELL T+1
actual values of column A is 201000000000000
and columen D is 201000000035690
I am uploading above said CSV file into internal table using
the below coding:
TYPES: BEGIN OF TY_INTERN.
INCLUDE STRUCTURE KCDE_CELLS.
TYPES: END OF TY_INTERN.
CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'
EXPORTING
I_FILENAME = P_FILE
I_SEPARATOR = ','
TABLES
E_INTERN = T_INTERN
EXCEPTIONS
UPLOAD_CSV = 1
UPLOAD_FILETYPE = 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.
am getting all columns data into internal table,
getting problem is columan A & D. am getting values into internal table for both; 2.01E+14. How to get actual values without modifying the csv file format.
waiting for your reply...
thanks & regards,
abhiHi Saurabh,
Thanks for your reply.
even i can't double click on those columns.
b'se the program needs be executed in background there can lot of csv file in one folder. No manual interaction on those csv files.
regards,
abhi -
Uploading excel file into internal table
Hi,
Any function module is there to upload an excel file into internal table in CRM 7.0 system?
Thanks.Hi Ginger,
If u have access to ECC R/3 make use FM 'TEXT_CONVERT_XLS_TO_SAP' source code which is existing to convert to Excel to Internal table. It will work in CRM also.
As of Now I don't have access to SAP S/m. Mean while u can try as above said.
Regards,
Lokesh B -
Uploading CSV file into internal table
Hi,
I want to upload a CSV file into internal table.The flat file is having values as below:
'AAAAA','2003-10-11 07:52:37','167','Argentina',NULL,NULL,NULL,NULL,NULL,'MX1',NULL,NULL,'AAAA BBBB',NULL,NULL,NULL,'1',NULL,NULL,'AR ',NULL,NULL,NULL,'ARGENT','M1V','MX1',NULL,NULL,'F','F','F','F','F',NULL,'1',NULL,'MX','MMI ',NULL
'jklhg','2004-06-25 08:01:57','456','hjllajsdk','MANAGUA ',NULL,NULL,'265-5139','266-5136 al 38','MX1',NULL,NULL,'hjgkid GRÖBER','sdfsdf dfs asdfsdf 380 ad ased,','200 as ads, sfd sfd abajao y 50 m al sdf',NULL,'1',NULL,NULL,'NI ',NULL,NULL,NULL,'sdfdfg','M1V','dds',NULL,NULL,
Here I can not even split at ',' because some of the values are having value like NULL and some have values with comma too,
The delimiter is a quote and the separator is a comma here.
Can anyone help on this?
Thanks.
Edited by: Ginger on Jun 29, 2009 9:08 AMAs long as there can be a comma in a text literal you are right that the spilt command doesn't help. However there is one possibility how to attack this under one assumption:
- A comma outside a text delimiter is always considered a separator
- A comma inside a text delimiter is always considered a comma as part of the text
You have to read you file line by line and then travel along the line string character by character and setting a flag or counter for the text delimiters:
e.g.
"Text","Text1, Text2",NULL,NULL,"Text"
String Index 1: EQ " => lv_delimiter = 'X'
String Index 2: EQ T => text literal (because lv_delimiter = 'X')
String Index 3: EQ e => text literal (because lv_delimiter = 'X')
String Index 4: EQ x => text literal (because lv_delimiter = 'X')
String Index 5: EQ t => text literal (because lv_delimiter = 'X')
String Index 6: EQ " => lv_delimiter = ' ' (because it was 'X' before)
String Index 7: EQ , => This is a separator because lv_delimiter = ' '
String Index 8: EQ " => lv_delimiter = 'X' (because it was ' ' before)
String Index 9: EQ T => text literal (because lv_delimiter = 'X')
String Index 10: EQ e => text literal (because lv_delimiter = 'X')
String Index 11: EQ x => text literal (because lv_delimiter = 'X')
String Index 12: EQ t => text literal (because lv_delimiter = 'X')
String Index 13: EQ 1 => text literal (because lv_delimiter = 'X')
String Index 14: EQ , => text literal (because lv_delimiter = 'X')
String Index 15: EQ T => text literal (because lv_delimiter = 'X')
Whenever you hit a 'real' separator (lv_delimiter = ' ') you pass the value of the string before that up to the previous separator into the next structure field.
This is not an easy way to do it, but if you might have commas in your text literal and NULL values I gues it is probably the only way to go.
Hope that helps,
Michael -
How do I upload XML files into sap table?
Dear all,
I found some methods that upload xml into SAP,
but there doesnt work under 4.6c.
Can someone tell me how to upload XML files into
sap under 4.6c?
THX!hi,
You can convert XML to abap using transformations. Simple transformations is a proprietary SAP programming language that describes the transformation of ABAP data to XML (serialization) and from XML to ABAP data (deserialization).
goto SE80->workbench->edit object(or other objects)->in object selection chose more tab and then choose the transformation radio button and write a name and click create new.
Here you enter your transformation like
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl"
>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:transform>
You can use this transfomation in your program using call transformation. You can find more info on call transformation in help.
Hope this helps.
Regards,
Richa -
How to load a txt file into a table
Hi,
I have a txt file
3 sample records:
25 fff fff 2012-03-08 13:42:31.0 2012-03-15 14:58:31.0
26 ooo ooo null null
27 ooo ooo 2012-03-22 10:39:49.0 null
I have problems with the nulls:
my ctl is like that:
load data
append
into table table_name
fields terminated by '\t'
OPTIONALLY ENCLOSED BY '"' AND '"'
trailing nullcols
( ID CHAR(4000),
LITERAL CHAR(4000),
DESCRIPTION_WEB CHAR(4000),
FECHAALTA TIMESTAMP "YYYY-MM-DD HH24:MI:SS.FF1",
FECHAMODIFICACION TIMESTAMP "YYYY-MM-DD HH24:MI:SS.FF1"
I get the following error because of the null:
Record 2: Rejected - Error on table MKT_WEB, column FECHAALTA.
ORA-26041: DATETIME/INTERVAL datatype conversion error
The table in the database:
ID NUMBER(10,0)
LITERAL VARCHAR2(40 CHAR)
DESCRIPTION VARCHAR2(255 CHAR)
FECHAALTA TIMESTAMP(0)
FECHAMODIFICACION TIMESTAMP(0)
How can I say to the CTL about the nulls?
Thanks in advanceTry external table
-
How can upload doc file into database !!
Dear Everyone,
How can i upload a doc file into Mysql database ....
can any one please give ur suggestions...
i will show u my code
upload.jsp
<form name="uploader" action="uploaded.jsp"
enctype="multipart/form-data">
<div align="center">
<table id="table1" border="1" bordercolor="#ff0000"
cellpadding="0" cellspacing="0" width="50%">
<tbody bgcolor="#c8d8f8">
<tr>
<td bgcolor="#ccccff">
<p align="center">
Resume Upload! </p>
</td>
</tr>
<tr>
<td>
<p align="center">You can upload your
resume.. </p>
<p align="center">
<table align="center" border="1"
cellpadding="10" cellspacing="10">
<tbody>
<tr>
<td>
<p><input name="file" type="file">
<input name="uploadButton" value="Upload"
type="submit"></p>
</td>
</tr>
</tbody>
</table>
</p>
</td>
</tr>
</tbody>
</table>
</div>
</form>
uploaded.jsp
<BODY>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%
String file1=request.getParameter("file");
int len;
String query;
PreparedStatement pstmt;
int i=0;
Class.forName("com.mysql.jdbc.Driver");
DriverManager.getConnection("jdbc:mysql://localhost:3306 Connection conn= /employee","root","");
try {
File file = new File(file1);
if (file==null)
%>
<center>Nothing in It</center>
<%
else
FileInputStream fis = new FileInputStream(file);
len = (int)file.length();
query = ("insert into loader(resume) VALUES(?)");
pstmt = conn.prepareStatement(query);
pstmt.setString(1,file.getName());
pstmt.setInt(2, len);
//method to insert a stream of bytes
pstmt.setBinaryStream(3, fis, len);
i=pstmt.executeUpdate();
if(pstmt!=null)
pstmt.close();
if(conn!=null)
conn.close();
} catch (Exception e) {
e.printStackTrace();
if(i>0)
out.println("uploaded");
else
out.println("not uploaded")
%>
</BODY>File file = new File("myDoc.doc");
FileInputStream fis = new FileInputStream(file);The file name will most likely NOT be hard-coded. I don't think the question surrounding this topic is how to do the insert statement (he/she clearly knows SQL).
HTTP and the web browser take care of the file transfer, but the server stores the file in a temporary location. The question is, "How do I found out that location?" In PHP (I know that doesn't offer much help to you, but ...), that location is held in a variable called $_FILES. From there you can simply copy the file to a location you specify (probably with a user-specified name under a directory specifically for that user).
I hope this is of some help:
http://www.oop-reserch.com/mime_example_4.html
Good Luck,
C. R. -
Load text or txt file into a table when a button is clicked by the user
Can anyone please help me,
I have a form where a user comes and uploads a text file(Unicode UTF-8) and clicks a button(Upload) ,
when the button is clicked - it should load the text file data into the database table for the corresponding columns.
Note: in text file columns are sapreted by tab(\t)
& First row of text file contains column names.
& Table name should be that text file name
Can anyone please suggest me a possible solution or an approach.
Thanks,
Rathore
Edited by: Rathore on May 14, 2010 1:49 AMHi Legends and experts
please reply give me some solutions -
Uploading excel file into internal table with field length more than 255
I am trying to upload the data from an excel file through function module 'TEXT_CONVERT_XLS_TO_SAP'.
I have tested by changing the field type from string, and char2000.
But it is accepting only 255 chars from the cell content.
How to get the total content of the field if it is more than 255 char.hi,
you can use any of the following procedures:
For uploading data from excel to internal table refer standard report RC1TCG3Z in se38 :
or
You can use the FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' itself. Please check if you have done it this way . But, this FM can be a little time consuming if the excel has large data, so you can use the FM u2018GUI_UPLOADu2019.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file1
i_begin_col = l_b1
i_begin_row = l_c1
i_end_col = l_b2
i_end_row = l_c2
TABLES
intern = lt_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE e018 DISPLAY LIKE 'i'.
ENDIF.
*---Removing the first heading fields from the file.
IF NOT lt_data[] IS INITIAL.
LOOP AT lt_data INTO lwa_data WHERE row = '0001'.
DELETE lt_data.
CLEAR lwa_data.
ENDLOOP.
*---Inserting the data from file the internal table
LOOP AT lt_data INTO lwa_data.
CASE lwa_data-col.
WHEN 1.
wa_file_wicopa-serial = lwa_data-value.
WHEN 2.
wa_file_wicopa-blart = lwa_data-value.
WHEN 3.
wa_file_wicopa-bldat = lwa_data-value.
WHEN 4.
wa_file_wicopa-budat = lwa_data-value.
ENDCASE.
AT END OF row.
APPEND wa_file_wicopa TO gt_file_wicopa.
CLEAR wa_file_wicopa.
ENDAT.
CLEAR lwa_data.
ENDLOOP.
ENDIF.
ENDIF.
or
DATA: it_test TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE.
DATA :v_start_col TYPE i VALUE '1',
v_start_row TYPE i VALUE '1',
v_end_col TYPE i VALUE '256',
v_end_row TYPE i VALUE '65536',
v_text TYPE repti.
* Funtion Module to upload values from excel to the Internal table
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = v_start_col
i_begin_row = v_start_row
i_end_col = v_end_col
i_end_row = v_end_row
TABLES
intern = it_test
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 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.
Or
You can use FM u201CTEXT_CONVERT_XLS_TO_SAPu201D.
DATA : i_raw TYPE truxs_t_text_data.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_tab_raw_data = i_raw
i_filename = p_path
TABLES
i_tab_converted_data = itab
EXCEPTIONS
conversion_failed = 1
OTHERS = 2
hope it will help u
regards
rahul
Maybe you are looking for
-
The problem is that you don't know what the target view is until it has been forwarded to. Think about it... the request handling view bean (or command object) has the request handler that has the code that will ultimately forward to another view bea
-
Business Content Activation of business partner
Hi, I am activating standard business partner from business content.The business partner we have right now is of version 3.3/01 and has lot of custom fields. When I am activating the version 3.5/03 I want to make sure I don't lose those custom attrib
-
Isight problem stopped working
Macbook Pro from 2008 the iSight camera stopped working suddenly. any tips?
-
Since i updated 6.1.3 phone is not connecting to wifi?? Help
since i updated 6.1.3 phone is not connecting to wifi?? Help
-
Dear All, I need some guidance on Java version compatibility and configuration with Solaris 10. We are having SunOS 5.10 Generic_144488-17, but in the DSEE installation we have used JES 5 which have built in problems, which actually de graded system