How to execute a string formula and assign the result to a number field

How to execute a string formula and assign the result to a number field
Hi,
we have a function that returns a string like this:
'(45+22)*78/23'
After we should calculate this string and assign the value to a numeric block field
Example:
k number(16,3);
k:=fun1('(45+22)*78/23'); where fun1 execute and translate to number the string.
Does exist a function like fun1 ??
How can we do ?
Regards

Hello,
this is the code that does the job:
SQL> set serveroutput on
SQL> DECLARE
2 ch VARCHAR2(20) :='22+10' ;
3 i NUMBER ;
4 BEGIN
5 EXECUTE IMMEDIATE 'select ' || ch || ' from dual' INTO i;
6 dbms_output.put_line ('i = ' || TO_CHAR(i));
7 END ;
8 /
i = 32
Procédure PL/SQL terminée avec succès.
SQL>
just you have to do is to create a small stored function that take the string to calculate and return the number result
Francois

Similar Messages

  • How to read a string from file & assign the val to a variable in batch file

    Hi,
    How to read a string from a file and assign the value to a variable then return the value to the screen in windows batch file?
    Any suggestions?
    thanks.

    Unless this is a homework question then I don't see the purpose of doing this, but....
    You should be looking a the supplied package utl_file to get the string out of the file, dbms_output to display the string and then google windows batch/command files calling sqlplus to execute your program.
    Andre

  • Execute command on UNIX and get the result

    I want to write a Java program, which can execute a shell script in UNIX and get back the result. Any idea?

    Check these two tips:
    How to execute a command from code
    http://www.java-tips.org/java-se-tips/java.lang/how-to-execute-a-command-from-code.html
    How to read output from a Command execution
    http://www.java-tips.org/java-se-tips/java.lang/how-to-read-output-from-a-command-execution.html

  • How to Compare 2 CSV file and store the result to 3rd csv file using PowerShell script?

    I want to do the below task using powershell script only.
    I have 2 csv files and I want to compare those two files and I want to store the comparision result to 3rd csv file. Please look at the follwingsnap:
    This image is csv file only. 
    Could you please any one help me.
    Thanks in advance.
    By
    A Path finder 
    JoSwa
    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful"
    Best Online Journal

    Not certain this is what you're after, but this :
    #import the contents of both csv files
    $dbexcel=import-csv c:\dbexcel.csv
    $liveexcel=import-csv C:\liveexcel.csv
    #prepare the output csv and create the headers
    $outputexcel="c:\outputexcel.csv"
    $outputline="Name,Connection Status,Version,DbExcel,LiveExcel"
    $outputline | out-file $outputexcel
    #Loop through each record based on the number of records (assuming equal number in both files)
    for ($i=0; $i -le $dbexcel.Length-1;$i++)
    # Assign the yes / null values to equal the word equivalent
    if ($dbexcel.isavail[$i] -eq "yes") {$dbavail="Available"} else {$dbavail="Unavailable"}
    if ($liveexcel.isavail[$i] -eq "yes") {$liveavail="Available"} else {$liveavail="Unavailable"}
    #create the live of csv content from the two input csv files
    $outputline=$dbexcel.name[$i] + "," + $liveexcel.'connection status'[$i] + "," + $dbexcel.version[$i] + "," + $dbavail + "," + $liveavail
    #output that line to the csv file
    $outputline | out-file $outputexcel -Append
    should do what you're looking for, or give you enough to edit it to your exact need.
    I've assumed that the dbexcel.csv and liveexcel.csv files live in the root of c:\ for this, that they include the header information, and that the outputexcel.csv file will be saved to the same place (including headers).

  • How to access oracle in javabeans and display the result in jsp

    In my project ,i use the javabean to access the database and do the calculations and i display the result in the jsp page,,,
    any body can help me with your precious codes
    kodi...

    any body can help me with your precious codesStepped in the wrong place, try reading something on JDBC.

  • Execute query in mapping and map the result to next field in target

    Hi Guys,
    Doing file to jdbc Scenario.
    source:
    root:
      row
           sf1
    target:
    root:
        row
           target1
           target2
    I have requirement as:
    I have to map sf1 to target1 ( I do not have any problema in it)
    target2 field must populate basing upon query which results. this should run with the input parameter sf1. If the query results then update target2 else update with MESSAGE_DONE.

    Hi Swarna,
    What kind of query do you mean? In certain cases, it might be worthwhile to consider ABAP mapping, which seems to be the easiest way to do some sequential steps, especially for such a simple message structures.
    Hope this helps,
    Grzegorz

  • How to input data from labview to executable application and export the results back to labview

    I have a simple function written in m file under Matlab enviornment,
    function [c]=myadd2(a,b)
    c=a+b;
    I built it into a executable file (.exe), then I want to call it in labview and get the results.
    I followed this tutorial and some other information on line:
    http://digital.ni.com/public.nsf/allkb/5CF9526FF069EA8E862564C400579DBA
    But I didn't see any telling me how to get the Labview array data input to the EXE file and return the results data back to another indicator in labview.
    Any one have some idea?
    I appreciate the help very much.
    Arnold

    You probably need to include some command line arguments on your executable that would be the name of a file to get the data from. You could also include a command line argument telling that exe where to store the results.
    I am not familiar with Matllab to give you advice on how specifically to do that with your exe though.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • How to execute a function and return the result into a bind variable

    Hi,
    I am trying to calculate the sum of salaries of all persons with a particular JOB_ID using a function TOTAL_INCOME(v_job_id).
    create or replace function total_income
    +(v_job_id IN varchar2)+
    RETURN number IS
    v_total number(6);
    cursor get_sal is
    select salary from employees
    where job_id = v_job_id;
    BEGIN
    v_total := 0;
    for emp in get_sal
    loop
    v_total := v_total emp.salary;+
    end loop;
    dbms_output.put_line('Total salary of '||v_job_id||' is: '|| v_total);
    return v_total;
    END;
    Now I woud like to execute this function and assign the returned value into a bind variable test_sal
    variable test_sal number(6)
    SELECT total_income('AD_VP') into :test_sal FROM DUAL;
    dbms_output.put_line('Total Sal:'||:test_sal);
    This is returning the below errors:
    SELECT total_income('AD_VP') into :test_sal FROM DUAL
    *+
    Error at line 0
    ORA-01036: illegal variable name/number
    dbms_output.put_line('Total Sal:'||:test_sal);
    Error at line 3
    ORA-00900: invalid SQL statement
    Could someone help me what could be the problem?? Thanks for your time...

    Dear,
    If everything you will do will be done inside PL/SQL (stored procedure or stored function) then you don't have to care about bind variable.
    When using PL/SQL (static SQL) you will never encounter issues related to bind variables. PL/SQL itself takes care of your code and uses bind variables behind the scene.
    The only situation where you have to look carefully to the use of bind variables within PL/SQL is when you use Dynamic sql into stored procedures or functions.
    So, see in the light of the above comment, if you have to care about returning your function into a bind variable?
    Best regards
    Mohamed Houri

  • How to create authority check object and assign to  ztcode which is of modu

    Dear ,
             how to create authority check object and assign to  ztcode which is of custom module pool program.its urgent kindly help points rewarded.

    Manoj,
    You can check with your Basis team to create authorisation object and assigining tcodes to the user profiles.
    K.Kiran.

  • How to create a moveable holiday and assign it to a Holiday Calendar?

    Hi Experts,
    How to create a moveable holiday and assign it to a Holiday Calendar?
    Regards,
    Tomesh

    Hi Tomesh,
    Floating Holidays are created for holidays for which the dates are not decided for the years ahead or dates may changes each year or when a unusual holiday is just introducted for one year.
    1.Use transaction SCAL or use the IMG path to the holiday calender.
    2.Create a new holiday and select the option " is a movable holiday".
    3.Fill in the " public holiday attribute tab" and hit insert date.
    4.Fill in the year, month and date for the floating holiday or you could do multiple years at the same time if dates are know and hit create.
    5. The new public holiday is created.
    6.Assign the new holiday to the holiday calender, while saving you will get a message that " an irregular public holiday is created and being save hit ok. This message will appear in cases when the holiday calender validity and the validity of the floating holiday are matching.
    Generate the work schedules and check if th holiday appear in the work schedule.
    Award point if useful.
    Thanks
    Gita

  • How to create a new UoM and assigning it to characteristic?

    Hi,
    How to create a new UoM and assigning it to characteristic?
    i want to enter cost ( in rupees and laks) against a counter
    but for that counter charecteristic required and for taht charecteristic unit of measure Rs and Laks are not defined in the system.
    So please help me ....

    Hi,
    Use T Code CUNI
    Enter  Unit of Measurement as RS and Text as Ruppes
    Commercial and Technical Display is same as RS
    Numerator is 1
    Denominator 1
    Exponent 0
    Save
    Thanks
    Raj

  • Kindly send anybody a ppt on how to execute reports through Browser and Ana

    Hi all,
    I need a PPT on how to execute reports through Browser and Analyzer in version 3.5 or older to 3.5 immediatley from end user point of view. I donot have time to prepare it and has to be sumbmitted before end of the day.
    Kindly help me out by sending it [email protected] .
    Thanks in Advance.
    Anil Kumar Sharma .P

    Thank you Mr. Voodi,
    I will wait for your reply.
    Meanwhile could anybody else ,send me PPT on it.
    Thanks in Advance,
    Anil Kumar
    Message was edited by:
            Anil Kumar Sharma

  • How to run commands like "ipconfig" and get the output in adobe AIR in windows?

    import flash.desktop.NativeProcess; 
    import flash.desktop.NativeProcessStartupInfo;   
    if (NativeProcess.isSupported) {     
         var npsi:NativeProcessStartupInfo = new NativeProcessStartupInfo();     
         var processpath:File = File.applicationDirectory.resolvePath("MyApplication.whatever");     
         var process:NativeProcess = new NativeProcess();       
         npsi.executable = processpath;     
         process.start(npsi); 
    The above can only run a sub-application, but how to run an independent  application(command) like ipconfig and get the result?

    Hi,
    here is an example of running a net Use command line from AIR, unig the new NativeProcess. Hope it will help !
    function launchProcess()
      var file = air.File.applicationDirectory;
      // set command path
      file = file.resolvePath("C:/Windows/system32/net.exe");
      var nativeProcessStartupInfo = new air.NativeProcessStartupInfo();
      nativeProcessStartupInfo.executable = file;
      // prepare command parameters
      var args = new runtime.Vector["<String>"]();
      args.push('USE');
      args.push('W:');
      args.push('/delete');
      args.push('/y');
      // set arguments
      nativeProcessStartupInfo.arguments = args;
      // add listeners to catch command outputs
      process.addEventListener(air.ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
      process.addEventListener(air.ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
      process.addEventListener(air.NativeProcessExitEvent.EXIT, onExit);
      // create and run Native process
      process = new air.NativeProcess();
      process.start(nativeProcessStartupInfo);
    function onOutputData(ProgressEvent)
      var processResults = process.standardOutput.readUTFBytes(process.standardOutput.bytesAvailable);
      air.trace("Results: \n" + processResults);
    function onErrorData(ProgressEvent)
      var processResults = process.standardError.readUTFBytes(process.standardError.bytesAvailable);
      if(processResults.search('password') > -1){
        window.alert('Bad password');
      air.trace("Errors: \n" + processResults);
    function onExit(NativeProcessExitEvent)
      air.trace("Process ended with code: " + NativeProcessExitEvent.exitCode);

  • How can I display date+time and not the point number in excell?

    Hi everyone,
    Could anybody tell me how I can save date + time to a file, so that  I can display on a diagram(excel) : date+time in (ox) and data (oy)? :
    My program sets in (ox) the point number and not the date+time....( although  date and time are written correctly in the column...)
    Any help would be great,
    Thanks,
    regards,
    Marc

    hi there,
    excel uses 01.01.1900 00:00 as the time offset, LabVIEW uses 01.01.1904 02:00, so you can't display the correct datetime in excel when you write the time as a fractional number of seconds from LabVIEW. you must format the datetime in LabVIEW to a string and write that to the column. use the "Format Date/Time String" - function and for example "%d.%m.%Y %H:%M:%S%3u" as the format string (see the functions help for more examples). you also could format your data to a string using "Format Into String" - function and write the file as a 2D string array. the decimal point you have to use depends on your system and its settings, but you can specify the decimal point in the Format string like "%.;%f" (means fractional number with point as decimal point).
    best regards
    chris 
    Best regards
    chris
    CL(A)Dly bending G-Force with LabVIEW
    famous last words: "oh my god, it is full of stars!"

  • Executing Abap Queries in Abap Code and processing the result

    Hi,
    I want to execute ABAP Queries (designed by sq01) in an abap report and processing the result in an internal table.
    How could it be work?
    Thanks a lot for your responses,
    with kind Regards
    Reinhold Strobl

    Hello,
    GO to SQ01 and select your query. Go to Menu QUERY-->More Functions->Display Report Name.
    You can then take that report name and go to SE38. Copy the code before END-OF_SELECTION and then modify as per your own requirements.
    Regrads
    Saket Sharma

Maybe you are looking for

  • FM / BAPI to unpack HUs

    Hi Experts, I have a requirement to unpack parent HUs. I have come accross few FM / bapi for the same such as HU_UNPACK BAPI_HU_UNPACK ... I have problem with the paramters... in BAPI_HU_UNPACK i tried entering HUKEY (VEKP-EXIDV), and in hte ITEMUNPA

  • Can i install photoshop cs2 on a new mac?

    hi, i have a new MBP and wish to install Photoshop CS2 but i am having issues. i am running OS X 10.9.4. Does anyone know how i can install it? i can't really justify the price of the full new version of Photoshop for the amount i use it so the free

  • RFC:Complex structure

    Dear experts, In my PI box,i used one RFC SXMB_GET_MESSAGES.I provided input to the table parameter with over 155 values. My attempt was to retrieve from output table parameter which is a deep structure If i drill EX_MSG_CONTENT , i get table MSG_VER

  • IDoc Adapter steps??

    Hi I want to use IDoc adapters in the scenario IDoc to File. I went through the SAP Help IDoc adapter installation. The steps to be follwed are: creating Port - IDX1 Loading Metadata - IDX2 and creating the normal configuration for XI. Please can any

  • F4 date/calendar help for an inputfield

    Hi All, I have a Input Field mapped to context attribute of type String. I want to use the date/calendar help in this field, is it possible? Just to clear, I was using a attribute of type Date and had a calendar help, but now this field was changed t