开发者

Error 201 select identifier must be declared

I am trying to make a login form through Oracle's Form Builder, I have a table called TRAVEL_USER which I made in SQLPlus.

I have made a button and am using the trigger WHEN-BUTTON-PRESSED.

To start myself off I am using this code to simply count the number of开发者_高级运维 users registered on the system:

DECLARE
    TUsers NUMBER := 0;
BEGIN
    SELECT COUNT(*) FROM TRAVEL_USER;
END;

When compiling this I get the following error: Error 201: identifier 'TRAVEL_USER' must be declared.

I can confirm that this table exists in the database I am connecting to, I checked via SQLPlus and the data block wizard in the Oracle Forms Builder.

I connect to the database with full admin privileges (using the system username).


What user owns the TRAVEL_USER table? If you're connecting as the user SYSTEM (Bad Idea) then you likely need to fully qualify the table name with the schema name that owns the table:

SELECT COUNT(*) FROM owner.travel_user;

Either that or create a public synonym for the table:

CREATE PUBLIC SYNONYM travel_user FOR owner.travel_user;

You should not make a habit of using the SYS or SYSTEM accounts for application purposes. They are system accounts and should be used for system purposes.


(BEST WAY IS TO)

DECLARE
SNAME NUMBER:=0;
BEGIN
SELECT COUNT(*) INTO SNAME FROM TRAVEL_USER;
:PCOUNT:=SNAME;
END;

I USED THIS IN ORACLE FORM BUILDER 10G PRACTICALLY AND IT WORKS

FIRST SELECT COUNT FROM TABLE INTO VARIABLE(SNAME) AND AFTER THAT CREATE AN DISPLAY ITEM LIKE(PCOUNT) THEN ASSIGN THE VALUE OF SNAME TO PCOUNT

I AM USING THIS CODE INTO THE WHEN-PRESSED-BUTTON TIGGER AND IT WORK'S PROPERLY

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