ORA-00942: table or view does not exist (works when a separate sql, but does not work inside a oracle function)

后端 未结 5 1866
隐瞒了意图╮
隐瞒了意图╮ 2020-12-06 04:03

When I have a sql statement like select * from table1, it works great, but as soon as I put it into a function, I get:

ORA-00942: table or view          


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 04:42

    A very simple solution is to add the database name with your table name like if your DB name is DBMS and table is info then it will be DBMS.info for any query.

    If your query is

    select * from STUDENTREC where ROLL_NO=1;
    

    it might show an error but

    select * from DBMS.STUDENTREC where ROLL_NO=1; 
    

    it doesn't because now actually your table is found.

提交回复
热议问题