Tuesday, January 24, 2012

REP-0492: Unrecognized token

REP-0492: Unrecognized token



Yesterday I was trying to build a report in Oracle Dev6i. I have build the query in Toad9.5.0.31, I have executed query several times in Toad and it runs fine but when I paste same query in report builder and click 'OK' button it shows error ( REP-0492: Unrecognized token: ' '. ).

unrecognized token
REP-0492: Unrecognized token


unrecognized token
REP-0492: Unrecognized token
I have tried everything possible to get rid of this error but I was so disappointed that time. This type of error occurs when query is containing syntax errors, but in my case my query was working fine in toad but not in Oracle Report Builder.
Instead of prolong my sad story lets discuss the solution. If I compare my error  ( REP-0492: Unrecognized token: ' '. )  with its description ( REP-0492: Unrecognized token: '<token name>'. ) then I can easily figure out that there is some extra spaces in my query as my error was illustrating by replacing  '<token name>' with ' ', where token name is just one space shows in single quotes.
So I deleted all extra spaces from my query and report builder accepted my query.
I am surprised why report builder was not accepting my query though I have built so many reports with the queries having so many spaces. This is still an answered question for me.
May be this was due to some 'tabs' in my query but this is just my hypothesis I am not sure about the exact reason of the error but I am sure about the solution "Just remove all spaces and error will be vanished" :).
All the best.

Error Description :

 
REP-0492: Unrecognized token: '<token name>'.
Cause: The SELECT statement that you entered contains an item that is not part of SQL syntax.
Action: Review your SELECT statement and ensure that it follows SQL syntax.

Extra spaces illustrated in red color which I have deleted.


SELECT rc.CUSTOMER_ID,
       rc.customer_name,
       hcpa.overall_credit_limit       
  FROM ra_customers rc,       
       ra_site_uses_all rsu,       
       ra_addresses_all raa,       
       hz_cust_profile_amts hcpa       
 WHERE raa.customer_id = rc.customer_id       
   AND rsu.address_id = raa.address_id       
   AND hcpa.site_use_id = rsu.site_use_id       
   AND rsu.primary_flag = 'Y'       
   AND rsu.status = 'A'       
   AND rsu.site_use_code = 'BILL_TO'   
   AND rsu.org_id = 111   
   AND rc.customer_id in(3211,3222,3233,3244)



Your feedback/comment is quite important for improving this blog so feel free to leave your comments & suggestions



Thursday, January 12, 2012

DDL DML DCL and TCL

DDL DML DCL and TCL



In this post we will learn the basics of DDL, DML, DCL and TCL statements.

DDL(Data Definition Language )


statements are used to define the database structure or schema. Such as:

CREATE - to create objects in the database
ALTER - alters the structure of the database
DROP - delete objects from the database
TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed
COMMENT - add comments to the data dictionary
RENAME - rename an object

 

DML(Data Manipulation Language)

statements are used for managing data within schema objects. Such as:

SELECT - retrieve data from the a database
INSERT - insert data into a table
UPDATE - updates existing data within a table
DELETE - deletes all records from a table, the space for the records remain
MERGE - UPSERT operation (insert or update)
CALL - call a PL/SQL or Java subprogram
EXPLAIN PLAN - explain access path to data
LOCK TABLE - control concurrency

DCL(Data Control Language)

       
GRANT - gives user's access privileges to database
REVOKE - withdraw access privileges given with the GRANT command

TCL(Transaction Control)


statements are used to manage the changes made by DML statements. It allows statements to be grouped together into logical transactions.

COMMIT - save work done
SAVEPOINT - identify a point in a transaction to which you can later roll back
ROLLBACK - restore database to original since the last COMMIT
SET TRANSACTION - Change transaction options like isolation level and what rollback segment to use

Your feedback/comment is quite important for improving this blog so feel free to leave your comments & suggestions

Ref: http://www.orafaq.com/faq/what_are_the_difference_between_ddl_dml_and_dcl_commands