Skip to Main Content

SQL & PL/SQL

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 to solve union problem in oracle view?

Jch10Jan 21 2015 — edited Jan 22 2015

Hi, I am having this error when I try to create a view in oracle database: grant option does not exist for 'GBSINTER.VISTA_CAT_CONTABLE

This is my code:

(SELECT cia_codigo, num_cuenta, pcon_anonatnac, NULL, dsc_cuenta, NULL,

           DECODE (tipo_cuenta, 'D', 'G', 'I'), 'D', 1, 'C', 'S', NULL, 'S',

           NULL, ind_centro_costo, NULL, NULL, NULL, NULL, NULL, NULL

      FROM GBSINTER.vista_cat_contable,

           openside.side_gen_cia,

           openside.side_con_par

     WHERE cia_codciaext = cod_cia AND pcon_codcia = cia_codigo)

    UNION

    (SELECT cia_codigo, num_cuenta, pcon_anonatnac - 1 as pcon_, NULL, dsc_cuenta, NULL,

           DECODE (tipo_cuenta, 'D', 'G', 'I'), 'D', 1, 'C', 'S', NULL, 'S',

           NULL, ind_centro_costo, NULL, NULL, NULL, NULL, NULL, NULL

      FROM GBSINTER.vista_cat_contable,

           openside.side_gen_cia,

           openside.side_con_par

     WHERE cia_codciaext = cod_cia AND pcon_codcia = cia_codigo)

So the real problem is: a grant was given to my user GBSINTER with admin option (you can see this user in the code) and GBSINTER gave grant to the user where I am compiling this view .

If I delete the "union" on the view and try to re-compile only one select, view is compiled without any errors, If I delete the first select (including union )and re-compile my view with only the second select view is compiled without errors again.

For example my view with only this part of code is successful:

(SELECT cia_codigo, num_cuenta, pcon_anonatnac, NULL, dsc_cuenta, NULL,

           DECODE (tipo_cuenta, 'D', 'G', 'I'), 'D', 1, 'C', 'S', NULL, 'S',

           NULL, ind_centro_costo, NULL, NULL, NULL, NULL, NULL, NULL

      FROM GBSINTER.vista_cat_contable,

           openside.side_gen_cia,

           openside.side_con_par

     WHERE cia_codciaext = cod_cia AND pcon_codcia = cia_codigo)

The view is successful if the code is:

(SELECT cia_codigo, num_cuenta, pcon_anonatnac - 1 as pcon_, NULL, dsc_cuenta, NULL,

           DECODE (tipo_cuenta, 'D', 'G', 'I'), 'D', 1, 'C', 'S', NULL, 'S',

           NULL, ind_centro_costo, NULL, NULL, NULL, NULL, NULL, NULL

      FROM GBSINTER.vista_cat_contable,

           openside.side_gen_cia,

           openside.side_con_par

     WHERE cia_codciaext = cod_cia AND pcon_codcia = cia_codigo)

The problem is not grants on user because I can do the selects I guess.

Any recommedation/help will be appreciated.

Thanks.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 19 2015
Added on Jan 21 2015
8 comments
1,794 views