-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdialect_oracle.go
More file actions
31 lines (29 loc) · 888 Bytes
/
dialect_oracle.go
File metadata and controls
31 lines (29 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// SPDX-FileCopyrightText: 2026 The DMorph contributors.
// SPDX-License-Identifier: MPL-2.0
package dmorph
// DialectOracle returns a Dialect configured for Oracle Database.
func DialectOracle() BaseDialect {
return BaseDialect{
CreateTemplate: `
BEGIN
EXECUTE IMMEDIATE '
CREATE TABLE "%s" (
id VARCHAR2(255) PRIMARY KEY,
create_ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
';
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -955 THEN
RAISE;
END IF;
END;`,
AppliedTemplate: `
SELECT id
FROM "%s"
ORDER BY create_ts ASC`,
RegisterTemplate: `
INSERT INTO "%s" (id)
VALUES (:id)`,
}
}