如何将 Powerbuilder 查询转换为 Oracle

How to convert Powerbuilder Query to Oracle

我在一家公司工作,该公司有一个用 Power Builder 编写的程序。我对这个一无所知。遗憾的是我的前辈离开了,但我想将程序转换为 Oracle。 所以我需要重新生成它。 首先,关于这个“转换东西”有没有好的文档?

retrieve = "PBSELECT( VERSION(400) TABLE(NAME=~" saldo_stok ~ " )  TABLE(NAME=~" rekening ~ " ) COLUMN(NAME=~" saldo_stok.urutan ~ ") 
COLUMN(NAME=~" saldo_stok.gudang ~ ") COLUMN(NAME=~" rekening.nama_jenisjurnal ~ ") COLUMN(NAME=~" saldo_stok.kode_rekening ~ ") 
COLUMN(NAME=~" saldo_stok.nama_barang ~ ") COLUMN(NAME=~" saldo_stok.sat_hitung2 ~ ") COLUMN(NAME=~" saldo_stok.saldo_awal ~ ")
COMPUTE(NAME=~" ~~~ "saldo_stok~~~".~~~ "SALDO_AWAL~~~" *~~~ "saldo_stok~~~".~~~ "HARGA~~~" AS SALDO_AWAL_NILAI ~ ") 
COLUMN(NAME=~" saldo_stok.mutasi_debet ~ ") COMPUTE(NAME=~" ~~~ "saldo_stok~~~".~~~ "MUTASI_DEBET~~~" *~~~ "saldo_stok~~~".~~~ "HARGA~~~" AS MUTASI_DEBET_NILAI ~ ") COLUMN(NAME=~" saldo_stok.mutasi_keluar ~ ") COMPUTE(NAME=~" ~~~ "saldo_stok~~~".~~~ "MUTASI_KELUAR~~~" *~~~ "saldo_stok~~~".~~~ "HARGA~~~" AS MUTASI_KELUAR_NILAI ~ ") COLUMN(NAME=~" saldo_stok.saldo_akhir ~ ") COMPUTE(NAME=~" ~~~ "saldo_stok~~~".~~~ "SALDO_AKHIR~~~" *~~~ "saldo_stok~~~".~~~ "HARGA~~~" AS SALDO_AKHIR_NILAI ~ ") COLUMN(NAME=~" saldo_stok.harga ~ ") COLUMN(NAME=~" saldo_stok.tgl_terima ~ ") COLUMN(NAME=~" saldo_stok.refference ~ ") COLUMN(NAME=~" saldo_stok.kode_barang ~ ")    JOIN (LEFT=~" saldo_stok.kode_rekening ~ "    OP =~" =~ "RIGHT=~" rekening.nomer_rekjurnal ~ "    OUTER1 =~" saldo_stok.kode_rekening ~ " )WHERE(    EXP1 =~" (
    ( ~~~ "saldo_stok~~~".~~~ "NAMA_BARANG~~~" ~ "   OP =~" LIKE ~ "    EXP2 =~" : brg ) ~ "    LOGIC =~" 
    AND ~ " ) WHERE(    EXP1 =~" ( ~~~ "saldo_stok~~~".~~~ "USER_ID~~~" ~ "   OP =~" =~ "    EXP2 =~" : usr ) ~ "    LOGIC =~" 
    AND ~ " ) WHERE(    EXP1 =~" ( ~~~ "saldo_stok~~~".~~~ "SALDO_AWAL~~~" ~ "   OP =~" <>~ "    EXP2 =~" 0 ) 
) ~ " ) ) ARG(NAME = ~" brg ~ " TYPE = string)  ARG(NAME = ~" usr ~ " TYPE = number)  ARG(NAME = ~" hak ~ " TYPE = string) " arguments = ( ( "brg", string ), ( "usr", NUMBER ), ( "hak", string ) ) sort = "saldo_rek A nama_barang A saldo_stok_urutan A sat_hitung2 A " 
) GROUP (
    LEVEL = 1 header.height = 84 trailer.height = 0 BY = ( "saldo_rek" ) header.color = "536870912" header.transparency = "0" header.gradient.color = "8421504" header.gradient.transparency = "0" header.gradient.angle = "0" header.brushmode = "0" header.gradient.repetition.MODE = "0" header.gradient.repetition.count = "0" header.gradient.repetition.length = "100" header.gradient.focus = "0" header.gradient.scale = "100" header.gradient.spread = "100" trailer.color = "536870912" trailer.transparency = "0" trailer.gradient.color = "8421504" trailer.gradient.transparency = "0" trailer.gradient.angle = "0" trailer.brushmode = "0" trailer.gradient.repetition.MODE = "0" trailer.gradient.repetition.count = "0" trailer.gradient.repetition.length = "100" trailer.gradient.focus = "0" trailer.gradient.scale = "100" trailer.gradient.spread = "100" 
    ) GROUP (
LEVEL = 2 header.height = 4 trailer.height = 4 BY = ( "nama_barang", "harga", "sat_hitung2" ) header.color = "536870912" header.transparency = "0" header.gradient.color = "8421504" header.gradient.transparency = "0" header.gradient.angle = "0" header.brushmode = "0" header.gradient.repetition.MODE = "0" header.gradient.repetition.count = "0" header.gradient.repetition.length = "100" header.gradient.focus = "0" header.gradient.scale = "100" header.gradient.spread = "100" trailer.color = "536870912" trailer.transparency = "0" trailer.gradient.color = "8421504" trailer.gradient.transparency = "0" trailer.gradient.angle = "0" trailer.brushmode = "0" trailer.gradient.repetition.MODE = "0" trailer.gradient.repetition.count = "0" trailer.gradient.repetition.length = "100" trailer.gradient.focus = "0" trailer.gradient.scale = "100" trailer.gradient.spread = "100" 
)

您看到的不是大多数 PowerBuilder 开发人员通常会看到的内容。您向我们展示的是:

  • 导出(通常不用于查看代码)
  • 数据窗口的一部分
  • 以图形格式存储的DW查询

图形格式是……好吧,首先,它应该在 PowerBuilder IDE 中以(剧透警报)图形 演示文稿的形式呈现。不仅如此,它还打算以某种中性语法存储,以便可以根据所使用的数据库驱动程序以略有不同的方式将其转换为 SQL。我所看到的将图形语法转换为 SQL 的任何努力都忽略了驱动因素,因此我从未见过一种通用的方法。 (另外,考虑到当 PB 在 运行 时必须转换为 SQL 时,以图形方式存储会产生轻微的性能影响,我从来没有发现它很受欢迎,所以没有太多需求用于转换实用程序。)

我强烈建议放弃导出并查看 PowerBuilder 中的查询 IDE。您会以正常的 SQL 格式看到它。