cancel
Showing results for 
Search instead for 
Did you mean: 

To get column name instead of value.

former_member187310
Participant
0 Kudos
674

Hi,

I need to return column name of the input parameter passed to a custom function. Is it possible ? The custom function will check for parameter value and based on some logic it should return the column name.

Query1 ----> custom_fn(Query1.column_name)

Inside function we will get the value usin $input_param. But how to get the actual column name passed as parameter?

Thx,

Accepted Solutions (0)

Answers (4)

Answers (4)

akhileshkiran
Contributor
0 Kudos

Hi ,

Hope this will help you out. But you need to pass the parameter in quotes .

with values.

Query

output:

Regards,

Akhilesh Kiran.

former_member187310
Participant
0 Kudos

Thanks .

But I want to get the value as well. In this case, I want the value in Query_1.LOAD_DATE.

0 Kudos

Hi Debasree,

If I understand your problem correctly, you are facing difficulty with returning more than one value from a custom function and you want to get both columns - column header and column value from the custom function.

If my above understanding is correct, then you can resolve this issue by return the column where you will concatenate the data of both the columns.

If this is what you want, I will provide detailed solution for the same, pls reply on this your reference problem.

Thanks,

AJ

0 Kudos

HI Debasree,

Could you please provide an example of the above that you want to make happen.

I have understood the jest of the question but am in little doubt of what you actually want to achieve by passing value from input to a custom function and then returning the column name.

Apologies for the inconvenience.

Thanks,

AJ

former_member187310
Participant
0 Kudos

Hi Former Member,

Based on the content of column,I should get the column name/parameter been passed.Right now we are using ifthenelse() /decode() to get this work, but it would be great if we make a simple custom function and pass the column.

Thx,

mageshwaran_subramanian
Active Contributor
0 Kudos

No , there's no straight forward method.

The workaround would be adding one more parameter to the custom function

custom_fn( Query1.column_name , 'Column_name')


example,


custom_fn( Query1.employee_id , 'employee_id')

akhileshkiran
Contributor
0 Kudos

Hi ,

please have look into the below thread. Hope this will help you out.

Fetch Column Name in BODS function | SCN

Regards,

Akhilesh Kiran.