Created
July 22, 2016 17:30
-
-
Save hackvan/39f382c1c965edd9b9957356c42239b2 to your computer and use it in GitHub Desktop.
PL/SQL Oracle: Ejemplo de ciclos con consultas dinamicas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Declare | |
Type type_cursor Is Ref Cursor; | |
cu_query type_cursor; | |
lc_query Varchar2(500); | |
lc_codindic SFPS020T.codindic%Type; | |
lc_valindic SFPS020T.valindic%Type; | |
lc_desindic SFPS020T.desindic%Type; | |
Begin | |
lc_query := 'Select codindic, valindic, desindic'; | |
lc_query := lc_query||' From SFPS020T'; | |
lc_query := lc_query||' Where codindic = ''CATEPROY'''; | |
Open cu_query For lc_query; | |
Loop | |
lc_codindic := Null; | |
lc_valindic := Null; | |
lc_desindic := Null; | |
Fetch cu_query Into lc_codindic, lc_valindic, lc_desindic; | |
Exit When cu_query%NotFound; | |
dbms_output.put_line(lc_codindic||' - '||lc_valindic||' - '||lc_desindic); | |
End Loop; | |
End; |
Hi,
With OPEN
and FETCH
actually is no posible, for your particular case, you will must to use DBMS_SQL.TO_REFCURSOR
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello.
this part "Fetch cu_query Into lc_codindic, lc_valindic, lc_desindic;", Can I change dinamic?