SELECT SQL with EXEC SQL multirows DESPERATE !
Hi all,
I tried to look on other topics but nothing of help, so if you have any idea...I am at a dead point.
I try to read from SAP a DB table on the same server but it's not a SAP table, but the table of the old ERP of the company.
Anyway with a db link a can read the table with a select, but the result is only 1 row. For the selection criteria I should get 7 rows.
BARS.FATINH2O@RELPRD is the db table where a dblink has been created
so I repeat, that the problem is that I do not get the 7 rows, but anyway the link works and I get only the first line.
I tried without header line and it does't work, I get always the first line.
It's just like if I need something to do a loop or to append.
I tried with cursors but I had no success at all.
Here it is the code.
REPORT Z_PCREASQL .
data: prov like ever-vrefer.
types: begin of tipo,
cod_utente(6) TYPE c,
anno_fatin(4) TYPE c,
num_fatin(6) TYPE c,
data_emi_fatin(10) TYPE c,
data_sca_fatin(10) TYPE c,
eur_imp_tot_fatin(11) TYPE c,
num_cod_fatin(2) TYPE c,
data_pag_fatin(10) TYPE c,
flag_rateizzato(1) TYPE c,
end of tipo.
* This is the internal table that should take the 7 lines
data: tab_reliance type tipo occurs 0 with header line.
* Anyway I get only 1 line !!!!!
**********************************************************
**********************************************************
prov = '144980'. " This is a code for me to do tries
EXEC sql.
select
user_id,
year_fatin,
num_fatin,
data_emi_fatin
data_sca_fatin,
eur_imp_tot_fatin,
num_cod_fatin,
data_pag_fatin,
flag_rate
into :tab_reliance
from BARS.FATINH2O@RELPRD
where cod_utente = :prov
endexec.
* now I have in the internal table tab_reliance in the header line only 1
* record
HELP PLEASE, quite desperate !!!!
There goes modifications of code:
data: tab_reliance type tipo occurs 0 with header line.
<< insert>>
data str_reliance type tipo .
<<end insert>
<<modify>>
*EXEC sql.
EXEC sql performing exec_save .
<< end of modify>>
EXEC sql.
<<modify>>
*into :tab_reliance
into :str_reliance
<< end of modify>>
<<insert>>
form exec_save .
append str_reliance to tab_reliance .
endform .
BACR
Thanks a lot bro, now it works perfectly.
My best regards and good job !
Dear Geronimo,
Can you please let me know how to create the DB link.
In "BARS.FATINH2O@RELPRD"---does RELPD a db link and BARS the database and the FATINH2O the table name.
Rgds,
chamu