Function return Integer : Function Return « Stored Procedure Function « Oracle PL / SQL






Function return Integer

   

SQL>
SQL> -- The WHILE loop as part of a function.
SQL>
SQL> CREATE OR REPLACE FUNCTION noSpaceF(p_pass_string VARCHAR2)
  2        RETURN NUMBER IS
  3            counter INTEGER := 1;
  4            v_return NUMBER := 0;
  5  BEGIN
  6        WHILE counter <= LENGTH(p_PASS_STRING) LOOP
  7             IF SUBSTR(p_PASS_STRING,counter,1) != ' ' THEN
  8                  v_return := v_return + 1;
  9             ELSE
 10                  NULL;
 11             END IF;
 12             counter := counter + 1;
 13        END LOOP;
 14        RETURN v_return;
 15  END noSpaceF;
 16  /

Function created.

SQL>
SQL> select noSpaceF('www.java2s.com www.java2s.com') from dual;

NOSPACEF('WWW.JAVA2S.COMWWW.JAVA2S.COM')
----------------------------------------
                                      28


           
         
    
    
  








Related examples in the same category

1.Return varchar2 value from function
2.Return value from a function
3.Use function return value in select statement
4.Save the returning value from a procedure to a variable
5.RETURN statement.
6.Multiple RETURN Statements
7.Return a type
8.Concatenates two strings into one:
9.Return a varray from a function
10.Append result from generator function to a table
11.We use user function in DML statements
12.This script demonstrates using a record type as a function return value
13.Use function to check passwords
14.Use user-defined function to combine and format columns