"insert into invoice(sno,entrydate,invoicedate,companyname,party,station,purchase,avail,sale) " + values("+Integer.getInteger(head.getSerial().getText())+",to_date('"+head.getEntryDate().getText()+ "','dd/mm/yyyy')"+",to_date('"+head.getInvoicedate().getText()+ "','dd/mm/yyyy')"+",'"+head.getCompany().getSelectedItem()+"'"+"'"+head.getParty().getSelectedItem()+"','"+head.getStation().getSelectedItem()+"',"+Integer.getInteger(head.getPurchase().getText())+",1,"+Integer.getInteger(head.getSale().getText())+")");

SNO NOT NULL NUMBER(38)
ENTRYDATE DATE
INVOICEDATE DATE
COMPANYNAME VARCHAR2(50)
PARTY VARCHAR2(50)
STATION VARCHAR2(50)
PURCHASE NUMBER(10,2)
AVAIL NUMBER(1)
SALE NUMBER(10,2)

Whats wrong in this query.... I am getting sqlException ....

to_date(...) is some formula, or void or class or something in Java that returns java.xxx.Date or java.xxx.timestamp ???

you are mixing syntax valid for Sql Engine with Java, there must be Java code with by usage of Java API

It solved dear.... Well its to_date for oracle date function not for java.... Thanx for trying.

Member Avatar for hfx642

Also... Your quotes are out of sync.

Yes they are... happened during pasting.....

@Majestics you better start using PreparedStatement. Direct sql string like above is just like shooting your self in leg once trying to sort all single and double quotes locations.

PS: Marking thread as solved would be appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.