new field [message #287216] |
Tue, 11 December 2007 07:57 |
aarti81
Messages: 235 Registered: December 2007 Location: USA
|
Senior Member |
|
|
Hi
I have a report which have fields A,B,C,D,,E,F,G.Now i have to generate a report with a requirement where in i have to combine the fields A,B and C and give it a new name and genreate the report.Please i need this help very soon.
Thanks
|
|
|
Re: new field [message #287267 is a reply to message #287216] |
Tue, 11 December 2007 14:42 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
It sounds like a simple task, only if you could tell what "combining" several fields means. If A, B and C are character fields, I assume you'd like to concatenate them. If these are numeric fields, you might do many things (add them, subtract, multiply - just to name several "ordinary" operations).
Basically, you have two options: the first one is to "combine" those values in a query. For example:-- YOUR CURRENT QUERY:
SELECT a, b, c, d, e
FROM some_table
-- YOUR NEW QUERY, USING CONCATENATION:
SELECT a, b, c, d, e,
a || b || c new_column
FROM some_table
Another option is to create a formula column. Make sure to choose the correct return value datatype as well as its size. Formula column code might look like this:FUNCTION fun_combine RETURN CHAR IS
retval VARCHAR2(30);
BEGIN
retval := a || b || c;
RETURN (retval);
END;
I hope you'll be able to continue your work with these suggestions. If not, try to explain a problem little bit more, perhaps even providing a simple example.
|
|
|