Grant select privilege to specific columns on a table to user in Oracle 9i

Can anyone tell me how to grant select privilege to a user for specific columns in a table?
I have tried the following statement
GRANT SELECT (EMP_ID) ON EMP TO USER1
But it's not working and I am getting this error "Missing ON Keyword".
Please anyone tell me how to grant select privilege for specific columns.
Edited by: 899045 on Nov 24, 2011 7:03 AM

899045 wrote:
Can anyone tell me how to grant select privilege to a user for specific columns in a table?
I have tried the following statement
GRANT SELECT (EMP_ID) ON EMP TO USER1
But it's not working and I am getting this error "Missing ON Keyword".
Please anyone tell me how to grant select privilege for specific columns.
Edited by: 899045 on Nov 24, 2011 7:03 AMFrom the 9.2 SQL Reference manual, found at tahiti.oracle.com (http://docs.oracle.com/cd/B10501_01/server.920/a96540/statements_912a.htm#2062456)
*"You can specify columns only when granting the INSERT, REFERENCES, or UPDATE privilege. "*

Similar Messages

  • Granting select privileges

    I want to grant select privileges on all tables and views belonging to database xyz to the user abc.
    What's the best way to do that?
    Message was edited by: Diarmuid - 11/07/07
    user580522

    I beg to differ. Of course OP can try to 'GRANT SELECT ANY TABLE'. It's just a matter of his own privileges if he succeeds or not.
    To OP: Reading about GRANT might help:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9013.htm#i2077938
    Note this part from the docs:
    To grant a system privilege, you must either have been granted the system privilege with the ADMIN OPTION or have been granted the GRANT ANY PRIVILEGE system privilege.

  • GRANT syntax : Grant SELECT privileges on tables to a User on a Remote DB

    Hi
    I am having two databases: DEV1 and DEV2. DEV1 is my source database and DEV2 is target database. There is a table in Schema A on Dev1. I have created a PUBLIC DBLINK "TESTDBLINK" in Schema B on DEV2 that connects to Schema A on DEV1.
    Database Schema Table Machine
    DEV1 A EMP 192.168.210.10
    Database Schema Database Lik Machine
    DEV2 B TESTDBLINK 192.168.210.11
    How to grant SELECT privileges on Schema A Table EMP ( DEV1 ) to Schema B on DEV2 ? What is the syntax ?
    e.g. Log in as Schema A on DEV 1
    SQL> GRANT SELECT ON EMP TO *???????*
    Thanks for your inputs
    Harry

    You don't have to grant that table in schema A to schema B.
    Inside schema B, you can just issue a select statement like this:
    select *
    from table@db-link-to-AOracle will connect to the remote instance, using the credentials of schema A, and since A owns that table, Oracle can already access the table.

  • CPY-0007: Select list has fewer columns than destination table

    hello, I need your help, here is my problem is summarized in my example below
    Exemple
    SQL> copy from XX/X@BD1 to YY/Y@BD2 insert TABL1(COL1,COL2)-
    using select COL1,COL2 from TABL1
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    CPY-0007: Select list has fewer columns than destination table
    DESC TABL 1
    COL1, COL2 DESC
    thank u.

    bahan wrote:
    hello, I need your help, here is my problem is summarized in my example below
    Exemple
    SQL> copy from XX/X@BD1 to YY/Y@BD2 insert TABL1(COL1,COL2)-
    using select COL1,COL2 from TABL1
    Array fetch/bind size is 15. (arraysize is 15)
    Will commit when done. (copycommit is 0)
    Maximum long size is 80. (long is 80)
    CPY-0007: Select list has fewer columns than destination table
    DESC TABL 1
    COL1, COL2 DESC
    thank u.
    00007,0, "Select list has fewer columns than destination table\n"
    // *Cause: On an APPEND operation or INSERT (when the table
    //          exists), the number of columns in the SELECT
    //          command is less than the number of columns in the
    //          destination table.
    // *Action: Re-specify the COPY command, making sure that the
    //          number of columns being selected agrees with the
    //          number in the destination table.

  • CPY0007: Select list has fewer columns than destination table

    Hi,
    I have two table TB in both Database A and Database B. TB in Database A has 100 columns, TB in Database B appended one more column which is nullable. I'm copy TB data from A to B using something like:
    insert into TB select * from TB@A where ...
    And I got error:
    CPY0007: Select list has fewer columns than destination table.
    Besides specify the 100 columns plus one new column, any better ways to handle this?
    Thanks a lot.

    This is kind of dangerous genarally but if you know the additional column is on the end this might work.
    insert into TB select a.*, null from TB@A a where ...If this is a regular operation, I would strongly suggest biting the bullet and specifying the column names. Using desc or all_tab_columns and a simple text editor it should take no more than five minutes, which is at least 12 hours less than you have been waiting for a workaround.

  • Using VPD/FGA to null specific columns for all but some users

    I've been reading up on VPD and - though there a numerous examples - I'm having a tough time putting them together.
    I have a table that - when most users select against - they should be getting NULL back in a specific column.
    That column should only display for a select group of users as a value of other than null.
    Can anyone help me out with an example of implementing this?
    Any/all help is appreciated.

    An extract from http://www.oracle-base.com/articles/10g/DatabaseSecurityEnhancements10g.php
    CONN sys/password@db10g AS SYSDBA
    GRANT EXECUTE ON dbms_rls TO scott;
    CONN scott/tiger@db10g
    -- Create the policy function to restrict access to SAL and COMM columns
    -- if the employee is not part of the department 20.
    CREATE OR REPLACE FUNCTION pf_job (oowner IN VARCHAR2, ojname IN VARCHAR2)
    RETURN VARCHAR2 AS
      con VARCHAR2 (200);
    BEGIN
      con := 'deptno = 20';
      RETURN (con);
    END pf_job;
    -- Using the same policy function as before.
    BEGIN
      DBMS_RLS.ADD_POLICY (object_schema         => 'scott',
                           object_name           => 'emp',
                           policy_name           => 'sp_job',
                           function_schema       => 'scott',
                           policy_function       => 'pf_job',
                           sec_relevant_cols     => 'sal,comm',
                           sec_relevant_cols_opt => DBMS_RLS.ALL_ROWS);
    END;
    -- All rows are returned but the SAL and COMM values are only
    -- shown for employees in department 20.
    SELECT empno, ename, job, sal, comm FROM emp;
         EMPNO ENAME      JOB              SAL       COMM
          7369 SMITH      CLERK          10000
          7499 ALLEN      SALESMAN
          7521 WARD       SALESMAN
          7566 JONES      MANAGER         2975
          7654 MARTIN     SALESMAN
          7698 BLAKE      MANAGER
          7782 CLARK      MANAGER
          7788 SCOTT      ANALYST         3000
          7839 KING       PRESIDENT
          7844 TURNER     SALESMAN
          7876 ADAMS      CLERK           1100
         EMPNO ENAME      JOB              SAL       COMM
          7900 JAMES      CLERK
          7902 FORD       ANALYST         3000
          7934 MILLER     CLERK
    14 rows selected.
    -- Remove the policy function from the table.
    BEGIN
      DBMS_RLS.DROP_POLICY (object_schema     => 'scott',
                            object_name       => 'emp',
                            policy_name       => 'sp_job');
    END;
    /The function returns "deptno=20" so any row matching this condition will display the sal and comm value , rest will display null.
    IN your case I guess you check for the user in the function who is executing the query (select user from dual), once you get the user see if this is a user who is suppose to see the columns values if yes return "1=1" otherwise return "0=1".

  • How can I take data from specific column in a table using VBA

    Hi
    I do not know how to take the values from the last column in a table, I know how to look over each row but I cannot take the last column values for each row I pass by.
    This is the table for example:
    | Date | Account1 | Account2 | Description | Amount |
    |12/03/2008 | 123-32 | 325-78 | None | $50 |
    |12/03/2008 | 123-32 | 325-78 | None | $20 |
    |12/03/2008 | 123-32 | 325-78 | None | $10 |
    |12/03/2008 | 123-32 | 325-78 | None | $40 |
    I am using this code as a reference that User FiveNines gave me to loop through all the rows in the table, so What I need is to take the values of the column Amount for each row I go through.
    Private Sub RSWVBAPage_afterPlay()
    Dim tbl As HTMLTable
    Dim tblRow As HTMLTableRow
    Dim tblCell As HTMLTableCell
    Dim strValue As String
    Dim rButton As HTMLInputElement
    ' ******** This would be your global variable. I put this so that values are seperated by a semicolin you can use what ever format works for you.
    strValue = "03/22/2008;03/22/2008;*************1977;*************1977;$25.25;Jan, Jun, Jul, Dec"
    ' Strip out the ; for inner text comparison
    strValue = Replace(strValue, ";", "")
    ' This will get the table but can be modifoed to be more specific
    Set tbl = RSWApp.om.FindElement(, "TABLE")
    ' This loops through all the rows in the table until a match to the strValue is found
    For Each tblRow In tbl.rows
    If tblRow.innerText = strValue Then
    RSWApp.WriteToLog "Tables", "Passed", "Row is Present", True
    End If
    Next
    End Sub

    Hi Lippix.
    This is code that will loop the rows then loop the cells and check for "$" which will return dollar values. I also attached a script.
    Private Sub RSWVBAPage_afterPlay()
    Dim tbl As HTMLTable
    Dim tblRow As HTMLTableRow
    Dim tblCell As HTMLTableCell
    Dim strValue As String
    ' This will get the table but can be modifoed to be more specific
    Set tbl = RSWApp.om.FindElement(, "TABLE")
    ' This loops through all the rows in the table until a match to the strValue is found
    For Each tblRow In tbl.rows
      For Each tblCell In tblRow.cells
      ' cycle through the cells and only report those with a dollar value by searching for $
        If InStr(1, tblCell.innerText, "$") <> 0 Then
       RSWApp.WriteToLog tblCell.innerText
       End If
      Next
    Next
    End Sub

  • How to disable selective cells in a column of a table?

    Hi
    I have a Table UI element having 5 columns. 4 of this are non-editable and only one is editable i.e. having input field . The data is picked from the backend. The 5th column also gets default data from the backend, which the user can later on change.
    But there is a condition, that only the input fields from that row onwards should remain enabled whose month field matches the current month. Rest all should become disabled or invisible.
    I worte the code in the wdModifyView() which picks the current date, and then in a loop it checks all the rows for the condition. If it matches the condition, it comes out of the loop, else it sets the enable property of input field to false.
    But when i run this application, all the cells become disabled, not selective cells.
    Is there a way in which I can sort this problem, any API using which i can access each cell by its row number and column number and then disable it.
    If anybody could please help, it is urgent.
    Thanks & regards,
    Anupreet

    Anupreet,
    Create a subnode with cardinality 1..1 and boolean attribute IsEnabled right under your data node. Write a supply function for this subnode, and set boolean attribute value depending on month in parentElement (parameter of supply function). Then bind InputField "enabled" property to this boolean attribute.
    VS

  • Users selecting "All Choices" on columns in fact table

    We have a dimensionalised data structure in our Oracle DW and the fact table contains 750million rows. I'm finding the users are selecting a column in the fact table to filter on, and selecting the "All Choices" option. This then runs an SQL like:
    select distinct(column_name) from column_table
    Which kills the DW server.
    Does anyone know of a way of stopping this? to only allow the All Choices option on one of the dimension tables?
    Oracle 11g
    BI 10.1.3.4.1
    both on Redhat LINUX
    Thanks in advance.

    Thanks to all for advice/suggestions. In the end I resolved this ( rather a brute force method ) by hacking adjusting one of the XML message documents, standardviewtemplates.xml, that I'd copied into the customMessages directory.
    Its a real shame as it removes that function for all users on every table, but some users keep selecting the "All Choices" option even after being told not to.

  • What is the version of grant alter table, drop table to user in Oracle 10g?

    Hi,
    Oracle support "grant alter table and drop table" before, but I get the "invalid privilege" error in Oracle 10g. Oracle 10g have the "DROP ANY TABLE" and "Alter any table". Is these two means can drop and alter tables belonging to other users? How do I grant the total control (CRUD) of tables in the owner's schema to the owner in Oracle10g?
    Thanks,
    Jiang

    CREATE TABLE privilege grants complete control on owner's tables :
    SYS@db102 SQL> create user test01 identified by test01;
    User created.
    SYS@db102 SQL> grant create session, create table to test01;
    Grant succeeded.
    SYS@db102 SQL> alter user test01 quota unlimited on users;
    User altered.
    SYS@db102 SQL> conn test01/test01
    Connected.
    TEST01@db102 SQL> create table test(a number);
    Table created.
    TEST01@db102 SQL> alter table test add(b varchar2(100));
    Table altered.
    TEST01@db102 SQL> drop table test purge;
    Table dropped.
    TEST01@db102 SQL>                                                      

  • GRANT (Schema Privileges) statement

    Good day!
    Is it possible to access a table in system/manager by granting TYRES privileges?
    Grant select on EMPLOYEE_MSTR to tyres.
    Tyres is another user. I wanted to access all the tables stored in SYSTEM/MANAGER when I logged in as TYRES/TYRES. I am using ORACLE 8 and I haven't use this since.
    Any help is appreciated.
    Thanks!

    First of all: you are in the wrong forum (try the database forum).
    Then: Yes this is possible, but I strongly suggest that you place specific user objects (tables, etc) in the sys tablespace, and do not access the database as system when not necessary.
    cu
    Andreas

  • ORA-01720 while trying to grant select on a view

    Hi Friends,
    Iam getting the following error while trying to grant select privilege for the view to SchemaB, i have the view in schemaA.
    I have used the tables from both the schema for creating the view and iam getting the error on showing a particular table
    ORA-01720: grant option does not exist for 'schemaB.Product'.
    I have looked into so many forums but i couldn't find the answer for my question.
    I must have to create the view in the Schema A only(strictly), as i seen in some forums stated that while creating the view in the other schema and granting the select privilege will solve the problem.But it was an exception to me ...
    Tell me something how can i proceed in this .....

    grant select on t1 to seconduser with admin optionNo. WITH ADMIN OPTION applies to system privileges only. Object privileges need the WITH GRANT OPTION ...
    SQL> grant select on joe_soap.some_table to apc with admin option
      2  /
    grant select on joe_soap.some_table to apc with admin option
    ERROR at line 1:
    ORA-00993: missing GRANT keyword
    SQL> grant select any table  to apc with admin option
      2  /
    Grant succeeded.
    SQL> grant select on joe_soap.some_table to apc with grant option
      2  /
    Grant succeeded.
    SQL> Cheers, APC

  • Grant sequence privilege issue

    Hi,
    OS is windows server 2008
    Database oracle 11g r2
    i have created a schema with name SME having DBA privilege from SME i have created another user SME_USER using the same tablespace of SME with limited privileges. The sequence was created in SME user. I am accessing the tables from SME schema. I have given insert privilege to one of the table in SME to SME_USER,but while insertiing we are using the sequnece with name IPSRNO from SME schema. Now when i tried to insert value inot the table from SME_USER its giving me the output "Sequence does not exist". I have given the grant select privilege for sequence IPSRNO.
    Please guide me on this issue.
    Regards,
    Bobby

    See Using Synonyms in DML Statements in the DBA guide
    http://docs.oracle.com/cd/B28359_01/server.111/b28310/views003.htm
    >
    You can successfully use any private synonym contained in your schema or any public synonym, assuming that you have the necessary privileges to access the underlying object, either explicitly, from an enabled role, or from PUBLIC. You can also reference any private synonym contained in another schema if you have been granted the necessary object privileges for the underlying object.
    You can reference another user's synonym using only the object privileges that you have been granted. For example, if you have only the SELECT privilege on the jward.emp table, and the synonym jward.employee is created for jward.emp, you can query the jward.employee synonym, but you cannot insert rows using the jward.employee synonym.
    A synonym can be referenced in a DML statement the same way that the underlying object of the synonym can be referenced. For example, if a synonym named employee refers to a table or view, then the following statement is valid:
    INSERT INTO employee (empno, ename, job)
    VALUES (emp_sequence.NEXTVAL, 'SMITH', 'CLERK');
    If the synonym named fire_emp refers to a standalone procedure or package procedure, then you could execute it with the command
    EXECUTE Fire_emp(7344);

  • Grant Select

    I'm logged in as user A which is non-DBA, I have a table, and I want to allow access to it by user B, so I use grant all. I log out and log in as user B, and I go to my list of tables and the table from user A is not there. A simple select * from in the command line comes up ORA-00942 table or view does not exist This was done all through the web admin app except for the select *. any help?

    I'm logged in as user A which is non-DBA, I have a
    table, and I want to allow access to it by user B, so
    I use grant all. I log out and log in as user B, and
    I go to my list of tables and the table from user A
    is not there. A simple select * from in the command
    line comes up ORA-00942 table or view does not exist
    This was done all through the web admin app except
    for the select *. any help?as user A, grant select to user B directly:
    grant select on a.MY_TABLE to B;that should enable user B to view the table with the schema prefix (you'll need to specify a.MY_TABLE, not just MY_TABLE).
    If B needs to create views or use the table in a stored procedure, then simple select grant is not enough, you need to grant B to propagate that privilege to its users.
    grant select on a.MY_TABLE to B with grant option;

  • Grant SELECT on all APPS objects to Custom schema

    Hi All,
    My requirement is to GRANT SELECT privileges on all Objects from APPS schema to a custom schema say XXTEST.
    I am OK, if there are multiple privileges to be granted (i.e. separate ones for TABLES,SYNONYMS,PACKAGES).
    I basically want to refer all APPS objects from XXTEST, without any schema prefix.
    I read about GRANT SELECT ANY TABLE, and it looks like I can access any schema objects from it.
    But I would like to know if I can grant from a particular schema alone.
    Thanks.

    Kavipriya wrote:
    I came across a privilege like 'SELECT ANY DICTIONARY', from which I can access all dictionary related tables without schema prefix. So am looking for something similar for APPS objects.Problem is, something similar for APPS objects does not exist. It's simply not there. You need to grant 'ANY' privileges, which means you'll be allowing the user to all the tables in the database, which is almost certainly not what you want, or you need to do individual grants.
    As I mentioned before, you can write SQL that will generate the GRANT statements for you, so you don't need to do it yourself.
    For example:
    select 'grant select on '||owner.table_name||'to some_user;' from dba_tables where owner='APPS';And then execute the output of that query, which will be a bunch of GRANT statements.
    Hope that helps,
    -Mark

Maybe you are looking for