Comments (4)
Hi Kim,
thank your for your feedback. We are currently working on some new features. So, it is the right time to think about identity columns. It should work out of the box when you are using the option GENERATED ON NULL
. This option is also a good choice, when you need to be able to migrate data with existing identity values.
If you need to use GENERATED ALWAYS
for whatever reason then you could try to fix this with an workaround until we support it out of the box. It should be fairly easy to to do this because we generate only one create_row function which implements the insert. This function is then used by the the create_row procedure and the create_or_update_row function and procedure - so you need to do the changes only in one place. Here a raw workaround which can be generalized by creating a small wrapper procedure - align it to your needs:
--> Generate API
BEGIN
om_tapigen.compile_api(p_table_name => 'EMPLOYEES');
END;
/
-- Modify API to own needs
DECLARE
v_clob CLOB;
v_cursor NUMBER;
v_exec_result PLS_INTEGER;
PROCEDURE util_execute_sql(p_sql IN OUT NOCOPY CLOB) IS
v_cursor NUMBER;
v_exec_result PLS_INTEGER;
BEGIN
v_cursor := dbms_sql.open_cursor;
dbms_sql.parse(v_cursor,
p_sql,
dbms_sql.native);
v_exec_result := dbms_sql.execute(v_cursor);
dbms_sql.close_cursor(v_cursor);
EXCEPTION
WHEN OTHERS THEN
dbms_sql.close_cursor(v_cursor);
RAISE;
END util_execute_sql;
BEGIN
v_clob := rtrim(dbms_metadata.get_ddl('PACKAGE_BODY',
'EMPLOYEES_API'),
'/');
-- If you create a wrapper procedure like this anonymous block of code you can generalize the replacements
v_clob := REPLACE(REPLACE(v_clob,
'INSERT INTO EMPLOYEES ( "EMPLOYEE_ID", ',
'INSERT INTO EMPLOYEES ( '),
'VALUES ( v_pk, ',
'VALUES ( ');
--dbms_output.put_line(v_clob);
util_execute_sql(v_clob);
END;
/
Hope this helps, best regards
Ottmar
from table-api-generator.
Ottmar,
Thanks for your feedback and the example.
I'll look into this and will get back to you when I get it to work.
Kind regards,
Kim
from table-api-generator.
@ogobrecht We used the GENERATED ON NULL
option as you suggested.
from table-api-generator.
Hi Kim,
thank you for your feedback. I will close now this issue.
Best regards
Ottmar
from table-api-generator.
Related Issues (20)
- Nullable columns do not have DEFAULT NULL in the generated API HOT 7
- Add returning into all non-blob-columns HOT 2
- Toggle not to use NotNull-Constraints HOT 4
- new Parameters p_enable_col_camel and p_enable_prefic_fnc_prc HOT 1
- Use SYS_GUID instead of sequence HOT 2
- Primary key not returned on create_row when XMLTYPE column is present HOT 4
- Primary key missing from create_row when identity column is used as PK HOT 4
- Add support for multitenant applications HOT 12
- Generate a function named get_default_row when parameter p_enable_column_defaults is set to true HOT 1
- Development branch: When parameter p_enable_column_defaults is set to true the compiled TAPI is sometimes invalid HOT 1
- compile error HOT 6
- Exception Handling HOT 2
- Oracle 23c Free - Install-Script returns ORA-01422 HOT 3
- Tenant column filter is missing from generated views HOT 1
- Specifying shorter table name substitution variables in p_one_to_one_view_name generates corrupted view name HOT 1
- P%COLUMN_MAPPING parameters are case sensitive HOT 1
- Error installing on oracle 23c free HOT 2
- Generating default values for virtual columns HOT 1
- Enhancement: QuickSQL-like validation and/or transformation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from table-api-generator.