1

任何人都可以帮助我解决这个错误,这是代码:-

CREATE OR REPLACE PROCEDURE ICTPPRDI.Create_USER 
                ( 
                Uname      IN  CTRL_USERS.USERNAME %type,                           
                Upass      IN  CTRL_USERS.PASSWORD %TYPE,                           
                Uemail     IN  CTRL_USERS.EMAILADDRESS %TYPE,                         
                Umobile    IN  CTRL_USERS.MOBILENUMBER %TYPE,                         
                Ufullname  IN  CTRL_USERS.FULLNAME %TYPE,                         
                Utitlename IN  CTRL_USERS.TITLENAME %TYPE,                         
                Ugroupid   IN  CTRL_USERS.FK_GROUPID %TYPE
                )                           
AS
BEGIN 
Declare m_USER_ID CTRL_USERS.USERID %TYPE;
   Begin

    m_USER_ID:=0;

    --Check that the input parameters are not Null.
    IF ( Uname IS NULL OR Upass IS NULL OR Uemail IS NULL OR Umobile IS NULL OR Ufullname IS NULL OR Utitlename IS NULL OR Ugroupid IS NULL) THEN
        raise_application_error( -20001, 'Null Values are not accepted.' );
    END IF;

    --Get the value from the created Sequence and set its value to m_OP_SETL_ID for further usage.
    SELECT CTRL_USERS_ID_SEQ.NEXTVAL
    INTO m_USER_ID
    FROM dual;

    IF (m_USER_ID = 0) THEN
        raise_application_error( -20002, 'USERS_ID is not generated , please check the sequence creation.' );
    END IF;

    --Insert the data into the table.
    INSERT INTO ICTPPRDI.CTRL_USERS (USERSID , USERNAME , PASSWORD , EMAILADDRESS , MOBILENUMBER , FULLNAME , TITLENAME , FK_GROUPID) 
    VALUES ( m_USER_ID , Uname , Upassword , Uemail , Umobile , Ufullname , Utitlename , Ugroupid );
    END;

END Create_USER ;
/

插入语句中出现错误

4

1 回答 1

2

像这样试试

编辑:密码参数名称是 Upass,而不是 Upassword

CREATE OR REPLACE PROCEDURE ICTPPRDI.Create_USER 
                ( 
                Uname      IN  CTRL_USERS.USERNAME %type,                           
                Upass      IN  CTRL_USERS.PASSWORD %TYPE,                           
                Uemail     IN  CTRL_USERS.EMAILADDRESS %TYPE,                         
                Umobile    IN  CTRL_USERS.MOBILENUMBER %TYPE,                         
                Ufullname  IN  CTRL_USERS.FULLNAME %TYPE,                         
                Utitlename IN  CTRL_USERS.TITLENAME %TYPE,                         
                Ugroupid   IN  CTRL_USERS.FK_GROUPID %TYPE
                )                           
IS
 m_USER_ID CTRL_USERS.USERID %TYPE;
   Begin

    m_USER_ID:=0;

    --Check that the input parameters are not Null.
    IF ( Uname IS NULL OR Upass IS NULL OR Uemail IS NULL OR Umobile IS NULL OR Ufullname IS NULL OR Utitlename IS NULL OR Ugroupid IS NULL) THEN
        raise_application_error( -20001, 'Null Values are not accepted.' );
    END IF;

    --Get the value from the created Sequence and set its value to m_OP_SETL_ID for further usage.
    SELECT CTRL_USERS_ID_SEQ.NEXTVAL
    INTO m_USER_ID
    FROM dual;

    IF (m_USER_ID = 0) THEN
        raise_application_error( -20002, 'USERS_ID is not generated , please check the sequence creation.' );
    END IF;

    --Insert the data into the table.
    INSERT INTO ICTPPRDI.CTRL_USERS (USERSID , USERNAME , PASSWORD , EMAILADDRESS , MOBILENUMBER , FULLNAME , TITLENAME , FK_GROUPID) 
    VALUES ( m_USER_ID , Uname , Upass, Uemail , Umobile , Ufullname , Utitlename , Ugroupid );


END Create_USER ;
/
于 2012-05-12T09:57:07.613 回答