Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I've gotten solutions within a day - it saved a lot of time and actually got me one ATTABOY from my boss..."

Geography

Where in the world do Tek-Tips members come from?
Cretin (TechnicalUser)
2 May 12 9:00
Is there a way in PL/SQL to display a count of how many rows in a particular column has a certain length minus leading blanks?

For example how many rows have a customer number less than 9 characters ignoring leading blanks.  

Cretin
 

taupirho (Programmer)
2 May 12 10:41
To get rid of leading blanks use the LTRIM function in Oracle.

So something like

select count(mycol)
from mytable
where length(ltrim(mycol)) < 10


 


In order to understand recursion, you must first understand recursion.

carp (MIS)
2 May 12 10:49
You don't need PL/SQL for this.
Try

CODE

SELECT count(*)
  FROM (SELECT my_column
          FROM my_table
         WHERE length(ltrim(my_column)) = 25);
Just substitute 25 with the length you want.
Cretin (TechnicalUser)
2 May 12 12:10
Worked like a champ thank you.  

Cretin
 

SantaMufasa (TechnicalUser)
2 May 12 13:56
Cretin,

Out of curiosity, why did you specify, "Is there a way in PL/SQL to ..."?

santaMufasa
(aka Dave of Sandy, Utah, USA)
"People may forget what you say, but they will never forget how you made them feel."

Beilstwh (Programmer)
22 May 12 15:16
What about null columns

select count(*)
from mytable
where nvl(length(ltrim(mycol)),0) < 10

Bill
Lead Application Developer
New York State, USA

SantaMufasa (TechnicalUser)
22 May 12 17:12

Quote (Bill)

What about null columns

CODE

select count(*) from mytable where nvl(length(ltrim(mycol)),0) < 10
One could replace the "NVL(<expression>,0)" with "NVL(<expression>,999999999999999999999)" it seems to me.

santaMufasa
(aka Dave of Sandy, Utah, USA)
“People may forget what you say, but they will never forget how you made them feel."

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close