Special Grant to use "Select * from Table(cast..."??

Hi,
I've recently created the types and function to use the Table(Cast(funtion) as type)). It works fine, and gives me the correct result. I've granted execute on the types and on the function to a role that is enabled for a user, but when the user tries to use the "select * from table(cast(function) as type))", he gets a "ORA-01031: Insufficient Privileges" error message. Is there any other grant that must be given to the role, so that the user can execute the select?
Thanks in advance!
Daniel

Hi Kamal,
I'm not sure what anonymous PL/SQL block means. When I (or the user) try to run the select, I enter all the information, i.e., the owners for the type and function: "select * from table(cast(a.my_function(my_argument) as a.my_type))". I'm trying to use SQLPlus at this time, and I have Oracle 8i.
I didn't to explicitly grant execute to the user because that would go against some rules I have to follow... I'll se if I give it a try though!
Thanks!

Similar Messages

  • Expression Framework / SELECT * FROM TABLE(CAST(...

    Hello!
    Is it possible to build the following with Toplink Expression Framework?
    Example:
    CREATE TYPE TY_OB_TEST AS OBJECT
    ( SYSTOP_NR NUMBER(5,0)
    SYS_NR NUMBER(5,0)
    IM_SYS_NAME VARCHAR2(80) ) ;
    CREATE TYPE TY_TB_TEST AS TABLE OF TY_OB_TEST;
    Package1.FUNCTION1 returns Type TY_TB_TEST.
    SQL:
    select * from TABLE(CAST(PACKAGE1.FUNCTION1(42)) AS TY_TB_TEST ));
    thank you!
    Harald.

    Nope, just use SQL.
    - Don

  • Can I simulate SELECT * FROM TABLE WHERE ROW IN (1111,2222) using SQLJ

    I have a fct like
    public void fct(String inStr) {
    String str = "SELECT * FROM TABLE WHERE ROW IN" + inStr;
    // then I xecute the query using JDBC connection
    But I want to do the same thisn using SQLJ like:
    public void fct(String inStr) {
    #sql [nctx] iter = { SELECT * FROM TABLE WHERE ROW IN :inStr}
    When I run the second version and give a parameter like "(1111,2222)" it gives
    ORA-01722: invalid number error.
    Is there a way to give parameters to in clauses of SQLJ statements.
    Thanks in regard.

    This is a SQLJ FAQ. You can find the FAQ at:
    http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/faq.html
    Your question is addressed in the following section:
    http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/faq.html#variablesizevaluelist
    Note that that section has a typo. The lines:
    ? // populate mynumbers
    #sql { SELECT * FROM tab WHERE col in (:(a[0]),:(a[1]),?};
    should read:
    ... // populate mynumbers
    #sql { SELECT * FROM tab WHERE col in (:(a[0]),:(a[1]),...};
    By the way, with the next release SQLJ will support pasting in of dynamic SQL fragments. Then you'll be able to do pretty much what you are trying to accomplish here (albeit with slightly different syntax). Until then you'd have to use the workarounds from the FAQ.

  • Open sys_refcursor for select from table variable?

    Hi,
    I've got a challenge for you! :-)
    I've got a procedure that has a lot of logic to determine what data should be loaded into a table variable. Because of various application constraints, i can not create a global temporary table. Instead, i'd like to create a table variable and populate it with stuff as i go through the procedure.
    The end result of the procedure is that i must be able to pass the results back as a sys_refcursor. This is a requirement that is beyond my control as well.
    Is there a way to make this sort of procedure work?
    Create Or Replace Procedure Xtst
    Mu_Cur In Out Sys_Refcursor
    Is
    Type Xdmlrectype Is Record (Col1 Varchar2(66));
    Type Xdmltype Is Table Of Xdmlrectype;
    Rtn Xdmltype;
    Begin
    Select Internal_Id Bulk Collect Into Rtn From Zc_State;
    open mu_cur for select col1 from table(rtn);
    end;
    11/42 PLS-00642: local collection types not allowed in SQL statements
    11/36 PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    11/19 PL/SQL: SQL Statement ignored
    Show Errors;

    Not anything i'd want to personally implement.
    But for educational purposes only of course....
    create table this_will_be_gross
       column1 number,
       column2 varchar2(30)
    insert into this_will_be_gross values (1, 'begin the ugliness');
    insert into this_will_be_gross values (2, 'end the ugliness');
    variable x refcursor;
    ME_XE?
    declare
       Rtn sys.ODCIVARCHAR2LIST;
    BEGIN
       SELECT
          column1 || '-' || column2 Bulk Collect
       INTO
          Rtn
       FROM
          this_will_be_gross;
       OPEN :x FOR
       SELECT 
          regexp_substr (column_value, '[^-]+', 1, 1) as column1,
          regexp_substr (column_value, '[^-]+', 1, 2) as column2      
       FROM TABLE(CAST(rtn AS sys.ODCIVARCHAR2LIST));
    end;
    17  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.09
    ME_XE?
    ME_XE?print :x
    COLUMN1                        COLUMN2
    1                              begin the ugliness
    2                              end the ugliness
    2 rows selected.
    Elapsed: 00:00:00.11In the above example i 'knew' that a hypen was a safe character to use to break up my data elements (as it would not be found anywhere in the data itself).
    I would strongly encourage you not to implement something like this. I realize it's tempting when you are working in strict environments where it can take a serious battle to get structures like temporary tables or SQL Types created, but that's really the proper approach to be taking.

  • Reason behind this query ,SELECT * FROM table WHERE 1 0

    HEllo,
    I would like to know the reason behind using this query ,
    SELECT * FROM <table> WHERE 1 < 0
    before executing the actual SQL query.
    Is there any special reason or the JDBC receiver side is configured like that.
    Is there any option to overcome this process like, can we remove this option or stop using this.
    Why the JDBC adapter basically sending this query on the DB?
    Thanks,
    Soorya,

    Hi,
    if you run this query, you wont be able to see any records of the table.
    SELECT * FROM <table> WHERE 1 < 0
    if you run this query you will see all records
    SELECT * FROM <table> WHERE 0 < 1
    same with SELECT * FROM <table> WHERE 1=1
    So you can check this out that whats happening in your code before executing actual query. just try to co-relate.
    regards
    Aashish Sinha
    PS : reward points if helpful

  • Problem in displaying data onto Form after selecting from table.

    Hi there,
    I keep hitting this error when I tried to display the data after the selection from table. Using backing beans w data control to do it
    Err: java.lang.ClassCastException: java.util.Collections$SingletonList cannot be cast to java.lang.Integer
    Table used ArrayList to retrieve out the wanted data. E.g uses A object
    To display: selected data to retrieve the selected row to display as a read-only form layout below the table. E.g. need to get A.getName() to match with B object B.getName() then uses the B object to retrieve out the data.
    Anyone know how to do it?

    Hi
    use the follwing code
    int rowcount = wdContext.node<Name>().size();
    while(rs.next())
    IPrivate<ViewName>.I<Name>Element tabnode =wdContext.node<Name>().get<Name>ElementAt(i);
    tabnode.nodeAuthoriseNode().invalidate();
    tabnode.nodeAuthoriseNode().addElement(0,authele);
    tabnode.nodeAuthoriseNode().setLeadSelection(0);
    wend
    Regards
    Dhinakar

  • Update table a columns using columns from table b (values of 2 columns of table b need to taken from table c)

    Guys,
    I need to update table A columns col3, col4, col5 and col6 by table b columns col3, col4, col5 and col6 however table b col5 and col6 values need to come from table c col1.
    Means table b col5 and col6 have values in it however i need to replace them with value from table c col1 and need to update table a col5 and col6 accordingly.
    table a and table b has col1 and col2 in common.
    i am trying something like this.
    Update a
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from table_c c where c.col2=b.col5),
    a.col6 = (select col1 from table_c c where c.col2=b.col6)
    from table_A a inner join table_b
    on  a.col1=b.col1 and a.col2=b.col2
    can someone help me reframe above update query?
    thanks in advance for your help.

    Try the below:(If you have multiple values, then you may need to use TOP 1 as commented code in the below script)
    create Table tableA(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableA values(1,2,3,4,5,6)
    create Table tableB(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableB values(1,2,30,40,50,60)
    create Table tableC(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableC values(100,50,30,40,2,2)
    --Insert into tableC values(200,50,30,40,2,2)
    Insert into tableC values(100,60,30,40,2,2)
    Select * From tablea
    Update a Set
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from tablec c where c.col2=b.col5 ),
    a.col6 = (select col1 from tablec c where c.col2=b.col6 )
    from tableA a inner join tableb b
    on a.col1=b.col1 and a.col2=b.col2
    --Update a Set
    --a.col3 = b.col3,
    --a.col4 = b.col4,
    --a.col5 = (select Top 1 col1 from tablec c where c.col2=b.col5 Order by c.Col1 asc),
    --a.col6 = (select Top 1 col1 from tablec c where c.col2=b.col6 Order by c.Col1 asc)
    --from tableA a inner join tableb b
    --on a.col1=b.col1 and a.col2=b.col2
    Select * From tablea
    Drop table tablea,Tableb,TableC

  • How do I do SELECT * FROM TABLE WHERE KEY IN ({list})?

    The title says it all really.
    Is there a reasonable performant way to perform the query
    SELECT * FROM TABLE WHERE KEY IN ({list})where {list} is String []?
    I am currently creating a PreparedStatement with a for loop like this   StringBuffer sb = new StringBuffer ("SELECT * FROM TABLE WHERE ID IN (");
      for (int ii=0;ii<keys.length;ii++) {
        sb.append (keys [ii]);
        if (ii != keys.length-1) sb.append (",");
      sb.append (")");but this means that the prepared statement is created each time I call my method and so I'm not sure that the optimizer will find it easy to cope with. Is there a construction that I'm missing along the lines of SELECT * FROM TABLE WHERE KEY = ? where I can create the PreparedStatement once and just call setObject or something on it when the values in {list} change?

    but this means that the prepared statement is created
    each time I call my method and so I'm not sure that
    the optimizer will find it easy to cope with.You are right, the optimizer won't find that easy to deal with (presuming that is even relevant for your driver/database.) But most optimizers won't do anything with statements that change and that is what you are doing.
    You could create several prepared statements which have a common number of bind variables. For example 10 statements with from 1 to 10 bind values. This will work if most of the queries use those.

  • SELECT from table vs. CALL FUNCTION

    Hello,
    I have always wondered what the "best practice" is in this case, so I am looking for input.  When writing custom reports etc. in SAP, is it generally regarded as better practice to write a SELECT statement to get a line from say a Txxx configuration table, or is it best to use an associated BAPI or call to function module?  I know in some cases perfomance must obvioulsy be considered, but in terms of SAP's recommendations or upgrade considerations, which is typically better? 
    Assume for example something as simple as getting company code data...  Is it best to do <b>SELECT * FROM T001...</b> or to call a BAPI like <b>BAPI_COMPANYCODE_GETDETAIL</b>?
    Any feedback would be greatly appreciated.

    Hi
    Never accusing people of regarding performance, however I emphasize safety while developing. Even if it is a T* table, I try to use a standard function or call a subroutine of a standard program doing the work. I feel safer this way. Nevertheless, when I can't find any suitable (as of its interface), I use direct SELECT statements.
    If it is a simple report program then doing direct selects may be tolerable. However, if it is a more sophisticated one, especially if it deals with database updates, I highly recommend to use standards.
    As another way, I am aware you mean simple tables, but by the way, if it has a functional relation with a business entity (e.g. pa0001 for employee), I regard it as mandatory using standard FMs where applicable (I feel myself obliged to call "HR_READ_INFOTYPE" instead of using "SELECT* FROM PA0001...").
    *--Serdar

  • Select from table containing clob

    If i try to select from table containing clob column in SQL PLus it gives error.
    Tab1 contains 3 clob columns and 1 blob column
    select * from tab 1;
    SP2-0678: Column or attribute type can not be displayed by SQL*Plus
    The same statement works in SQL Developer and I am able to see the result.
    Actually i am writing the queries and they will be used by Java developers in their JSP page.
    So what happens here? Can Java use these select statements or will it throw error like SQL Plus?

    BLOB column content can't be displayed in SQL*Plus:
    SQL> create table t_blob (b blob);
    Table created.
    SQL> edit
    Wrote file afiedt.buf
      1* insert into t_blob values('01')
    SQL> /
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from t_blob;
    SP2-0678: Column or attribute type can not be displayed by SQL*PlusBlob and clob columns content can be processed using DBMS_LOB
    package procedures and functions or using client's language (like Java)
    methods. See JDBC specification.
    Rgds.

  • Select * from table not working with Oracle OBDC driver

    Hello,
    In our web development we have been using the MS ODBC for Oracle
    driver to connect to our Oracle db. We decided to try the
    Oracle ODBC driver because it supports the commandTimeout
    property in ASP which the MS driver does not. The problem I'm
    running into now is that all of our select * from table
    statements appear not to be working. The Oracle ODBC driver
    version we are using is ver 8.00.05.00. Is there something that
    I'm not doing properly? If I take the same select * from table
    statement and name the columns, I dont get any error. Otherwise
    I'm getting a Subscript out of range error. It seems strange to
    me that this driver would not support a select * from table
    statement (which I''m told is the case by another developer
    here).
    Is there something I'm missing?
    Thanks,
    Pete

    I'm positive I have a connection. Otherwise I wouldn't get a
    response when I name the columns instead of using *.
    There must be something else that I'm missing or doing wrong.
    I've actually been looking into alternative ODBC drivers to see
    if I have the same problems but none that I have found support
    commandTimeout.
    Any other ideas?

  • Performace Which is better ?  : Bapi inside a loop OR Select from Tables

    Hi Gurus,
    I have a report which displays purchase info records.
    If I am selecting from tables i need to use EINA, EINE, EORD and some other tables.
    There is a BAPI which gets all purchase info records specific to a vendor , material , purchasing organisation.
    QUESTION: Performace wise which is the better Approach, either selecting from tables or BAPI for Purchase info records
    Regards
    Avi.

    Whether it using BAPI or select. you need to check the performance. If you have full key for these tables EINA, EINE, EORD  then mak a select outside of the loop and within loop use READ TABLE statement with binary search. of if you want multiple records within loop then use loop insdie loop.
    Your final objective is to minimise the database hits . If you use bapi inside loop then your database hits will be more
    select from EINA
    select from EINE
    select from EORD
    loop at itab,
      read table EINA
      read table EINE
      read table EORD
    endloop

  • Select * from table as of Scn fails in powercenter

    Hi all, I have written the below query in SQL override of a Powercenter mapping. This fails with 'FROM keyword not found where expected' error. Can you please suggest how else I can fetch last committed data from my source?Select * from table AS OF SCN <Scn no>

    Hi All, I have multiple flat files which i need to load in a single table.I did that using indirect option at session level.But need to dig out on how to populate substring of header in name column in target table. i have two columns Id and Name. in all input file I have only one column 'id' with header like H|ABCD|Date. I need to populate target like below example. File 1                                    File2     H|ABCD|Date.                      H|EFGH|Date.1                                            42                                            5  3                                            6 Target tale: Id    Name1     ABCD2     ABCD3     ABCD4     EFGH5     EFGH6     EFGH can anyone help on what should be the logic to get this data in a table in informatica.

  • How to achieve that "SELECT * FROM table WHERE age BETWEEN 18 AND 23 AND n"

    How to achieve the SQL like that "SELECT * FROM table WHERE age BETWEEN 18 AND 23 AND name = 'Will' " with BDB C-API
    The primary key in the primary database is 'age' ,and the secondary key in the secondary index is 'name' ,in a lot of examples ,there are all simple , but how to do that complex one.thx~

    but this means that the prepared statement is created
    each time I call my method and so I'm not sure that
    the optimizer will find it easy to cope with.You are right, the optimizer won't find that easy to deal with (presuming that is even relevant for your driver/database.) But most optimizers won't do anything with statements that change and that is what you are doing.
    You could create several prepared statements which have a common number of bind variables. For example 10 statements with from 1 to 10 bind values. This will work if most of the queries use those.

  • Select * from table where rownum 5; no rows returned? why is it so?

    select from table where rownum > 5;*
    no rows returned. why is it so?
    can anyone explain me?

    Hi,
    rownum is pseudo column, and it is based on the sort order.
    For ex, if you want to get the first 5 employees who get the least salary, you use,
    select ename,sal from
        (select ename, sal
         from emp
         order by sal )
        where rownum<=5
    ENAME      SAL                   
    SMITH      800                   
    ALLEN1     890                   
    JAMES      951                   
    TURNER     998                   
    ADAMS      1100Suppose, if you want to use highest salary, you change the order by and not the rownum. So, it becomes,
    select ename,sal from
        (select ename, sal
         from emp
         order by sal desc)
        where rownum<=5
    ENAME      SAL                   
    KING1      5000                  
    FORD       3000                  
    SCOTT      3000                  
    JONES      2975                  
    BLAKE      2850 So, its not the rownum you would want to change, but the order by.
    -Arun

Maybe you are looking for

  • Error in BAPI_SALESORDER_CHANGE

    I need to post the changed incoterm value by using BAPI_SALESORDER_CHANGE. But everytime I used to get the error: Field header_inx-updateflag is not an input field. I have written the below mentioned code :  *& Report  ZBAPI1                         

  • Microphone too low on G780 in Windows 8

    When I used Skype, I heard complains, nobody could hear me. So I checked my microphone settings and they were set... to minimum (microphone 0, performance 0 dB) so I set it to maximum (microphone 100, performance +40 dB) and... with very weak results

  • Serial Number dosn't work when upgrading from CS4 to CS5.5

    Hi All, We are currently running CS4 Design Premium on several machines. This was bought as a 'Volume Licensed' product. We have recently purchased an upgrade to CS5.5 Design Premium, intending to install to a single machine but when we enter the ser

  • How to add a watermark in smartform ............where to specify

    pls lemme know

  • Recurring Time Machine backup error

    I have a 750-gig external hard drive that I have used as my Time Machine backup source for about year without problems. (I have a Macbook Pro that I bought in late 2008.) A few weeks ago, when I plugged in the USB cable and the backup process had aut