The program cannot identify the "FROM" key word from a SELECT sql statement. For example when StringBuilder is used to construct the sql and a space is missing between the word FROM and the word before or after it, the "ORA-00923: FROM keyword not found where expected" exception will be thrown.
sqlBuilder.append("FROM fruit ");
sqlBuilder.append("WHERE name in ('APPLE', 'PEACH'));
The space is missing between the "type" and the "FROM".
sqlBuilder.append("FORM fruit ");
sqlBuilder.append("WHERE name in ('APPLE', 'PEACH'));
The "FROM" is written as "FORM".
sqlBuilder.append(" fruit ");
sqlBuilder.append("WHERE name in ('APPLE', 'PEACH'));
sqlBuilder.append(" fruit ");
sqlBuilder.append("WHERE name in ('APPLE', 'PEACH'));
The extra parenthesis before price makes the "FROM" key word unable to be identified.
-----------------------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Order Here
1. A space is missing between the word FROM and the word before or after it
StringBuilder sqlBuilder = new StringBuilder("SELECT name, type");sqlBuilder.append("FROM fruit ");
sqlBuilder.append("WHERE name in ('APPLE', 'PEACH'));
The space is missing between the "type" and the "FROM".
2. Mis-spelling the word FROM
StringBuilder sqlBuilder = new StringBuilder("SELECT name, type ");sqlBuilder.append("FORM fruit ");
sqlBuilder.append("WHERE name in ('APPLE', 'PEACH'));
The "FROM" is written as "FORM".
3. The word "FROM" is missing
StringBuilder sqlBuilder = new StringBuilder("SELECT name, type ");sqlBuilder.append(" fruit ");
sqlBuilder.append("WHERE name in ('APPLE', 'PEACH'));
4. The word "FROM" is placed in the wrong place
StringBuilder sqlBuilder = new StringBuilder("SELECT name, type, ((price-cost) as profit ");sqlBuilder.append(" fruit ");
sqlBuilder.append("WHERE name in ('APPLE', 'PEACH'));
The extra parenthesis before price makes the "FROM" key word unable to be identified.
-----------------------------------------------------------------------------------------------------------------
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Order Here
Thanks for very interesting post. I have a high regard for the valuable information you offer in your articles. I really believe you will do much better in the future.
ReplyDeletePIC Scheme Singapore
Thank you Leona! I will be very happy if anyone can benefit from my posts.
ReplyDelete