Datatype conversion in lookup transformation - oracle

I have lookup table with one string column and input column from source qualifier is decimal data type. I need to use these two columns in lkp condition. While doing this it is throwing invalid datatype error. So here i need to convert input lookup column datatype. Is anyother way to get this done

Convert your input column in another column in an expression using the function below: TO_CHAR(Your_Column), then link this new column to your lookup.

The datatypes of the 2 columns need to be the same, otherwise how can you expect there to be any matches in the lookup?
You can either convert the string to a decimal or the decimal to a string, whichever is easier

Have you tried to add an Expression transformation that will first transform your input to string then do the lookup after the Exptrans. Try this

Related

Is it possible to restrict values for a column in informatica

is it possible to restrict what values are allowed for a column in informatica. For eg, there is a column called Item_number, for which I want values to be in range of 1 to 10, is it possible to implement that, if so which transformation I can use for that?
You need to use FILTER transformation. In properties you can mention -
Item_number >=1 AND Item_number <=10
You can try using a lookup transformation in your mapping and that lookup can be a flat file or table depending on your requirement.
Keep the valid values in that lookup file/table and verify the input data for that column.
If lookup returns a value, the data is valid; else incorrect data in case null is returned.
If you want to restrict the data in your column without removing any rows, use a simple function combination:
IIF(in_val>10, 10, IIF(in_val<1, 1, in_val))
Check if that works fine with your scenario - come back if you need further help.

Laravel 5 Eloquent where clause

how can I operate on the where clause?
For example I have this query
Product::where('purchase_data', '=', $data_inp)->get();
The problem is that I need to operate a formatting on the content of column purchase_data before is compared. What can i do?
Edit to be more specific
The column purchase_data has date values formatted in a certain way, the $data_inp variable is also a date but with another formatting. In order to compare them they have to use the same format; since I can't format the $data_inp variable to the same format of the content of purchase_data, I need to change the format of the content of the purchased_data column before comparing it with the $data_inp variable
Try using whereRaw
https://laravel.com/docs/5.5/queries#raw-expressions
Then you can transform the column to compare.
You can use
Product::whereRaw('purchase_data = '.$data_inp)->get();
Then format the purchase_data to your need
Read more about it here

Hibernate mapping of two properties to one column

I have an object that is generated from XSDs, so I can't change it. In it I have a String DATE and a String TIME (representing the time of day without the date).
DATE = yyyy-mm-dd
TIME = hh:MM:ss:mmmm
In the OracleDB, I don't want to represent these as VARCHAR. I'd like to use DATE or DATETIME. Therefore, I'd need to map both DATE + TIME to one single column, DATETIME.
This is not possible. You can map two columns to a single property (using composites or user types) but not the other way around.
Using the same column name twice in the mapping file usually results in strange exceptions (index out of bounds).
I would use two columns in the database. Convert them to DATE-kind data types using a user type.

For Hive partition based on date, why use string type? why not int?

If I'm defining a table in Hive, and will be partitioning based on date, and my dates are in the format YYYYMMDD, which should I choose for the type, int or string?
If it was just a field, and therefore in the files I'm supplying for the table, I could see using a string, even if only so that I can search for and identify malformed entries that might work their way into my data. But since I will be specifying the partition as part of the load process, I know I'll always have correctly formed values.
When used in a Where clause, the partition field will normally be equality or less-than/greater-than logic.
Dates are typically treated as strings in Hive. If you look at all the date manipulation UDFs available, they use string types, so if you were using integers you would have to cast them every time.
Conceptually also I think it makes more sense to use strings, your YYYYMMDD is just a literal representation of a date object, but it is implicitly equivalent to something like YYYY-MM-DD or DDMMYYYY. So if you were using an integer here, it becomes painful to do such comparisons.
Note that you can also compare strings in Hive with equality/greater/lower-than operators, if you want to select a range of partitions you can easily do that with these operators.
The only case I would see using a "date" as an integer is using a timestamps (Unix-style) because it is a continuous value and represents a real measurable quantity.
Because YYYY-MM-DD is the standard for date representation and is the output of hive's to_date() UDF
it also allows you to do lazy things like select * from foo where day>'2013'
http://xkcd.com/1179/

Integration services string length need to be truncated

I'm using integration services (SSIS), at the moment I'm getting the data from an excel source, the string Description comes with a length greater than 15 chars: the problem is that I can't find a way to truncate this data in order to save it in the database (the column database is varchar(15) and I can't change it).
I was trying to use a derived column in order to truncate the data with no success.
Add a derived column transformation and use the SUBSTRING function to get only the first 15 characters of the string. Read about the Substring function in SSIS here SUBSTRING SSIS Expression
Your expression in the derived column would look something like SUBSTRING(Description, 0, 15)

Resources