Derive the function values

Hi All,
I have got functions stored in the a column. while selecting it I have to get the result of the function instead of the function itself.
could you please let me know how to achieve this. I tried searching and found evaluate function but I am not sure if that is the right function I should be using.
thanks for your help!!

Hi
Below is a rough implementation according to my understanding of your requirement:
drop table test_table;
create table test_Table (pk_col number, col varchar2(50), col_1 varchar2(2000));
insert into test_table values (1, 'A', 'LOWER((SELECT COL FROM TEST_TABLE B where B.PK_COL = A.PK_COL))');
insert into test_table values (2, 'KING', 'INITCAP((SELECT COL FROM TEST_TABLE B where B.PK_COL = A.PK_COL))');
insert into test_table values (3, '89', 'TO_NUMBER((SELECT COL FROM TEST_TABLE B where B.PK_COL = A.PK_COL))');
select * from test_Table;
set serveroutput on;
declare
v_sql varchar2(1000);
v_func varchar2(200);
v_res varchar2(200);
begin
  begin
    select col_1
      into v_func
      from test_Table
     where pk_col = 3;
  end;
  v_sql := 'SELECT ' || v_func || ' from test_Table a where a.pk_col = 3';
  execute immediate v_sql into v_res;
  dbms_output.put_line('REsult :: ' || v_res);
end;If you can help with your table structure, it would be possible to give a better solution.
If you do not wish to call Oracle functions, then you would have to do Dynamic SQL Block creation i.e. BEGIN func/proc_name; END;
I hope this helps to resolve your query.
Regards,
P.

