aspose file tools
The moose likes JDBC and the fly likes PL / SQL Error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "PL / SQL Error" Watch "PL / SQL Error" New topic
Author

PL / SQL Error

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

Guys,

I'm trying the following script on 11g Oracle to drop a table if exists:




SCJP 1.4, SCWCD 1.4 - Hints for you, SCBCD Hints - Demnachst, SCDJWS - Auch Demnachst
Did a rm -R / to find out that I lost my entire Linux installation!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

So what error are you getting? TellTheDetails!


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

I have mentioned the error in my code above. Anyways, I got rid of that error. Now facing another one and I really see no reason as to why this should happen.

Here is my procedure:



When I try to execute the above procedure, I get the following error



Where Line 77 is the EXECUTE IMMEDIATE logStr;

Any pointers?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

"Missing Right Paranthesis" is pretty clear, I think (even though it's misspelled -- not very professional on the part of the database maker). And if you took that string starting with "CREATE TABLE" and assigned it to a variable of length 256, then it would be truncated and hence there would be a missing right parenthesis.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

Fixed the above problem as well. It was perhaps due to the wrong data type for the id. It should be number instead of an int.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

Paul Clapham wrote:"Missing Right Paranthesis" is pretty clear, I think (even though it's misspelled -- not very professional on the part of the database maker). And if you took that string starting with "CREATE TABLE" and assigned it to a variable of length 256, then it would be truncated and hence there would be a missing right parenthesis.


Forgive the database maker. The spelling mistake was from me. Actually the error message was in German and I misspelled Parantheses.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

And thanks for pointing out the error.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19232

Joe Harry wrote:I have mentioned the error in my code above.

Sorry, I missed it. People don't expect error messages inside code blocks.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

Rob Spoor wrote:
Joe Harry wrote:I have mentioned the error in my code above.

Sorry, I missed it. People don't expect error messages inside code blocks.


No problem. I'm happy that I could resolve it. Good to learn it by doing.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 8795

Paul Clapham wrote:"Missing Right Paranthesis" is pretty clear, I think (even though it's misspelled -- not very professional on the part of the database maker). And if you took that string starting with "CREATE TABLE" and assigned it to a variable of length 256, then it would be truncated and hence there would be a missing right parenthesis.


Guess I might need help again. I modified the script and to look like as below:


Facing the problem with the missing right parantheses. I'm sure that all my logStr's are well within the range.
Martin Vajsar
Bartender

Joined: Aug 22, 2010
Posts: 2384
    
    3

I took the statement you're executing using execute immediate, reformatted it and run it in Sql plus. The error was indicated on the line containing DEFAULT SYSDATE. It seems that in Oracle the DEFAULT clause must precede any constraints defined on a column, and NOT NULL is a constraint. Change the declaration to TIMESTAMP DEFAULT SYSDATE NOT NULL.

Admittedly, the error message is rather cryptic. But taking the command out of the PL/SQL code and executing it separately helps resolving the issue.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: PL / SQL Error
 
Similar Threads
Oracle PL / SQL Drop Table Exception Handling
Servlets and JSP
Layout Problem
Drop All Constraints?
IE, javascript, moving to anchors, and setting focus