PL/SQL LPAD Function

I have a select all statement, but I want one of my fields (a zip code field) to be formated to pull in with only the first 5 digits.  Where and how can I stipulate that?

FROM <table name>

LPAD("field",5) as "Zip_Code"  (not sure where to put this)
Who is Participating?
you can put it before or after the *

select  your_table.*, substr(field,1,5)  "Zip_Code" from your_table
select  substr(field,1,5)  "Zip_Code", your_table.* from your_table

but, as you see in my examples, you must alias the * with the source, in this case "your_table"

note, since * is all columns, you will have both FIELD and "Zip_Code" columns in your output.

if you are trying to format a specific column from within the *, you can't.
so, if you want every column but you want to do something special to the zip code column you'll have to list them all.

select substr(field,1,5) from your_table
with the alias...

select substr(field,1,5)  "Zip_Code" from your_table
Luis5011Author Commented:
But where exactly do I put this?

Not sure how to add this to a select all function.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.