Jump to content

Percents


kahunabee

Recommended Posts

I am just learning sql - taking classes at community college. I have an assignment that I have to print a commission rate (with following %) from a basic select statement.

 

I tried doing this with a to_char(value, '99%') and received an error (I do know % is used as sql keywords)

 

ORA-01481:invalid number format modelCause: The user is attempting to either convert a number to a string via TO_CHAR or a string to a number via TO_NUMBER and has supplied an invalid number format model parameter. Action: Consult your manual.

Link to comment
Share on other sites

Here's the documentation for the TO_CHAR function: http://docs.oracle.com/cd/B19306_01/olap.102/b14346/dml_x_stddev018.htm

The first parameter is num-exp and the second is num-fmt.

The expression for the num-fmt can only contain the symbols shown in this table: http://docs.oracle.com/cd/B19306_01/server.102/b14200/sql_elements004.htm#sthref394

The % symbol isn't there, so you can't use it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...