oracle - SQL - Literal does not match format string -


i apologize if question has been asked in advance. i've been looking around answer this, , of answers error message seem involve date fields. however, there no date field in following:

create table tablename (    trans_dest_name varchar2(50) not null,    mmddyyyy        varchar2(8)  not null,  constraint holiday_key primary key (trans_dest_name, mmddyyyy),  constraint trans_dest_name_ch check(regexp_like(trans_dest_name,'^[a-za-z0-9 ]{0,50}$')),  constraint holiday_format check (     (to_number(substr(mmddyyyy, 0, 2))) < 13     , (to_number(substr(mmddyyyy, 0, 2))) > 0     , (to_number(substr(mmddyyyy, 2, 2))) < 32     , (to_number(substr(mmddyyyy, 2, 2))) > 0     , (to_number(substr(mmddyyyy, 4, 2))) = 20) );  insert tablename values ('power pass', '01012015'); 

fyi, problem coworker came me with. i'm not sure why they're using string represent date, format they've decided go with. problem is...it seems if "power pass" value in insert throwing particular error...not date string.

sql> sql>  insert tablename values ('power pass', '01012015')                                             * error @ line 1: ora-01861: literal not match format string 

my original thought was date string causing problem, perhaps in attempt convert number in constraints. doesn't seem way, new error message occurs when had said coworker try inserting date string number.

sql> sql> insert tablename values ('power pass', 01012015) * error @ line 1: ora-00932: inconsistent datatypes: expected date got number 

so part strange. why expecting date in field? i'm boggled entirely problem. appreciated. thanks!

except wrong indexing pointed out maheswaran ravisankar code posted not throw error. iow: error see must come didn't post. here things may try:

  • check original code. assume mildly edited , table wasn't called "tablename". maybe error slipped in. possibly not inserting table, one.
  • lookup user_dependencies in real db , verify nothing, ex (i.e. no trigger etc.) depends on table. or use tool toad examine table.
  • lookup user_constraints verify there no constraints didn't show , require date conversion.
  • drop table , insert again. should ora-00942: table or view not exist otherwise see 1st bullet.

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -