在过程中为当前用户授予权限

时间:2016-07-04 04:16:40

标签: oracle12c

我有一个类似的程序:

#include <stdio.h>
#include <netinet/in.h>
#include <sys/socket.h>

typedef union combo_tag {
    int i;
    FILE *fp;
} combo;

int foo(combo test) {
    if (test.fp == NULL || test.i == -1) {
        printf("error\n");
        return -1;
    }
    return 0;
}

int main() {
    combo a;

    // attempt to produce an error
    a.fp = fopen("/tmp/somthing-that-does-not-exist/file", "a");
    a.i  = socket(AF_INET, SOCK_DGRAM, IPPROTO_TCP);

    return foo(a);
}

当我以用户QT身份登录并执行该过程时,它会显示错误:

create or replace PROCEDURE CREATE_TABLE_TEST
(I_REPORTID IN number,) 
IS 
  pDatTable varchar2(50);
  pDefTable varchar2(50);
  pApplication APPLICATION%Rowtype;
  cursor pCursor is select * from reportdesc where reportid = I_REPORTID;
BEGIN
select ap.* into pApplication from APPLICATION ap inner join reportgroups rpg on ap.APPID = rpg.APPID 
  inner join reports rp on rpg.GROUPID = rp.GROUPID  where  rp.ID = i_reportid;
  select DATTABLE into pDatTable from reports where id=I_REPORTID;

  EXECUTE IMMEDIATE 'ALTER SESSION SET CURRENT_SCHEMA = '||pApplication.appuser;
  EXECUTE IMMEDIATE 'grant SELECT, INSERT, UPDATE, DELETE on '||pApplication.appuser||'.'|| pDatTable||' to QT' ;
END CREATE_TABLE_TEST;

我该如何解决?感谢。

更新:场景是:我有一个Java Web应用程序,我将使用QT连接到数据库。在app中,我有一个函数,它将在模式A中创建一个表,然后在该表上进行查询。我第一次执行上面的过程而没有授予QT的授权权限,所以我得到错误:“表或视图不存在”。所以,我在架构A上为QT添加了SQL to GRANT权限,现在我有了上面的ORA-0179。

0 个答案:

没有答案