PL / SQL:ORA-00984:此处不允许使用列

时间:2012-05-12 09:40:15

标签: sql oracle plsql

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

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 ;
/

插入陈述中出现错误

1 个答案:

答案 0 :(得分: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 ;
/