How to use Mapping Variable in Target Update Override in informatica - etl

I'm trying to Update the Primary key(defined at informatica level) through target update ovverride.
I'm using update strategy to mark the record for update and in target update override i'm using varaible in where clause to update the old pk with new Pk like below
Update employee set emp_id=:tu.empid where emp_id= $$emp_id
$$emp_id is informatica mapping variable which holds the old pk value. When i run the mapping got error as
"Missing Expression"
Update employee set emp_id=??? where emp_id=
Which i beleive that informatica is not able to expand the variable value.
Could you please suggest what i'm doing wrong here. I have checked, mapping variable is correctly set.

Related

Cannot insert NULL into table

I'm using EF Core to connect to an Oracle11g database (using the Oracle.EntityFrameworkCore v2.19.90 provider). It's a code first scenario, the tables are created successfully and everything is as expected.
The problem is, when I try to insert something into the database, for example:
_context.Roles.Add(new ApplicationRole()
{
Name = "FOO",
DisplayName = "Foo"
});
_context.SaveChanges();
I get an error:
OracleException: ORA-01400: cannot insert NULL into ("SCHEMA"."AppRole"."Id")
The column Id is indeed non-nullable. When I use the SQL Server provider, everything is fine, the SQL Server automatically chooses an id for my entity.
Is there any way to get Oracle to set an Id for me? Or could it be done in another way?
I don't want to use Oracle triggers and the solution should be full code first.
As you're on Oracle 11g, then you have to use a trigger along with a sequence which will populate ID column in the background.
Another option is to, obviously, provide ID value during insert.
If you were on 12c or above, you could have used identity column. As you're not, your options are listed above.
One option may be usage of SEQUENCE and default value:
CREATE TABLE AppRole(
Id INT NOT NULL,
Name VARCHAR2(100),
DisplayName VARCHAR2(100)
);
CREATE SEQUENCE seq;
ALTER TABLE AppRole MODIFY Id DEFAULT seq.NEXTVAL;
INSERT INTO AppRole(Name, DisplayName) VALUES ('Foo','Foo');
db<>fiddle demo
Default with sequence is supported from Oracle 12c.
There should exist syntax in EntityFramework core that allow to do the following without relying on triggers(raw SQL query as last resort):
INSERT INTO AppRole(Id, Name, DisplayName) VALUES (seq.NextVal, 'Foo','Foo');
Sequences
Basic usage
You can set up a sequence in the model, and then use it to generate
values for properties: C#
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasSequence<int>("OrderNumbers");
modelBuilder.Entity<Order>()
.Property(o => o.OrderNo)
.HasDefaultValueSql("NEXT VALUE FOR shared.OrderNumbers");
}
Note that the specific SQL used to generate a value from a sequence is
database-specific; the above example works on SQL Server but will fail
on other databases. Consult your specific database's documentation for
more information.
Oracle syntax is sequence_name.NEXTVAL.

How do I use a parameter within BI Publisher to update the table name I am querying in an Oracle Data set

I am trying to create a BI Publisher data model which runs the Oracle query below -
SELECT *
FROM audit_YYYYMM
(this should be the YYYYMM of the current date)
How do I setup a parameter default value within the datamodel to grab the YYYYMM from the SYSDATE?
How do I append this parameter within the data set SQL Query?
I tried SELECT * FROM audit_:Month_YYYYMM
(where I had a string parameter called Month_YYYMM)
This did not work.
You are going to have to use something like EXECUTE_IMMEDIATE. And you may have to make a separate PL/SQL package to launch rather than use the built in data definition stuff.
https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/executeimmediate_statement.htm

Oracle Delete multiple columns (not a drop)

Dears,
I am trying to delete multiple columns values in an oracle table, I am running the below script but it seems that it is not working (although it did in SQL server).
DELETE a.mobile_num ,
a.price_list,
a.cust_segment,
a.classification,
a.region,
a.district,
a.localty,
a.dsl_install_dt,
a.dsl_oper_status,
a.fl_install_dt,
a.fl_status,
a.oper_status_cd
From mkt_wl_history_2 a;
Thanks,
You cannot delete column values in Oracle, you can delete entire rows. If I understand correctly you are trying to set these values to NULL.
In this case you can use the following statement.
UPDATE mkt_wl_history_2
SET price_list=NULL,
cust_segment=NULL,
classification=NULL,
region=NULL,
district=NULL,
localty=NULL,
dsl_install_dt=NULL,
dsl_oper_status=NULL,
fl_install_dt=NULL,
fl_status=NULL,
oper_status_cd=NULL
Also, I assume you have to do this for all rows in your table. If not then please apply an appropriate where condition.
Use queries similar to this to set all values of a column to the default value:
UPDATE mtk_wl_history_2 SET mobile_num = DEFAULT

How to update column values to database in phpfox project

I need to update the column values to table in phpfox forum module posting new thread general type. I have found the table name in coding (query) and added values to column but I am not getting col values. Can anybody help?
my db name : munpal
table name : forum_post
colmun name : mark value (here I need to add my values )
Open module\forum\include\service\thread\process.class.php and look add function in that.
This function is called when a thread is added you can modify the function according to your need. May this helps you

Default value is not written when using Entity Framework

I have a simple table with columns ID, REGDATE and EVENT_NAME. I've set SYSDATE as default value for the REGDATE column. If I insert a record right from SQL Developer current date is written to the REGDATE column. But if I insert a record with Entity Framework REGDATE column has NULL. Don't database defaults work when using Entity Framwork? What do I have to do?
One way that you can do it is by having a constructor in your class to set that default automatically whenever you instantiate a new object of that type. This is similar to Ladislav's answer to this SO question.
yo can set that properties,StoreGeneratedpattern to Computed and then EF won't update it, but then neither can you. This method will solve your Db default on the column.

Resources