can TOAD tell me the number of lines of code in a database including stored procedures, tiggers, packages, tables, etc.?
Not that I can think of offhand, but that’s pretty easy to do in a query:
select count(*)
from dba_source
where owner in …
Another way would be to use toad’s code analysis (batch mode, not in editor) to get line counts for all code objects for an entire schema - then just sum that column. The reason I think this method may be superior is that CA counts statements and not just lines from multi line statements nor comments.
Will this query tell me the number of “lines of code” or the record count in a table?
select count(*)
from dba_source
where owner in …
I want the count of lines of code in a database including stored procedures, tiggers, packages, tables, etc.?
Dave McMullin
425-462-3480
81-3480
From: John Dorlon [mailto:bounce-jdorlon@toadworld.com]
Sent: Monday, May 19, 2014 11:13 AM
Subject: RE: [Toad for Oracle - Discussion Forum] lines of code count
Reply by John Dorlon
Not that I can think of offhand, but that’s pretty easy to do in a query:
select count(*)
from dba_source
where owner in …
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from Toad for Oracle - General notifications altogether.
Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.
“lines of code”, if you define a “line” as a line feed, not a complete statement.
If you want record count you can either look at dba_tables, in the NUM_ROWS column (which is very fast, but only accurate if your statistics are up to date, and even so, the numbers aren’t exact, but close). These values are shown in the Schema browser as soon as it opens (you’ll see a “NUM ROWS” column on the right hand side.
If you want an exact row count of a table, you need to query like this: select count(*) from table_name. You can right-click on one or more tables in the Schema Browser to get row count, and Toad will generate a query for you do run it against multiple tables at once.
Here’s how I did this using code analysis - which once again is more accurate than just the line count from selecting from dba_source_code. Main Menu -> Diagnose -> Code Analysis. Then load objects icon to bring up pop-window to select code objects - select all triggers, procedure, packages, functions. Now run it - look at 6th column, reports # actual statements (no comments, no multi-line issues). Now if there are too many rows to add up in your head, then simply do an export data set (save as) to excel and sum the column. This # will be far mor accurate than simple dba_source value.
In my case select count(*) from dba_source gave 251 rows - meaning 251 lines of code in packages, procedures, functions and triggers. But code analysis reports 66 lines - which is the correct # of actual lines of code. Code Analysis skips comments and counts statements rather than lines - where a multi-line statement is counted for each line feed. So CA is far more useful …
I want to count the lines of code.
Example: Package, ACCESS_REPORTS
In the Editor there are 12,000 plus lines.
In the Code Analysis there are 14.
I want to be able to count the 12,000 plus lines.
Dave McMullin
425-462-3480
81-3480
From: Bert Scalzo [mailto:bounce-Bert_Scalzo@toadworld.com]
Sent: Monday, May 19, 2014 12:02 PM
Subject: RE: [Toad for Oracle - Discussion Forum] lines of code count
Reply by Bert Scalzo
Here’s how I did this using code analysis - which once again is more accurate than just the line count from selecting from dba_source_code. Main Menu -> Diagnose -> Code Analysis. Then load
objects icon to bring up pop-window to select code objects - select all triggers, procedure, packages, functions. Now run it - look at 6th column, reports # actual statements (no comments, no multi-line issues). Now if there are too many rows to add up in
your head, then simply do an export data set (save as) to excel and sum the column. This # will be far mor accurate than simple dba_source value.
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from Toad for Oracle - General notifications altogether.
Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.
If all you want is lien count like in editor - then as John suggested:
select count(*) from dba_source
where owner=‘CSY’
and name = ‘ACCESS_REPORTS’
and type in (‘PROCEDURE’, ‘FUNCTION’, ‘PACKAGE’, ‘PACKAGE BODY’, ‘TRIGGER’)
Your Editor screenshot is of a package body whereas your Code Analysis screenshot is for the spec. Be sure to run Code Analysis on the package body.
On 05/19/2014 03:50 PM, dave.mcmullin wrote:
Reply by dave.mcmullin
I want to count the lines of code.
Example: Package, ACCESS_REPORTS
In the Editor there are 12,000 plus lines.
In the Code Analysis there are 14.
I want to be able to count the 12,000 plus lines.
Dave McMullin
425-462-3480
81-3480
From: Bert Scalzo [mailto:bounce-Bert_Scalzo@toadworld.com]
Sent: Monday, May 19, 2014 12:02 PM
Subject: RE: [Toad for Oracle - Discussion Forum] lines of code count
Reply by Bert Scalzo
Here's how I did this using code analysis - which once again is more accurate than just the line count from selecting from dba_source_code. Main Menu -> Diagnose -> Code Analysis. Then load
objects icon to bring up pop-window to select code objects - select all triggers, procedure, packages, functions. Now run it - look at 6th column, reports # actual statements (no comments, no multi-line issues). Now if there are too many rows to add up in
your head, then simply do an export data set (save as) to excel and sum the column. This # will be far mor accurate than simple dba_source value.
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from Toad for Oracle - General notifications altogether.Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from Toad for Oracle - General notifications altogether.Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.
Thank you very much.
I wouldn’t mind just the statement count and not comment lines of blank lines, but the Code Analysis is only showing 14 instead of thousands.
What is the Code Analysis counting with a count of only 14 as opposed to thousands of lines of code?
Dave McMullin
425-462-3480
81-3480
From: Bert Scalzo [mailto:bounce-Bert_Scalzo@toadworld.com]
Sent: Monday, May 19, 2014 1:04 PM
Subject: RE: [Toad for Oracle - Discussion Forum] lines of code count
Reply by Bert Scalzo
If all you want is lien count like in editor - then as John suggested:
select count(*) from dba_source
where owner=‘CSY’
and name = ‘ACCESS_REPORTS’
and type in (‘PROCEDURE’, ‘FUNCTION’, ‘PACKAGE’, ‘PACKAGE BODY’, ‘TRIGGER’)
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from Toad for Oracle - General notifications altogether.
Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.
Looks like a bug - it’s been reported now and will be reviewed in 12.next dev cycle …
Thank you for your help.
Dave McMullin
425-462-3480
81-3480
From: Bert Scalzo [mailto:bounce-Bert_Scalzo@toadworld.com]
Sent: Monday, May 19, 2014 1:37 PM
Subject: RE: [Toad for Oracle - Discussion Forum] lines of code count
Reply by Bert Scalzo
Looks like a bug - it’s been reported now and will be reviewed in 12.next dev cycle …
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from Toad for Oracle - General notifications altogether.
Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.
Code Analysis was calling an Avg # of lines function instead of todal number of lines. This is addressed in the next cycle.
From: dave.mcmullin [mailto:bounce-davemcmullin@toadworld.com]
Sent: Monday, May 19, 2014 4:39 PM
Subject: RE: [Toad for Oracle - Discussion Forum] lines of code count
Reply by dave.mcmullin
Thank you for your help.
Dave McMullin
425-462-3480
81-3480
From: Bert Scalzo [mailto:bounce-Bert_Scalzo@toadworld.com]
Sent: Monday, May 19, 2014 1:37 PM
Subject: RE: [Toad for Oracle - Discussion Forum] lines of code count
Reply by Bert Scalzo
Looks like a bug - it’s been reported now and will be reviewed in 12.next dev cycle …
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from Toad for Oracle - General notifications altogether.
Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or
Unsubscribe from Toad for Oracle - General notifications altogether.
Toad for Oracle - Discussion Forum
Flag
this post as spam/abuse.