Home >> FAQs/Tutorials >> Oracle Tutorials

Oracle Tutorials - Convert Character Types to Numeric Types

By: FYIcenter.com

(Continued from previous topic...)

How To Convert Character Types to Numeric Types?

You can convert character types to numeric types in two ways:

  • Explicitly by using TO_NUMBER() function.
  • Implicitly by putting character data in a numeric operation.

The sample script below shows you how to convert character types to numeric types:

PROCEDURE proc_convert_1 AS
  start_time CHAR(5);
  finish_time CHAR(5);
  elapsed_time NUMBER(5);
  start_time := '12052';
  finish_time := '15314';
  elapsed_time := TO_NUMBER(finish_time)
    - TO_NUMBER(start_time);
  elapsed_time := finish_time - start_time; -- same as above

(Continued on next topic...)

  1. Is PL/SQL Language Case Sensitive?
  2. How To Enter Comments in PL/SQL?
  3. What Are the Types of PL/SQL Code Blocks?
  4. What Is an Anonymous Block?
  5. What Is a Named Program Unit?
  6. What Is a Procedure?
  7. What Is a Function?
  8. How To Declare a Local Variable?
  9. How To Initialize Variables with Default Values?
  10. How To Assign Values to Variables?
  11. What Are the Arithmetic Operations?
  12. What Are the Numeric Comparison Operations?
  13. What Are the Logical Operations?
  14. How Many Categories of Data Types?
  15. How Many Scalar Data Types Are Supported in PL/SQL?
  16. How To Convert Character Types to Numeric Types?
  17. What Are the Execution Control Statements?
  18. How To Use "IF" Statements on Multiple Conditions?
  19. How To Use "WHILE" Loop Statements?
  20. How To Use "FOR" Loop Statements?
  21. What Is NULL in PL/SQL?
  22. How To Test NULL Values?

Oracle Tutorials:


Other Tutorials/FAQs:


Related Resources:


Selected Jobs: