Oracle trigger error, 10g to 11g export - oracle11g

i am trying to export a 10g database to 11g and receieving error(execution completed with warning) at the row that tries to create the trigger.
--------------------------------------------------------
-- DDL for Trigger TR_INS_DATACARD
--------------------------------------------------------
CREATE OR REPLACE TRIGGER "AFTARSIV"."TR_INS_DATACARD" BEFORE INSERT ON fichas REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW BEGIN SELECT fichas_seq.NEXTVAL INTO :NEW.clave FROM DUAL; END;
/
ALTER TRIGGER "AFTARSIV"."TR_INS_DATACARD" ENABLE;
SQL command works fine with 10g, it even creates the trigger at 11g but the trigger has this error:
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: ;

Related

How to run pl/sql statements in Control M for database job/task(execution type :- Embedded Query)

I have pl/sql statement something like mentioned below, which executes successfully in oracle sql developer but same when am trying to execute through control M database task (execution type :- Embedded Query) am getting error "Invalid SQL statements"
SQL statements :-
TRUNCATE TABLE TEST;
COMMIT;
EXECUTE USP_LOADTESTTables;
COMMIT;
create a query file named plsql_query.ql then use it to execute from controlM as command line job.
Sqlcmd -E -server\instance_name -Q "EXEC plsql_query.ql"

PostgreSql migration error

I have aspnet zero project and trying to use it with the Postgresql. I followed the instructions and when i tried to Update-Database it gaves me error:
Failed executing DbCommand (18ms) [Parameters=[], CommandType='Text',
CommandTimeout='30']
CREATE SEQUENCE "AppSubscriptionPayments_Id_seq" START WITH 1 INCREMENT BY 1
NO MINVALUE NO MAXVALUE NO CYCLE;
ALTER TABLE "AppSubscriptionPayments" ALTER COLUMN "Id" TYPE int8;
ALTER TABLE "AppSubscriptionPayments" ALTER COLUMN "Id" SET NOT NULL;
ALTER TABLE "AppSubscriptionPayments" ALTER COLUMN "Id" SET DEFAULT
(nextval('"AppSubscriptionPayments_Id_seq"'));
ALTER SEQUENCE "AppSubscriptionPayments_Id_seq" OWNED BY
"AppSubscriptionPayments"."Id"
42P01: "AppSubscriptionPayments" object is not exists
I'm Using Postgresql 10, Visual Studio 2017 and ASPNET Zero.
Delete all existing migrations and Add-Migration from scratch.
Be sure there's not an existing database (that specified in the connection string) while you add-migrations. If you have an already created database before, migrations cannot be built correctly.
https://aspnetboilerplate.com/Pages/Documents/EF-Core-PostgreSql-Integration

In VS2017, build doesn’t fail even when there is compile time errors

I am using ssdt project (using VS2017 version - 15.1, SSDT version - 15.1.61702.140). I have a stored proc with compile time error but when I build, the build completes successfully.
Is there some project/vs setting that could be causing this behavior? Isn't this kind of scary?
Product table:
CREATE TABLE [dbo].[Product]
(
[Id] INT NOT NULL PRIMARY KEY,
[Name] VARCHAR(50) NULL
)
Stored proc:
CREATE PROCEDURE [dbo].[uspProductSelect]
#name VARCHAR(50) = ''
AS
SELECT * FROM Product as p where p.Name = #name;
use Database1_3; -- this causes compile time issue;
and Visual Studio tells me there is an issue in the error window:
SQL80001: a USE database statement is not allowed in a procedure, function or trigger.
But if I build the project, it completes successfully! This cannot be the right behavior.

How to simulate a corrupt SQLite database

Part of the startup routine in my application validates its SQLite databases by using the PRAGMA integrity_check; API. I'm looking for a way to legitimately corrupt an SQLite database so that this "integrity check" will fail.
I've tried messing with the database file in a text editor, but this causes a type of corruption that is caught when opening the database, much earlier than my call to "integrity check".
Any ideas?
PRAGMA writable_schema allows you to change the database schema behind SQLite's back, and thus to violate constraints:
$ sqlite3 test.db
> CREATE TABLE t(x);
> CREATE INDEX tx ON t(x);
> INSERT INTO t VALUES (1), (1);
> PRAGMA writable_schema = 1;
> UPDATE sqlite_master
> SET sql = 'CREATE UNIQUE INDEX tx ON t(x)'
> WHERE type = 'index' AND name = 'tx';
> .quit
$ sqlite3 test.db # reload
> PRAGMA integrity_check;
non-unique entry in index tx

oracle 10g and define instruction

I want to compile this PL/SQL program in the SQL window that belongs to the Database Home page:
DEFINE p_annual_sal=60000
DECLARE
v_sal NUMBER(9,2):=&p_annual_sal;
BEGIN
v_sal:=v_sal/12;
DBMS_OUTPUT.PUT_LINE('The monthly salary is '|| TO_CHAR(v_sal));
END;
When I hit run I got the following message:
ORA-00900: invalid SQL statement
Even though it works under SQL*Plus of the command line, what it could be the issue?
It works in SQL*Plus because DEFINE is a SQL*Plus command.
When you refer to the "database home page" I believe you're referring to Oracle Apex's SQL Commands window, which can run SQL and PL/SQL code, but not SQL*Plus commands.
You can do this instead - Apex will prompt you for the input bind variables, if any:
DECLARE
v_sal NUMBER(9,2):= :p_annual_sal;
BEGIN
v_sal:=v_sal/12;
dbms_output.put_line('The monthly salary is '|| TO_CHAR(v_sal));
END;

Resources