Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have written a SQL Query in Oracle that has 529 lines.

Is this query not too long to be sucessfuly executed?

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
441 views
Welcome To Ask or Share your Answers For Others

1 Answer

The Oracle Documentation of the Database Limits does not specifiy an exact limit for the length of a SQL query. (Note that the number of lines is not revelant, but the total length of the query string.

There is only this Note there

The limit on how long a SQL statement can be depends on many factors, including database configuration, disk space, and memory

You can be sure there is no such 4000 character (as for VARCHAR2) limit there and 500+ line query is not unusual.

You will have a hard work to write a query that cross the length limit.

More "realistic" is that you cross some other limitation such as the 255 subqueries in the WHERE clause.

Check the link provided above for Oracle 19 for the full list of the limitations.

So far more important to check the propper length od the query is this test:

review the query after 14 days and if it is well readable and understandable - it has a right length!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...