Archive

Archive for the ‘How to’ Category

Oracle SQL*Loader

April 14, 2011 Leave a comment

SQL*Loader is a bulk loader utility used for moving data from external files into the Oracle Database and it comes with planty of formating and loading options.

You can use SQL*Loader by executing the sqlldr  utility (sqlload on some platforms).

The format required is :

sqlldr username@server/password control=loader.ctl

Invoking sqlldr without any parameters displays a short help screen.

The loader.ctl is a control file that must be created before starting sqlldr.

Here is a sample loader.ctl file

OPTIONS (SKIP=1)
load data
infile ‘mydata.csv’
TRUNCATE INTO table MY_DATA
fields terminated by ‘;’ optionally enclosed by ‘”‘
TRAILING NULLCOLS
(dummy1 FILLER,
PLDAMRN “trim(:PLDAMRN)”,
ARTIKEL “trim(:ARTIKEL)”,
dummy2 FILLER,
KANTOOR “trim(:KANTOOR)”,
NCTSKANTOOR “trim(:NCTSKANTOOR)”,
BRUTO “replace(:BRUTO,’,’,’.’)”,
NETTO “replace(:NETTO,’,’,’.’)”,
COLLI,
TYPE “trim(:TYPE)”,
NCTSMRN “trim(:NCTSMRN)”,
NCTSLOCATIE “trim(:NCTSLOCATIE)”,
NAAM “trim(:NAAM)”,
POST “trim(:POST)”,
STAD “trim(:STAD)”,
CONTACT “trim(:CONTACT)”,
SID “AUT_CO_SID_SEQ.NEXTVAL”)

The loader will load the comma-separated values file mydata.csv into table MY_DATA.

The comma-separated values file can be created using Excel.

In the example the table MY_DATA will first be truncated and then loaded with the new data.

If you are interested in learning more on SQL*Loader, here is Oracles’s online documentation http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/part_ldr.htm

Oracle SQL*Loader: The Definitive Guide is also a highly recommended book.

Advertisements
Categories: How to

Extract HTML table’s data in a new window

March 13, 2011 Leave a comment

The question:

How could I extract the data that already rendered as a HTML Table in my web site, as a new Table that will be easily copied-pasted in an Excel spreadsheet?
The answer:

In case that our Table element has ‘data’ as id then we could use the following javascript function:

function showDataInNewWindow(){

try{

var tmp = ‘<table border=”1″><thead><tr>’;

$(“#data th”).each(function () { // iterate tr

tmp= tmp+'<th>’+$(this).text()+'</th>’;

});

tmp=tmp+'</tr></thead><tbody>’;

$(‘#data tr’).each(function () { // iterate tr

tmp = tmp+’ <tr>’;

$(this).find(‘td’).each(function () { // iterate td

tmp =tmp+ ‘<td>’+$(this).text()+'</td>’;

});

tmp=tmp+'</tr>’;

});

tmp=tmp+'</tbody></table>’

myWindow=window.open(”,’Data’,’width=800,height=600,left=0,top=0′);

myWindow.document.write(tmp);

myWindow.document.close();

myWindow.focus();

}catch(e){

alert(e);

}

}

Notes:
1) jQuery library has been used
2) For more information leave a comment and I will reply as soon as possible!
Categories: How to

How to fine tune your CSS Corners!

March 8, 2011 Leave a comment

Every web developer would like to create fancy sites, but you usually do not know how to do web design staff! One of the most requested effect is that of the rounded corners and the usage of gradient color for the background. A tool to easily do so is http://csscorners.com/.

Categories: How to