SQR to SQL

Hi,
I used to run a SQR program to get information of my Sybase database but right now I am changing to Oracle 10g, so I need to re-write my SQR programs to SQL but I don't know how to convert the following sentence:
(convert(integer,0x0000+substring(Bkg00,2,1)+substring(Bkg00,1,1)))
BKG00 is a RAW(6). PLEASE HELP ME!!!!!
The complete SQR program is:
begin-procedure segment
show (+1,1) 'procesando....' noline
display $vue
move '(convert(integer,0x0000+substring(Bkg00,2,1)+substring(Bkg00,1,1)))&1023' to $Bkg00
move '(convert(integer,0x0000+substring(Bkg01,2,1)+substring(Bkg01,1,1)))&1023' to $Bkg01
move '(convert(integer,0x000000+substring(Bkg00,4,1))&128)/128' to $Pst00
move '(convert(integer,0x000000+substring(Bkg01,4,1))&128)/128' to $Pst01
begin-select
FltWrd &fln2
getdate() &vista2
convert(char(10),DptDate,3) &fec2
DptDate &fs
OrgnWrd &org2
DstnWrd &des2
ClsWrd &cl2
[$Bkg00] &Bkg00=number
[$Bkg01] &Bkg01=number
[$Pst00] &Pst00=number
[$Pst01] &Pst01=number
let $bkg00 = edit(&Bkg00,'999')
let $bkg01 = edit(&Bkg01,'999')
let $pst00 = edit(&Pst00,'9')
let $pst01 = edit(&Pst01,'9')
let $vista2 = edit(&vista2,'DD/MM/YY')
if #k=1
do print
else
if #k=2
do print2
end-if
end-if
from BkgSegCls
where CrrWrd='AM' and FltWrd="[$vue]"
and DptDate>="[$f1]" and
DptDate<="[$f2]" and ![$flag2]>0 and
(ClsWrd="[$clase1]" or ClsWrd="[$clase2]")
end-select
end-procedure

1 Respuesta

Respuesta
1
Hi (xxxxxx)
La equivalencia en funciones Oracle es
substring => SUBSTR(cadena,inicio, cuenta)
convert(integer... => TO_NUMBER(valor)
convert(data... => TO_DATE(cadena, formato)
Muchas gracias por tu respuesta, fué excelente y me ayudo a resolver el problema que tenía, por fin he logrado leer los campos RAW y sacar los datos.
Mi correo es (xxxxxx) por si alguien tiene la misma duda y quiere que le mande la solución aunque creo que con lo que contesto Ignacio es más que suficiente.
Gracias

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas