How to add leading zero in a number in oracle sql query?

by darrion.kuhn , in category: MySQL , a year ago

How to add leading zero in a number in oracle sql query?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by shyann , a year ago

@darrion.kuhn 

You can add a leading zero to a number in Oracle SQL query using the LPAD function. Here is an example query to add a leading zero to a number:

1
SELECT LPAD(9, 2, '0') AS padded_number FROM dual;


In this query, the LPAD function takes three parameters: the number to pad (in this case, 9), the total length of the padded string (in this case, 2), and the character to pad with (in this case, '0'). The result of this query will be '09'.

Related Threads:

How to add zero before number in PHP?
How to optimize contains in oracle sql query?
How to use 'and' in an oracle sql query?
How to remove zero before number in PHP?
How to validate first number not zero in vue.js?
How to validate phone number with zero at the front in php?