Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Syntax Error?
Message
De
16/09/2004 15:44:01
 
 
À
Tous
Information générale
Forum:
Oracle
Catégorie:
Paquets
Titre:
Syntax Error?
Divers
Thread ID:
00943079
Message ID:
00943079
Vues:
62
Hi All,

I am trying to write a Function to fix a problem I have.
See Thread ID: 941925 Message ID: 941925 in the VFP forum
But the following won't compile. But TOAD doesn't say what the error is.
CREATE OR REPLACE FUNCTION Dec_To_Bin_To_Char  ( pcLoginLevel IN VARCHAR2  )

RETURN VARCHAR2
-- This function should take a character string of numbers and convert 
-- it into a NUMBER. Then loop through all the possible 32 BITS that
-- will reresent the different user groups stored in the field
-- "EMP.Login_Lvl" And then return the BIT equvilant of the passed value.
-- In character format.
IS
   lnNumLoginLvl  NUMBER;
   lcReturnString VARCHAR2;
   lnBitCntr      NUMBER;

BEGIN
  
  lnNumLoginLvl := TO_NUMBER(pcLoginLevel);
  lcReturnString := '';

-- Loop backwards through all the possible bits.
  FOR lnBitCntr IN REVERSE 0 .. 31
   LOOP
    IF lnNumLoginLvl BETWEEN POWER( 2, lnBitCntr ) AND POWER( 2, ( lnBitCntr + 1 ) ) - 1 THEN
--    Add '1' to indicate the bit was set.
      lcReturnString := lcReturnString || '1';
--    Remove the bit placement from the main varaible.
      lnNumLoginLvl := lnNumLoginLvl - POWER( 2, lnBitCntr );
    ELSE
--    Add '0' to indicate the bit was NOT set.
      lcReturnString := lcReturnString || '0';
    END IF;
  END LOOP;

-- Return the bit string.	
  RETURN lcReturnString;

END Dec_To_Bin_To_Char;
/
TIA
Mike
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform