Need advice on how to analyze the integrated calculation

Hello

I have a following problem:

I have a table1 where I have the list of parameters to their current values;

I have a table2 where I have a list of calculations that use these input parameters; the formula is stored as a string in a field

I also have a table 3 where I have a list of calculations with the corresponding parameters, which are used by them;

I also have 4 table, which must contain the result of a calculation according to the formula of table2 with values of parameters from table1

requirement: procedure that will populate the table 4.

my original idea was to do the following:

1 call the procedure with the id of calculation

2 extract the list of parameters for calculating id

3 assign the values from table1 to the parameters of the step 2

4. run the formula with the assigned values-> new procedure called with the formula and table of variables/parameters? dynamic SQL?

can you please advise me what will be the best approach here?

Thank you for the advice

Some examples of data

/ * remove the table TEST_PARAMS;

drop table TEST_CALC;

drop table TEST_CALC_PARAM; * /

/

create the table TEST_PARAMS

(

param_id varchar2 (10),

varchar2 value (50)

)

/

insert into TEST_PARAMS values('param1',15);

insert into TEST_PARAMS values('param2',25);

/

create the table TEST_CALC

(

CALC_ID varchar2 (10),

CALC_FORMULA varchar2 (50)

)

/

insert into TEST_CALC

values ("CALC1",'(param1 + param2) / (param1 * param2)')

/

create the table TEST_CALC_PARAM

(

CALC_ID varchar2 (10),

CALC_PARAM VARCHAR2 (10)

)

/

insert into TEST_CALC_PARAM values ("CALC1", "param1");

insert into TEST_CALC_PARAM values ("CALC1", "param2");

COMMIT;

/

Thank you very much

Rgds

XQUERY + MODEL:

with t as)

Select calc_id,

calc_formula,

Expr,

r

of test_calc c,.

test_params p

model

partition (c.calc_id calc_id)

dimension by (row_number () over (partition by order of 1 c.calc_id) r)

measures)

calc_formula,

Replace (calc_formula, ' /', 'div') expr.

param_id,

value

)

rules)

expr [any] order of r desc = regexp_replace (nvl (expr [cv () + 1], expr [cv ()]), param_id [cv ()], value [cv ()])

)

)

Select calc_id,

calc_formula,

result xmlcast (xmlquery (expr content return) under the number)

t

where r = 1

/

CALC_ID CALC_FORMULA RESULT
---------- -------------------------------------------------- ----------
CALC1 (param1 + param2) / (param1 * param2).106666667

SQL >

SY.

Tags: Database

Similar Questions

  • Need advice on how to create the report

    I don't know how to do this, so I ask for advice from the gods apex...

    Here is the question, I have two tables I need to combine the info from. not a problem in his car. I can do it. but here's the question. in table A, I have some data such as title, theids, disc_id, etc... Table B contains fullname, theid, emplid

    now in the table A column "theids" is filled with apex as a multi select list. the values in the column is therefore something like 48; 3; 88

    He got these identification numbers of the Table B (popup lov) query that returns theid of the one of the person.

    now, I need to create a report that will be used in an excel download and what they want is a line by disc_id and they want the most useful "cost" in the field where to run the "theids." It is instead of:

    disc_id title theids
    101 the 48 test; 3; 88

    they want:

    disc_id title Theids
    101 N33456, N3457, try N43562

    so I'm a bit stuck, I can understand how to write a sql using instr to get something like this:
    101 N33456 of test
    101 N3457 of test
    etc.

    but this isn't what they want. so I think I need to create a package to do this and some sort of return values. the problem is that I can't figure out how I can replace the 48; 3; 88 to N33456, N3457, N43562

    I'm still new to this kind of things pl/sql and apex sorry if this appears to be an obvious answer.

    If you have a look at this example:

    http://HTMLDB.Oracle.com/pls/OTN/f?p=31517:138

    You'll see there

    SELECT empno, ename, job, mgr, sal
      FROM emp
     WHERE INSTR(':'||:p138_select_empno||':', ':'||empno||':') > 0
    

    and

    p138_select_empno is a multiple selection list displaying the names of the employees and containing the string of nosm as 7888; 8900; 3499.

    This info is enough to get to a function like this:

    CREATE OR REPLACE FUNCTION get_string (p_string IN VARCHAR2)
       RETURN VARCHAR2
    IS
       v_string   VARCHAR2 (4000);
    BEGIN
       FOR c IN (SELECT ename
                   FROM emp
                  WHERE INSTR (':' || p_string || ':',
                               ':' || empno || ':'
                              ) > 0)
       LOOP
          v_string := v_string || ', ' || c.ename;
       END LOOP;
    
       v_string := LTRIM (v_string, ', ');
       RETURN v_string;
    END;
    

    and use this function in a report like this:

    SELECT get_string (:p138_select_empno)
      FROM DUAL
    

    Denes Kubicek
    ------------------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    ------------------------------------------------------------------------------

  • Acer laptop with Windows 7. Need to know how to activate the integrated webcam on?

    You want to know how to turn on the camera on my computer acer laptop with Windows 7. The webcam is built in

    Buckeyes I have the last Acer with integrated webcam and turn left click your windows icon in the lower left corner, all programs that are open, scroll down from the top for Acer Crystal Eye Webcam and click to open, and then click the same again and your we will open the cam.

    See you soon

  • Need advice on how to recover the Aero theme

    I lost the theme Aero Windows Vista Edition Home Premium. Have you tried everything to bring him back, but the "themes" is no longer the same figure as in services.msc. Any ideas on how to get that back? Do not appear as an option in customize. Desktop window manager is launched and running, etc.
    Thank you

    Maybe this might help you:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-desktop/Aero-theme-is-no-longer-working-in-Windows-Vista/9f384572-df25-4d13-a825-9082dcfa266a

    LC

  • BlackBerry Smartphones Hi all need advice on how to transfer the address of .ipd fileon list my PC to the torch.

    Hi my name is Rema. Just got my 2nd BB, a torch to replace my old Bold.Am of 2 years already having problems and I hope someone can help.

    first of all, when I do a backup of sync, I get an error Ox80040057 Gael. I have no ide what it means

    Secondly, I can't transfer the address list in the file .ipd of my "BOLD" on my PC to the torch.

    I tried to use magicberry read and check if the .ipd document is readable.

    Please notify. Thank you.

    Have you tried using the BlackBerry Desktop Manager's restore function to transfer contacts? Check the below section of the knowledge base for more details.

    KB10339  How to use BlackBerry Desktop Manager to restore the data to a BlackBerry smartphone from a backup file

  • need to know how to cancel the free trial subscription Starz

    I have an iPhone 6 and need to know how to cancel the free trial subscription Starz.  Help, please

    Follow the instructions in this article to support > view, change or cancel your subscription - Apple Support

  • I need to know how to remove the most recent version of Firefox. I JUST downloaded tonight and my computer does not have this edit bar little to work with, so I can download the reader good Adobe and my internet was screwed up ever since I downlo

    I need to know how to remove the most recent version of Firefox. I JUST downloaded tonight and my computer does not have this edit bar little to work with, so I can download the reader good Adobe and my internet was screwed up, since I downloaded the new version of Firefox. I want just the old version of this back because I can't download the Adobe stuff which is necessary to protect my computer against hackers apparently not. It would have been nice to know he had a problem with the new update of Firefox BEFORE I downloaded it. I have Vista, which is usually a problem with Adobe and Firefox. I don't seem to be able to run a lot of Adobe at all on my computer because of the Vista.

    This has happened

    Each time Firefox opened

    http://support.Mozilla.com/en-us/KB/installing+a+previous+version+of+Firefox

  • Qosmio F50-126: how to activate the integrated graphics card?

    Running Windows 7 on F50 - 126.
    After checking my specs on the site Web of toshiba, here are the details on my graphics card: -.

    Manufacturer: NVIDIA;
    type: NVIDIA; GeForce; 9700 M GTS supporting TurboCache; technology
    memory: 512 MB dedicated VRAM (up to 1 791 MB of total available graphics memory using the TurboCache™ technology with 3 GB of system memory)
    memory type: GDDR3 (800 MHz) video RAM (resp. RAM video and system memory combined)
    connected bus: PCI Express 16 x

    I want to know if I can turn on my integrated graphics card. I know that clicking on powersave suppose to turn off my 9700 m and go to the integrated card, but the laptop did not want it actually disabled.
    Like, watching a video or a game of battery the difference between "Powersafe" and "Balance" is not that much.

    The computer seems to work at full power.
    Because I remember when I had Vista installed, the game and used trolling videoes. But on windows 7 it doesn't. Anyone know how to activate the integrated card?

    I have my computer updated completely and everthing... How d I do not know if my card is turned on or off?

    Hi mate

    I'm a bit confused of m.
    Why?
    Because you ask about activation and deactivation of the graphics card (integrated).

    First of all, there is ONLY a single graphic chip!
    It s a GeForce 9700 M GTS graphics card.

    The graphics chip supports the 512 MB GDDR3 own (he dedicated video memory s) and it s is always available!

    In addition, the chip supports shared system memory. It depends on the available main memory!

    For example:
    * With the help of Win 32 bit system *.

    System memory: * 2 GB *.
    Dedicated video memory: 512 MB
    Shared system memory: 767 MB (using 3 GB of RAM you 1279 MB)
    TOTAL available graphics memory: 1279 MB (1791 using 3 GB of RAM)

    System memory: * 4 GB *.
    Dedicated video memory: 512 MB
    Shared system memory: 1279MB
    TOTAL available graphics memory: 1791 MB

    * With the help of Win 64 bit system *.

    System memory: * 2 GB *.
    Dedicated video memory: 512 MB
    Shared system memory: 767 MB
    TOTAL available graphics memory: 1279MB

    System memory: * 4 GB *.
    Dedicated video memory: 512 MB
    Shared system memory: 1791
    TOTAL available graphics memory: 2303

    As you can see the use of Win 64-bit and 4 GB of RAM would be better for the graphics card as the use of the file Win 32 bit with 4 GB of RAM

  • Need to know how to change the language on the screen on a Dell 922 printer/Scanner

    Need to know how to change the language on the screen of a computer Dell 922 / no disk

    You need to contact Dell technical support people or visit the Dell support online.

  • I need to know how to disable the test print cause everytime I turn on the printer prints featured.

    I need to know how to disable the test print cause everytime I turn on the printer prints featured.  It is hp1315 series.

    Hello

    If you want to disable printing test page, you must check with the manual of the printer. Try the steps from the following link:

    An alignment Page prints whenever the all-in-one is turned on or off or a print job is started
    http://h10025.www1.HP.com/ewfrf/wc/document?DocName=c01336397&cc=us&DLC=en&LC=en&product=1146336&tmp_track_link=ot_search

    I suggest you to contact HP for better support.
    http://h30434.www3.HP.com/T5/printer-all-in-one-software/BD-p/software

    Additional information:
    http://h20000.www2.HP.com/bizsupport/TechSupport/document.jsp?objectID=c01577197&lang=en&cc=us&ContentType=SupportFAQ&prodSeriesId=360489&prodTypeId=18972

    Printer in Windows problems
    http://Windows.Microsoft.com/en-us/Windows/help/printer-problems-in-Windows

  • How to analyze the image url in json?

    Hello

    I get the response from the server and crawled through json. And display it in the field

    Like name1 as:

    try {}
    labelField1.setText (jsonObject2.get("name1").toString ());
    }

    catch (JSONException e)

    {
    System.out.println ("JSONException Description");
    }

    Similarly, I want to make the image. How to analyze the url of the image and display it in the BitmapField?

    You must create a separate thread to extract the bytes of the image of the URL you have.

    You can use the following code to get the image to the server.

    public EncodedImage getImageBytesFromURL(String url){
            ConnectionFactory connFactory = null;
            ConnectionDescriptor connDescriptor = null;
            HttpConnection httpConn = null;
            InputStream inputStream = null;
            byte[] response = null;
            try {
                connFactory = new ConnectionFactory();
                connFactory.setConnectionTimeout(10*1000);
                connFactory.setAttemptsLimit(1);
                connDescriptor = connFactory.getConnection(url;interface=wifi);
                if (connDescriptor != null) {
                    httpConn = (HttpConnection) connDescriptor.getConnection();
                    inputStream = httpConn.openInputStream();
                    int responseCode = httpConn.getResponseCode();
                    if(responseCode == HttpConnection.HTTP_OK){
                        response = readStream(inputStream);
                    }
                }
            }catch (IOException e) {
    
            }finally {
                try {
                    inputStream.close();
                    httpConn.close();
                    inputStream = null;
                    httpConn = null;
                    connDescriptor = null;
                    connFactory = null;
                } catch (Exception e) {
    
                }
            }
            EncodedImage encodedImage = null;
            if(response != null){
                encodedImage = EncodedImage.createEncodedImage(response, 0, response.length);
            }
            return encodedImage;
        }
    

    Remember that this method should be in a background thread. Otherwise, your user interface crashes. The encodedImage that returns the method above can be easily converted to bitmap and set in your bitmapfield.

  • Hi I need to know how to expand the curves adjustment Panel. For example, the curves that I need to enlarge the graphic part, so I could show on a screen at the school. Thanks, Phil

    Hi I need to know how to expand the curves adjustment Panel. For example, I need to enlarge the graphic part so that I can view on a screen at the school and work from this Panel to expand. Thanks, Phil

    You can not. At least, not directly Ben Photoshop. For example, this can be done in Gimp and Photoline, and I had hoped that developers of Photoshop team would have done this allowance now. But no, we're still stuck with a tiny curved panel, which is a real shame, because in other applications, the user can be more precise with the curves.

    If you don't need to show close-ups during class time, use Zoomit in Windows, or turn on the Magnifier in the accessibility on a Mac option.

    https://TechNet.Microsoft.com/en-us/Sysinternals/Zoomit.aspx

  • I need to know how to check the serial number of the product on the installed machine?

    I need to know how to check the serial number of the product on the installed machine?

    You can go to Adobe.com and connect to the Adobe ID used to register the program.

    The serial number would be listed under Manage account > Products & Plans

  • I just bought a new computor. I got Lightroom 5.7 on the old computor and need to know how to download the program on my new computor. Thanks for any help you can provide.

    I just bought a new computor. I got Lightroom 5.7 on the old computor and need to know how to download the program on my new computor. Thanks for any help you can provide.

    Lightroom - all versions

    Windows

    http://www.Adobe.com/support/downloads/product.jsp?product=113&platform=Windows

    Mac

    http://www.Adobe.com/support/downloads/product.jsp?product=113&platform=Macintosh

  • I NEED TO KNOW HOW TO CHANGE THE BACKGROUND COLOR OF MY INDEX FINGER. HTML PAGE

    I need to know how to change the background color of my page index.html on Dream weaver cs6.

    With CSS:

    {body

    background-color: #FF0000;

    }

    Nancy O.

Maybe you are looking for

  • Thunderbird cannot find my existing e-mailaccount

    My old hard drive crashed. On the new (Windows 7) I downloaded and installed Thunderbird. When you try to use it, I get the screen with the question "do you want a new email address? I have one, so I click on the box "ignore this and use my existing

  • MacBookPro10, 2 stops every 1-3 weeks kernel panics

    Hey people, I get panics of the kernel since the summer on my MacBook Pro (retina, 13 inches, early 2013, i7 3 GHz, 8 GB RAM) with Mac OS X 10.10.5. Bought in may 2013. I can't know what event triggered the process, maybe the upgrade of 10.9 to 10.10

  • Pavilion 23-g013w All In One: RAM - what to buy?

    I'm looking to upgrade my 4 GB to 8 GB RAM.  But I do not know what look for when I buy. In addition, I did not jump the lid of the computer again.  I really want to do it until I have the game to install.  So, I don't know if there are two cards of

  • MyDatafinder Indizierung zu langsam?

    Hallo Gemeinde, ICH habe schon mehrmals versucht das zu losen, aber da mir dauernd was dazwischen Australia ist, konnte ich mich noch nicht damit beschäftigen Councellor. Und zwar: WIR schreiben mit LabView tdms-Dateien, die 24/7 laufen, da wir aber

  • By programming the auto scroll value multi-column list boxes?

    I have a Multi column list box control that I put off (for indication only) which is used to show the progress. When a profile is loaded in the list box if this profile causes the scroll bar to become active it's obviously disabled and if the user ca