Link to home
Start Free TrialLog in
Avatar of sbyreddy
sbyreddy

asked on

ORA-00972: identifier is too long

Hi EveryOne,
when i try to execute the below code it says,
ORA-00972: identifier is too long
at the lineadapter1.Fill(Ora_Dataset)

CODE:
Sub BindGrid()
sSql=Select * from Audit_Exceptions where Audit_ID=+ sauditid + and TO_CHAR(Audit_Date,MM/DD/YYYY)= +sauditdate + and Exception_Status=+ exceptionStatus+

adapter1=New OracleDataAdapter(sSql,Ora_Conn)
adapter1.Fill(Ora_DataSet )
grid.DataSource=Ora_DataSet
grid.DataBind()
EndSub

I checked the name of the table and Columns , but all are less than 30 characters
When i selected the values in dropdownlist and click a button(which is that page below the dropdownlists) it shows me this error!

where auditdate has a DATE datatype
Auditid has Number datatype
Exceptionstatus has varchar datatype

When i keep break points on this code and whenevr the SQL stmt shows values in watch window i just copied the statement and executed in SQL Plus
it gave me the result rows.
I tried every possibility,by creating a new table again and changing the column names.But still it didn't wrk!!!
Avatar of Naveen Kumar
Naveen Kumar
Flag of India image

is the value whatever coming in this "sauditdate " is in the format 'MM/DD/YYYY'

i think your sql should be in the form :
'Select * from Audit_Exceptions where Audit_ID=' + sauditid + 'and TO_CHAR(Audit_Date,''MM/DD/YYYY'')= ' +sauditdate + '  and Exception_Status= '+ exceptionStatus

but the one you have pasted shows some non printable characters/control characters, hope they are not causing the issue.
if this is what you have:
sSql='Select * from Audit_Exceptions where Audit_ID=''+ sauditid +'' and TO_CHAR(Audit_Date,'MM/DD/YYYY')= ''+sauditdate +'' and Exception_Status=''+ exceptionStatus+'''

you will need some quotes to be added/removed:

sSql='Select * from Audit_Exceptions where Audit_ID='+ sauditid +' and TO_CHAR(Audit_Date,'MM/DD/YYYY')= '''+sauditdate +''' and Exception_Status= '''+ exceptionStatus+''' '
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial