informatica : why i am getting error while using iif function? - etl

I have column 'GENDER' where values 'M or 'F' comes in , anyother value coming, i want to populate as 'UNK' using IIF in expression tranf informatica. i am getting error
operand cannot be converted to number
using below expression
iif(GENDER='M' OR 'F','TRUE','UNK')

Please use this code
iif(GENDER='M' OR GENDER='F',GENDER,'UNK')
if its M or F then use original column else populate UNK.

Related

Laravel Eloquent Error (SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer)

I tried to retrieve data by joining 3 table using below queries but it returns the above error (in the title). I couldn't discover what's the problem. Thank you in advance.
$data = DB::connection('pgsql_backoffice')
->table('tusers')
->join('tservices','tusers.user_id','=','tservices.user_id')
->join('tnotify_send_info','tnotify_send_info.user_id','=','tnotify_send_info.user_id')
->select('tusers.user_id','tservices.account_no','tusers.cust_type','tusers.first_name','tusers.last_name','tusers.company_name','tservices.created_t','tservices.start_t','tnotify_send_info.notify_actual_date')
->where('tservices.plan_id','tnotify_send_info.package_id')
->get();
The error says that there are something wrong with 'tnotify_send_info.package_id'
Use whereColumn() to compare columns:
->whereColumn('tservices.plan_id', 'tnotify_send_info.package_id')

Where clause not working. Laravel

I'm trying to count result from my query which is using multiple where query. But it doesn't seem to be working.
My syntax is:
$partialpaidquery=['month' => $maina];
$partialpaid=Bill::where($partialpaidquery)->where('paid','!=',0)->where('fee_status','<','amount')->count();
where clause upto where('paid','!=',0) seems to work but the third one is not working. What is the problem here? It actually should have returned 1. But it is returning 0.
Seems you are using wrong query :
You are comparing < string 'amount' instead of use variable $amount
like below:
$partialpaidquery=['month' => $maina];
$partialpaid=Bill::where($partialpaidquery)->where('paid','!=',0)->where('fee_status','<',$amount)->count();
Use your third where as
->whereRaw('fee_status < amount')
because the way you are using it , the amount column is being interpreted as string not column.

MDX Using Query member for the filter value

Hello I am trying to put a query member as an filter condition and the code I am trying to do is :
Member [ThisMonth] as VBAMDX.Format(VBAMDX.Now(),"yyyyMM")
SET [currentdays] AS filter([D Date].[DAY ID].Members,
[D Date].[MONTH ID]=[ThisMonth])
But The query did not recognize the Condition
Member [ThisMonth] as VBAMDX.Format(VBAMDX.Now(),"yyyyMM")
SET [currentdays] AS filter([D Date].[DAY ID].Members,
[D Date].[MONTH ID].&[201309])
The query therefore then return the desire result. I am just wondering is there anymore dynamic way to do this?
Thank you very much!
VBAMDX.Format(VBAMDX.Now(),"yyyyMM") returns a string, not a member identifier. This is like in SQL select 'myColumn' from myTable which returns the literal string ´myColumn´ and not the contents of column mycolumn.
If you want to use the Format function, then you firstly need to construct the full unique name of the member, and secondly convert the string to a member identifier using StrToMember:
Member [ThisMonth] as '[D Date].[MONTH ID].&['
+ VBAMDX.Format(VBAMDX.Now(),"yyyyMM")
+ ']' -- this returns a string!
SET [currentdays] AS filter([D Date].[DAY ID].Members,
StrToMember([ThisMonth]))
By the way: You do not need Filter here, and it can slow down queries dramatically, you can just use
SET [currentdays] AS { StrToMember([ThisMonth]) }

Why do I get "ORA-00932: inconsistent datatypes: expected - got -" when using COLLECT() in a prepared statement?

I am using this query with the Perl DBI:
SELECT c.change_id
, COLLECT(t.tag) AS the_tags
FROM changes c
LEFT JOIN tags t ON c.change_id = t.change_id
WHERE c.project = ?
GROUP BY c.change_id
The DBI uses OCI to prepare this statement, bind the value I pass, and get the results. But Oracle, for some reason, does not like it. The error output is:
ORA-00932: inconsistent datatypes: expected - got - (DBD ERROR: error possibly near <*> indicator at char 41 in '
SELECT c.change_id
, <*>COLLECT(t.tag) AS the_tags
FROM changes c
LEFT JOIN tags t ON c.change_id = t.change_id
WHERE c.project = :p1
GROUP BY c.change_id
'
Not very informative. However, I can make this error go away not only by changing the call to COLLECT() also by replacing the placeholder with the actual value:
SELECT c.change_id
, COLLECT(t.tag) AS the_tags
FROM changes c
LEFT JOIN tags t ON c.change_id = t.change_id
WHERE c.project = 'tryoracle'
GROUP BY c.change_id
That version works perfectly. Why doesn't Oracle like the prepared statement with the COLLECT()?
In case it's any help, here is a trace of the OCI-related calls extracted via ora_verbose = 6 (h/t #bohica).
Finally got a solution to this issue, thanks to some digging by a user. The problem was not with the placeholder; why it worked without the placeholder on the VirtualBox image I have no idea. No, the issue was with the COLLECT(). Seems that both the values being collected need to be cast to a specific type, and the resulting array also needs to be cast to a pre-defined array data type. Just so happens that my code has a custom array type:
CREATE TYPE sqitch_array AS varray(1024) OF VARCHAR2(512);
So I'm able to get the query to work by casting the COLLECT() like so:
CAST(COLLECT(CAST(t.tags as VARCHAR2(512))) AS sqitch_array)

LINQ - Sequence contains no elements

I am using a LINQ query as below.
object.collection.where(t => t.id.Equals("2")).First();
I am getting the error "Sequence contains no elements". Why does the result throw an error when the result contains no elements? Should it not return null when no results are found? That is what happens when using SQL.
It's working as designed. The First() method is to be called when it's known at least one row will be returned. When this isn't the case, call FirstOrDefault().
object.collection.where(t => t.id.Equals("2")).FirstOrDefault();

Resources