Similar Messages

  • Derivation of Functional Area in FI document

    Hi
    We have an issue with the Functional Area derivation while posting the FI document. One FI document got posted with 4 line items, with 3 GL accounts. Two line items are from one GL(Which has cost center) and remaining two belongs to other GL accounts. Here the issue is, one of the line item(same GL) has Functional area and other line item doen't have functional area.
    Is there any configuration/check needs to be done in deriving the function area. Where I can find that in the system(Our system is 4.7). When I checked the posting progam, I found a note saying Functional Area will be visible/invisible depending on the cost-of-sale flat active/inactive. Cost-of-sale flag is active for the company code.
    would you please let me know, how this was happend.?. How to over come this.
    Thanks in advance.
    Thanks
    Lakshman

    Hi Lakshman,
    1. For activation/deactivation of Cost of Sales Accounting, the path is IMG - Financial Accounting - Finacial Accounting Global Settings - Company Code - Cost of Sales Accounting - Activate COst of Sales Accounting for Preparation
    2. You can derive Funcational Area by maintaining Substituation Rules and Activating them. Follow the path  - IMG - Financial Accounting - Finacial Accounting Global Settings - Company Code - Cost of Sales Accounting -  Set up Substitution for Cost of Sales Accounting - Define Substitution.
    After define substitution, activate the same.
    Hope this will help you.
    Thanks & Regards

  • COPA Derivation Rules are not assigning the correct values

    COPA Derivation Rules are not assigning the correct values when we process billing documents in batch.  We currently have derivation rules defined to take the ship to country and refer to custom tables were we identify custom geographic groups (INT/DOM and EAM, AP, etc.).  The derivation rules work accurately when the billing documents are created individually, and more than 75% of them are accurate when generated in batch, but in some circumstances, it populates the derived values with the wrong field and we can not identify where or why that's happening.  It looks like it may have something to do when the ship to customer number account group is different, but that's not consistent..  Does anyone know how or where these values get populated, or have any ideas why incorrect values are appearing sporadically throughout the billing run?  Thanks!!!

    Leigh,
    Apparently the function module is changing the values for some billing docs. Check one of the following user exits, if it gets triggered and the values are changed:
    COPA0001  Enhancement for derivation in Profitability Analysis (CO-PA)
    Function Module: EXIT_SAPLKEDRCOPA_001
    COPA0002  Enhancement for valuation in Profitability Analysis (CO-PA)
    Function Module: EXIT_SAPLKEAB_001
    COPA0003  Enhancement for assignment to profitability segment (CO-PA)
    Function Module: EXIT_SAPLKEAK_001
    COPA0005  Enhancement for actual data update (CO-PA)
    Function Module: EXIT_SAPLKEII_001
    Function Module: EXIT_SAPLKEII_002
    Award suitable points if the above helps. You can also reach me at [email protected]
    Thanks
    Ajay

  • Function Module to find out the release value in contract

    Dear All,
    I have to upload the contract with new accoutn assignment without changing the existing contract. For that i have to download all the existing contract data with value.
    In that case i have some issues regarding the value.
    For example : In the system old contract is created with value 1000 and the released value as 500.
    In that case i have to uload the new contract with all the details of existing contract with value of 500 (1000-500=500).
    How can i get the value (500) and from which table.Is there any functional module to find out the release value in contract.
    Thanks and regads,
    PM
    Edited by: PM on Jan 21, 2010 8:40 AM
    Edited by: PM on Jan 22, 2010 9:48 AM

    Hi
    You need to link the table VBFA and VBAK.
    For a contract you can check all the subsequent document (which you can filter whether you want to see Order / delivery / Billing) in VBFA and then from there pick the subsequent document no. and then from VBAK you can pick the Net value of these subsequent documents, and so you will have both the values (value of Contract and value in subsequent document) and you can determine the balance value.
    Regards
    Amitesh Anand

  • Unable to retreive the return value of pl/sql function using DB Adapter

    Dear Experts,
    I am using DB Adapter in my BPEL Process. Using DB Adapter I am invoking a PL / SQL function. I am able to send two input parameters for the pl/sql function. But I dont know how to retrieve the return value from the function. Please suggest me.
    Thanks,
    Rajesh

    Yes I am returning a value from PL/SQL function.
    Please see the code segments below,
    FUNCTION "TD_INSERT" (a TDINIT_TYPE, stops TDDETAIL_TABLE )
    RETURN VARCHAR2
    AS
    td_no Number;
    td_id Number;
    stop TDDETAILFULL_TYPE;
    length number;
    BEGIN
    insert into TD_INIT values( ----passing all the values here --------- );
    select max(tdno) into td_no from TD_INIT ;
    length := stops.count;
    for i in 1.. length loop
    stop := stops(i);
    insert into TD_DETAIL_FULL values(
    td_no, ------- );
    end loop;
    commit;
    RETURN td_no;
    END;
    Thanks,
    Rajesh

  • Pass a particular value  in the function module.

    Hi Gurus!
    I have a function module READ_HAUPTBUCH_TEXT , here in the importing table KONTENPLAN like ska1-ktopl.
    But I need to pass a value as ZNOA for KONTENPLAN while calling the function which is maintained in the db, but it is always picking up the value 'AZ'.
    can you please let me know as to how i do it .thx in advance.

    hi sandeep it is better to pass like this...
    data: v_ktopl type  ska1-ktopl.
            clear v_ktopl.
             v_ktopl = itab-ktopl.
          CALL FUNCTION 'READ_HAUPTBUCH_TEXT'
            EXPORTING
              kontenplan           =  v_ktopl
              sachkonto            =
              sprache              =
            NO_BUFFER            =
          IMPORTING
            TEXT_WA              =
          EXCEPTIONS
            TEXT_NOT_FOUND       = 1
            OTHERS               = 2
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    regards,
    venkat.

  • Function to return the Entry Value based on Assignment, Element and Date

    Hi Guys,
    Is there a function that returns the Entry Value for the Assignment Element, based on the Assignment Number, Element Name, Entry Segment and the End of Period date?
    Example:
    ==============
    Input Parameters:
    Employee: Iana
    Assignment Num: 123
    Element: D480
    Element Entry: Fund Name
    Output Parameter:
    Element Entry Value: MLC Super Fund
    Thanks,
    Iana

    For element entry values you can use:
    select petf.element_name, nvl(peevf.screen_entry_value,0) screen_entry_value
    from
    pay_element_entries_f peef, pay_element_types_f petf,
    pay_element_entry_values_f peevf, pay_input_values_f pivf,
    per_all_assignments_f paaf
    where petf.element_type_id = peef.element_type_id
    and :p_date_earned between pivf.effective_start_date and pivf.effective_end_date
    and :p_date_earned between petf.effective_start_date and petf.effective_end_date
    and peevf.input_value_id = pivf.input_value_id
    and paaf.assignment_id = peef.assignment_id
    and petf.business_group_id = :p_business_group_id
    and peevf.element_entry_id = peef.element_entry_id
    and :p_date_earned between peef.effective_start_date and peef.effective_end_date
    and :p_date_earned between peevf.effective_start_date and peevf.effective_end_date
    and :p_date_earned between paaf.effective_start_date and paaf.effective_end_date
    and pivf.name = :p_input_value_name
    and petf.element_name = :p_element_name
    and peef.entry_type = 'E'
    and peevf.effective_start_date = peef.effective_start_date
    and peevf.effective_end_date = peef.effective_end_date
    --and peef.assignment_id = :p_assignment_id
    and paaf.assignment_number = :p_assignment_number;
    For payroll results you can use:
    select sum(prrv.result_value)
    from pay_run_results prr, pay_run_result_values prrv,
    pay_assignment_actions paa, pay_payroll_actions ppa,
    pay_element_types_f petf, pay_input_values_f pivf,
    per_all_assignments_f paaf, per_all_people_f papf
    where
    petf.element_type_id = pivf.element_type_id
    and :p_pay_date between petf.effective_start_date and petf.effective_end_date
    and :p_pay_date between pivf.effective_start_date and pivf.effective_end_date
    and paa.assignment_action_id = prr.assignment_action_id
    and petf.element_type_id = prr.element_type_id
    and ppa.payroll_action_id = paa.payroll_action_id
    and prrv.input_value_id = pivf.input_value_id
    and prr.run_result_id = prrv.run_result_id
    and petf.element_name = :p_element_name
    and pivf.name = :p_input_value_name
    and ppa.date_earned = :p_pay_date
    and papf.person_id = paaf.person_id
    and nvl(prr.start_date,ppa.effective_date) between paaf.effective_start_date and paaf.effective_end_date
    and nvl(prr.start_date,ppa.effective_date) between papf.effective_start_date and papf.effective_end_date
    and paaf.assignment_id = paa.assignment_id
    and papf.employee_number = :p_employee_number;

  • User status with reference to characteristic value of the Functional locati

    Hi,
    For a Functional location for which a characeteristic values is maintained as"1",i  want "user status of the mainteance order,when created  to be updated as "XXX".Can any one of you tell me the user exit and code changes for this.Please reply at the earliest.
    EX:A functional location(XXXX) has a Characteristic(xxx) has  value as "1"
    we have created an user status as"xxx" for the order(through status profie).Now,My requirement is
    When i have created a maintenance order for the functional location(XXXX),upon on saving of the order,or Assigning the priority for the maintenance order,i want the user status has to be modified as "XXX".
    Could you please tell us what to do?
    is our requirement will be fulfilled with the exit"IWO10009".If so,please tell us the code to be made>
    Can we map our requirement through "Object dependencies" or any other means to meet our requirement
    you will be highly appreciated
    with regards,
    Joshita

    HI joshita,
    I had a similar issue in the past where i wanted to attach permit to an order based on some characteristic of functional location at user exit 'IWO10002 - Customer check for order release'.
    This will solve your purpose during release of the order.
    You can also use the exit 'IWO10009 - Customer Check for 'Save' Event', this will check irrespective of the status of the order.
    Regards,
    Deepak

  • How to save the difference values in cube after planning functions.

    Hi,
    Now  i am facing small problem but it is tricky..
    in BPS reading the actual value and modifying the actual value in my plan layout and storing the plan values in my transactional cube.before saving the data i am checking the difference between actual and plan value and that difference value i am saving into my cube.here i am using two planing function one is distributing the actual value into my weeks(using fox code i done)after distributing now i am using second planning function to calculate the difference values.but in my layout alwyas i have to show distribute values only.not difference values but in cube i have to save difference values how can i manage this situation.
    Thanks...

    Hi,
    Now  i am facing small problem but it is tricky..
    in BPS reading the actual value and modifying the actual value in my plan layout and storing the plan values in my transactional cube.before saving the data i am checking the difference between actual and plan value and that difference value i am saving into my cube.here i am using two planing function one is distributing the actual value into my weeks(using fox code i done)after distributing now i am using second planning function to calculate the difference values.but in my layout alwyas i have to show distribute values only.not difference values but in cube i have to save difference values how can i manage this situation.
    Thanks...

  • How to restrict the function if values are not correct.

    Hi,
    In my requirement i am reading the actual data, for example my full week data is $70(for 7 days).
    above week values i am distributing to 7 days by equally  for example D1 is $10 d2 is $10...d7 is $10 and i am giving flexibility to my user he can change the data on those days but always total equals to $70.
    if plan total is not equal to actual total i have to pass the error message, how can i check the plan total and actual total are equal or not?, and if the total is not equal i am passing the error message and i have to restrict the user don't save the data into TR cube,how can i restrict the save button.???
    i don't want to allow the not equals data into my cube.how can i do it???
    If you have sample code please can you share with me if don't have code can you give idea...
    Thanks in advance..
    Happy weekend.

    Hi ,
    Thanks for your reply..
    here i am creating planning function which contains parea and key figure name.
    but in actual layout having month days like 28 or 29....
    i have to read the all the actual values of month  and i have to read all the plan values from another layout after user done the modifications on plan values.
    here why i am reading the all days data is full value is not available but in layout i created full value it is total value of Column one c(1).
    once user done the modification & refresh then i have to read the plan values.
    how can i read and compare if you have any sample code welcome.here i am using version zero for plan and actual.
    it is very urgent can you help me..
    thanks...

  • Any function to check the input value is integer?

    May I know if there's any function to check the input value is integer in Form 4.5?
    Thanks.

    just to add :) - (couldn't resist) :
    create or replace function is_integer ( p_number in varchar2 ) return boolean is
      v_return boolean := true;
      v_number number;
    begin
      v_number := p_number;
      if v_number != trunc(v_number) then
        v_return := false;
      end if;
      return v_return;
    exception
      when others then
        v_return := false;
        return v_return;
    end;
    begin
      if not is_integer(1.1) then
        dbms_output.put_line('is not');
      end if;
      if is_integer(1) then
        dbms_output.put_line('is');
      end if;
      if not is_integer('a') then
        dbms_output.put_line('is not');
      end if;
    end;

  • Function module that can give the last value or the highest value of a key

    hi,
    Is there any function module that can give the last value or the highest value of a key feild in a z table.
    regards,
    johnson

    Hi ,
    We have  aggregate functions in SQL. Some of the functions are as follows.
    MAX(col ) Determines the maximum value of the value in the column col in the resulting set or in the current group.
    MIN( col ) Determines the minimum value of the content of the column col in the resulting set or in the current group.
    AVG(  col ) Determines the average value of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    SUM( col ) Determines the sum of the content of the column col in the resulting set or in the current group. The data type of the column has to be numerical.
    COUNT( col ) Determines the number of different values in the column col in the resulting set or in the current group.
    For further details , type the function name name and press F1 for further help.
    Eg: select count(mantr) from mara into workarea where condition.
    Reward points if helpful.
    Thanks and Regards.

  • How to use the first row function value for the rest of records

    Hi all,
    I am having a select statement like this. We are calling function enabled for each row. So it is taking
    time. As per our bussiness logic, we can use what the function 'enabled' will give for the first row to
    other rows also. so that we can avoid calling the function 'enabled' next row onwars.
    Before
    SELECT
    decode(enabled(col1, col2, col3),'TRUE','xxx', col4),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col5),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col6),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col7),
    decode(enabled(col1, col2, col3),'TRUE','xxx', col8),
    from
    table1 t1, table2 t2 where t1.col1 = t2.col1
    After
    SELECT
    decode(enabled(col1, col2, col3),'TRUE','xxx', col4),
    decode('true/false','TRUE','xxx', col5), --Here 'true/false' is the first row value after calling the function 'enabled'
    decode('true/false','TRUE','xxx', col6),
    decode('true/false','TRUE','xxx', col7),
    decode('true/false','TRUE','xxx', col8),
    from
    table1 t1, table2 t2 where t1.col1 = t2.col1
    Any thoughts on this, how to implement this logic
    Thanks,
    Pal

    It's not clear where col1, col2, col3... etc. come from, so I've assumed they're in table1.
    with table1_X as (select enabled(col1, col2, col3) as enbl
                            ,col1, col2, col3, col4, col5, col6, col7, col8
                      from   table1)
    SELECT decode(t1.enbl,'TRUE','xxx', col4)
          ,decode(t1.enbl,'TRUE','xxx', col5)
          ,decode(t1.enbl,'TRUE','xxx', col6),
          ,decode(t1.enbl,'TRUE','xxx', col7),
          ,decode(t1.enbl,'TRUE','xxx', col8),
    from   table1_x t1 join table2 t2 on (t1.col1 = t2.col1)p.s. you'd be better leaving out the enabled function altogether and incorporating the logic of the function directly in the SQL, and then you would be avoiding any context switching which will clearly impact performance on any large amount of data.
    Edited by: BluShadow on 14-May-2013 08:26

  • Drop down values are missing while using the function module KCD_EXCEL_OLE_TO_INT_CONVERT

    Hi all,
    I am using the function module "KCD_EXCEL_OLE_TO_INT_CONVERT"  to upload the excel template to an internal table but i am not getting the complete excel data into the table the fields which contains the drop down list values those values are not coming in to the table.
    Is there any other function module which can read even the drop down list values? can any one please provide me the solution.
    Thanks in advance
    ** FYI...i am using the below code:
    * upload excel file to a generic table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = l_filename
           i_begin_col             = 1
           i_begin_row             = 1
           i_end_col               = 150
           i_end_row               = 65000
         TABLES
           intern                  = lt_intern
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    Thanks,
    Koushik

    Hi all,
    I am using the function module "KCD_EXCEL_OLE_TO_INT_CONVERT"  to upload the excel template to an internal table but i am not getting the complete excel data into the table the fields which contains the drop down list values those values are not coming in to the table.
    Is there any other function module which can read even the drop down list values? can any one please provide me the solution.
    Thanks in advance
    ** FYI...i am using the below code:
    * upload excel file to a generic table
       CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
         EXPORTING
           filename                = l_filename
           i_begin_col             = 1
           i_begin_row             = 1
           i_end_col               = 150
           i_end_row               = 65000
         TABLES
           intern                  = lt_intern
         EXCEPTIONS
           inconsistent_parameters = 1
           upload_ole              = 2
           OTHERS                  = 3.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    Thanks,
    Koushik

  • Why is the difference in execution speed of the function "SetCtrlVa​l" between constant and changing values so small ?

    In my large application (1 MB exe-file) I am continuously updating a lot of numeric controls with new values. Most of them do not really change their value. Within my search of improving the performance of my application I noticed, that there is only a small difference of the execution speed between a call of "SetCtrlValue" with constant values and calls with changing values. It runs much faster (25 times on my PC), if I get the actual control value with "GetCtrlVal", compare it with my new value an do a call to "SetCtrlVal" only if the current value and the new value are different.
    My questions to CVI-developers is:
    Isn't it possib
    le to do this compare within the function "SetCtrlVal"
    My question to all CVI-users is:
    Does anyone have similar tips to improve the performance of CVI applications ?
    I developed a small test application for this problem, which I can mail to interested users.

    What takes the extra time is the redraw of the control. When you call SetCtrlVal we ALWAYS redraw the control. We wouldn't want to build in functionality to check if the value was the same because that would add additional time to the SetCtrlVal in every case. If you want to do it outside of the loop you can as you have done above. You have a few options. First, keep a previous value variable for the controls that you can use to determine whether to set the control value. I.E.
    int oldVal = 0;
    int newVal = 0;
    if(newVal!=oldVal) {
    SetCtrlVal(..., newVal);
    oldVal = newVal;
    Also, if you set the value of a control through SetCtrlAttribute instead, there is no built in redraw of the control (which is what takes all the time). Using SetCtrlAttribute
    to set the value is very fast, but remember there isn't a built in redraw on the screen to display the new number.
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager

Maybe you are looking for

  • Why isn't Apple acknowledging HUGE delays downloading iTunes Plus tracks?

    After dozens of posts regarding these problems, still not a word from Apple, here on on the iTunes site. And of course no fix yet.

  • Open correspondence in vendor.

    Hi Friends, when i want to reset clearing document by using FBRA i am getting the message that"the open correspondence should be deactivated or not" here what is the open correspondence? thaks in advance, Srini,

  • Disk Keeps Ejecting Itself

    I've got a dane-elect multi-card reader. I insert my canon 7D's compact flash card, delete a single picture, and my card is ejected. I tried verifying it in disk utility, it unmounts and I get a message saying that the disk was not ejected properly.

  • Shake 3.5 Tutorial?

    I am new to 3D graphics and was wondering the first few steps I should take to get acclumated to Shake v3.5? Thanks in advance, TC

  • Derby and boolean values

    does anyone have any information to help me use boolean/bit datatype in Derby