Skip to Main Content

Español

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How can I query several records in the same field of the same table? Oracle / ¿Cómo puedo consultar

John Cristian CaldNov 28 2019 — edited Feb 7 2020

Good day to all the Oracle developers,

     Buen día para todos los oracle developers,

The matter is this, I hope to explain myself well.

     El asunto es el siguiente, espero explicarme bien.

I have the following query in Oracle:

     Tengo el siguiente query en Oracle:

SELECT GRANTEE

  FROM dba_tab_privs

WHERE (    TABLE_NAME = 'FSD011'

        AND TABLE_NAME = 'FSD015'

        AND TABLE_NAME = 'FSD016'

        AND TABLE_NAME = 'FSD014'

        AND TABLE_NAME = 'FSD013');

What I am trying to do is extract only the GRANTEE that has only all the tables that are indicated after the WHERE condition for the TABLE_NAME field. The output should be:

     Lo que estoy intentando es extraer sólo el GRANTEE que tenga únicamente todas las tablas que se indican después de la condición WHERE para el campo TABLE_NAME. La salida debería ser:

GRANTEETABLE_NAME
RABD_RAUMARTINEFSD011
RABD_RAUMARTINEFSD015
RABD_RAUMARTINEFSD016
RABD_RAUMARTINEFSD014
RABD_RAUMARTINEFSD013

Unlike something like:

     A diferencia de si se usara algo como:

SELECT GRANTEE

  FROM dba_tab_privs

WHERE TABLE_NAME IN ('FSD011',

                      'FSD015',

                      'FSD016',

                      'FSD014',

                      'FSD013');

Where it would be to extract all "GRANTEE" (other than "RABD_RAUMARTINE") that contain any of the indicated tables. (That is not what I want!)

     Donde lo que haría es extraer todos los GRANTEE (distintos a RABD_RAUMARTINE) que contengan cualquiera de las tablas indicadas pero no únicamente las 5.

For example:

     Como por ejemplo:

GRANTEETABLE_NAME
RABD_RAUMARTINEFSD011
RABD_RAUMARTINEFSD013
RABD_RAUMARTINEFSD014
RABD_RAUMARTINEFSD015
RABD_RAUMARTINEFSD016
RABD_IMPUESTOSFSD011
RABD_IMPUESTOSFSD015
RABD_IMPUESTOSFSD016

How do i do it?

     De qué manera se podría conseguir esto?

Thank you very much in advance.

     Muchas gracias de antemano.

.

Comments
Post Details
Added on Nov 28 2019
6 comments
993 views