473,385 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ORA-01830: date format picture ends before converting entire input string

14
when i write a query and execute the query it gives error.

My Query
Expand|Select|Wrap|Line Numbers
  1. SELECT NI.POLICY_HOLDER_SALUTATION ||''||PD.DRAWER_NAME AS DRAWER_NAME,
  2. PD.ADDRESS_LINE_1 || NVL2(PD.ADDRESS_LINE_1,',','') || PD.ADDRESS_LINE_2 || NVL2(PD.ADDRESS_LINE_2,',','') || PD.ADDRESS_LINE_3 || NVL2(PD.ADDRESS_LINE_3,',','') || PD.CITY || NVL2(PD.CITY,',','') || PD.PINCODE || NVL2(PD.PINCODE,',','') || CHR(10) || PD.STATE AS DRAWER_ADDRESS,
  3. PD.DRAWER_CONTACT_NO AS DRAWER_CONTACT_NO,
  4. TO_CHAR(PD.LOGIN_DATE,'DD-Mon-YYYY') AS LOGIN_DATE ,
  5. NVL((CASE WHEN PAYMENT_MODE IN ('Cheque','Demand Draft') THEN TO_CHAR(PD.INSTRUMENT_DATE,'DD-Mon-YYYY')
  6.      WHEN PAYMENT_MODE IN ('Cash','OTC Yes Bank') THEN ''
  7.      ELSE TO_CHAR(PD.LOGIN_DATE,'DD-Mon-YYYY') END),' ') AS INSTRUMENT_DATE ,
  8. PD.USER_BRANCH_NAME,
  9. PD.RECEIPT_NUMBER,
  10. TO_CHAR(PD.AMOUNT,'999999999.99') AS AMOUNT ,
  11. NVL(PD.POLICY_STATUS,' ') POLICY_STATUS,
  12. NVL((CASE WHEN PD.PAYMENT_MODE IN ('Cash','OTC Yes Bank') THEN NULL ELSE PD.INSTRUMENT_NUMBER END),' ') AS INSTRUMENT_NUMBER,
  13. NVL(PD.DRAWER_BANK,' ') AS DRAWER_BANK ,
  14. PD.CONTRACT_NUMBER,
  15. NVL(PD.EMAIL_ID,' ') EMAIL_ID,
  16. NVL(PD.PLAN_NAME,' ') PLAN_NAME,
  17. NVL(PD.PREMIUM_FREQUENCY,' ') PREMIUM_FREQUENCY,
  18. TO_CHAR(PD.INSTRUMENT_DATE,'DD-Mon-YYYY'),
  19. PD.CHEQUE_RECEIVE_DATE, TRIM(f_words(PD.AMOUNT)) AS AMOUNT_WORDS_OLD ,
  20. UPPER((TO_CHAR (TO_DATE (PD.AMOUNT, 'j'), 'jsp') )) AS AMOUNT_WORDS FROM PAYMENT_DETAILS PD, NEWBUSS.NB_INWARD NI 
error while executing

ORA-01830: date format picture ends before converting entire input string

highlighted part gives error.

reply soon.
thanks in advance.
Jul 6 '13 #1
6 9452
Luuk
1,047 Expert 1GB
Expand|Select|Wrap|Line Numbers
  1. SQL> select to_date(1,'j') from dual;
  2.  
  3. TO_DATE(
  4. --------
  5. 01-01-12
  6.  
  7. SQL> select to_date(1.3,'j') from dual;
  8. select to_date(1.3,'j') from dual
  9.                *
  10. FOUT in regel 1:
  11. .ORA-01830: ......
There should be NO decimals in PD.AMOUNT....
Jul 6 '13 #2
santhu1
14
Hi Luuk,

Thank you. it's working fine.
Jul 6 '13 #3
santhu1
14
Hi Luuk,

if there is decimals in that PD.AMOUNT how we need to write this.
Jul 6 '13 #4
santhu1
14
Hi Luuk,

can u help me in this
Expand|Select|Wrap|Line Numbers
  1. SELECT    TO_CHAR (TO_DATE (TRUNC (PD.AMOUNT), 'J'), 'JSP')
  2.        || ' Point '
  3.        || TO_CHAR (TO_DATE (TO_NUMBER (SUBSTR (PD.AMOUNT , INSTR (PD.AMOUNT, '.') + 1)),'J'),'JSP')
  4.   FROM PAYMENT_DETAILS PD ; 

when i excute this for decimal values, it gives the result for every value in the amount field. i want the result for only decimal values. if non decimal values it print as it is.
Jul 7 '13 #5
Luuk
1,047 Expert 1GB
you could use: CASE WHEN .... THEN ..... END:
Expand|Select|Wrap|Line Numbers
  1. SELECT    TO_CHAR (TO_DATE (TRUNC (PD.AMOUNT), 'J'), 'JSP')
  2.        || ' Point '
  3.        || CASE WHEN PD.AMOUNT<>TRUNC(PD.AMOUNT) THEN
  4.        TO_CHAR (TO_DATE (TO_NUMBER (SUBSTR (PD.AMOUNT , INSTR(PD.AMOUNT, '.') + 1)),'J'),'JSP')  END
  5.   FROM PAYMENT_DETAILS PD ; 
Jul 7 '13 #6
santhu1
14
Hi Luuk,

Finally, I got exact OutPut

Expand|Select|Wrap|Line Numbers
  1.   TO_CHAR (TO_DATE (TRUNC (PD.AMOUNT), 'J'), 'JSP') 
  2.           || CASE WHEN PD.AMOUNT<>TRUNC(PD.AMOUNT) THEN
  3.     ' Rupees '||    TO_CHAR (TO_DATE (TO_NUMBER (SUBSTR (PD.AMOUNT , INSTR(PD.AMOUNT, '.') + 1)),'J'),'JSP') || ' Paise' else ' Rupees Only'  END

Thanks for ur support.
Jul 8 '13 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Alistair | last post by:
it's the idiot with his query strings again...."yippeee" I hear aaron shout this time the problem is with a date format query I have a query string thus strSQL = "SELECT * FROM users where...
3
by: Stefan van Roosmalen | last post by:
Hi there, I have developed several applications in Delphi. I used Paradox for my data storage. Now, I want to convert these databases to MySql. So that why I am looking for a way to convert the...
15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
2
by: Jim | last post by:
im using asp.net, C# to enter data into a table in sql server...however im getting this error: Input string was not in a correct format. Description: An unhandled exception occurred during the...
0
by: Wayne Aprato | last post by:
My computer is using the dd/mm/yyyy date format. Is there a simple input mask for a date field that will accept just the month and year eg. 08/04 and maybe default the day to 01? I presume that...
2
by: Brian Candy | last post by:
I am guessing that this must be a common question, but I just can't find a simple solution for it by searching the newsgroups. I have a Text Box with a date in a UK format. The format has been...
5
by: blackg | last post by:
Input string not in correct format -------------------------------------------------------------------------------- I am trying to view a picture from a table. I am getting this error Input string...
1
by: amitbadgi | last post by:
I am gettign this error, while migration an app to asp.net Exception Details: System.FormatException: Input string was not in a correct format. Source Error: Line 19: Dim enddate =...
5
by: rohdej | last post by:
Hello - I have been all over the web and found a few posts that are somewhat related to what I'm trying to do, but none that provided me a concise answer. I want to prompt the user to input the...
9
chandru8
by: chandru8 | last post by:
hi to all iam using vb6.0 can any one correct me the query which below mentioned is correct strSql = "Insert into table1 values (#" & Date & "# ,'2')" Set rs = objCon.Execute(strSql) or
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.