Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Missing Expression

3303426Feb 1 2017 — edited Feb 5 2017

I have used the following two queries and I am getting expression : java.sql.SQLSyntaxErrorException: ORA-00936: missing expression

plz help

PreparedStatement  st1 = conn1.prepareStatement("select head.leave_type_id,"

             + " (select leave_name from admin_leave where leave_type_id=head.leave_type_id ) as leaveName,"

  + " nvl(to_char(head.start_date,'dd/mm/yy'),'-') as startDate,"

             + " nvl(to_char(head.end_date,'dd/mm/yy'),'-') as endDate, "

  + " from admin_emp_leave_header head "

  + " where head.payroll_id = '"+payrollId+"'"

  + " and head.delete_flag=1  order by head.start_date");

PreparedStatement  st = conn.prepareStatement("select"

                    + " convert(varchar(10),attdate,3) as attdt1  ,"

                  + " (select 'leavestatus' as leavestatus from dual),"

                    + " isnull(shiftrp,':'),"

                    + " isnull(convert(varchar(5),intime1,108),':') as intm ,"

                    + " case when outdate4 is null then case when outdate3 is null then case when outdate2 is null then case when outdate1 is null then ':' else convert(varchar(5),outtime1,108) end else convert(varchar(5),outtime2,108) end else convert(varchar(5),outtime3,108) end else convert(varchar(5),outtime4,108) end  as out,"

                    + " isnull(convert(varchar(5),late,108),':') as late1,"

                    + " isnull(convert(varchar(5),early,108),':') as early1,"

                    + " isnull(tour,':'),"

                    + " isnull(odstatus,':'),"

                    + " isnull(case when offtype='NR' then case when exdate is null then offtype else null end else case when offtype='EX' then offtype else null end end,':')  as woff,"

                    + " isnull(holiday,':'), "

                    + " isnull(convert(varchar(5),workhour,108),':') as wrkhr,"

                    + " isnull(convert(varchar(5),extrawork,108),':') as etw"

                    + " from "+currMonth+" m,"+currYear+" e where e.empid=m.empid collate Latin1_General_CI_AI and e.location=m.location collate Latin1_General_CI_AI and m.empid = ? and attdate <= getdate() order by attdate");

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 5 2017
Added on Feb 1 2017
3 comments
4,063 views