當運行使用HSQLDB 2.2.5,的results.csv
內容下面的腳本(q.sql
)成爲以下:在HSQLDB
results.csv:
C1,C2
[null],e
a,b
q.sql:
DROP TABLE "PUBLIC"."TABLE1" IF EXISTS;
CREATE TABLE "PUBLIC"."TABLE1" (
"C1" VARCHAR(10),
"C2" VARCHAR(10),
"C3" VARCHAR(10)
);
INSERT INTO "PUBLIC"."TABLE1" ("C1", "C2", "C3") VALUES ('a', 'b', 'c');
INSERT INTO "PUBLIC"."TABLE1" ("C1", "C2", "C3") VALUES ('d', 'e', 'f');
DROP TABLE "PUBLIC"."TABLE2" IF EXISTS;
CREATE TABLE "PUBLIC"."TABLE2" (
"C1" VARCHAR(10),
"C2" VARCHAR(10),
);
INSERT INTO "PUBLIC"."TABLE2" ("C1", "C2") VALUES ('a', 'b');
INSERT INTO "PUBLIC"."TABLE2" ("C1", "C2") VALUES ('u', 'v');
DROP TABLE "PUBLIC"."TABLE3" IF EXISTS;
CREATE TABLE "PUBLIC"."TABLE3" (
"C1" VARCHAR(10),
"C2" VARCHAR(10)
);
INSERT INTO "PUBLIC"."TABLE3" (
"C1",
"C2"
)
SELECT
(SELECT
"T2"."C1" AS "T2C1"
FROM "PUBLIC"."TABLE2" "T2"
WHERE "T2"."C1" = "T1"."C1") AS "T2C1",
"T1"."C2" AS "T1C2"
FROM "PUBLIC"."TABLE1" "T1"
ORDER BY "T2C1", "T1C2";
* *DSV_COL_DELIM=,
* *DSV_ROW_DELIM=\n
* *DSV_TARGET_FILE=results.csv
\x "PUBLIC"."TABLE3"
哪有我改變我的腳本,使得「[null]
」被替換爲「?」在生成的CSV文件中?
所以沒有建議的解決方案滿足您的需求?因爲鏈接直接來自hSQLDB文檔,所以我有些驚訝。它的實現當然不是函數本身。 – xQbert