table average

Hi all, I have two paintings as follows

1.

Select strc_id, strc_name, STRC_TYPE Glu;

o/p

STRC_ID STRC_NAME STRC_UOM

1               Roads                                                        Square Yards

2               Fields                                                         Square Yards

3 power each, linear feet

4 irrigation each, linear feet

5 navigation each, linear feet

6               Museum                                                    Each

7 storage each, linear feet

Measures (UDM) has their numbers defined as follows in the other table. That is to say

2. Select UOM_ID, UOM_NAME from UOM_TYPE;

UOM_ID UOM_NAME

1 each

Track 2 Miles

3 linear feet

4 miles

5 square yards

6 square feet

I wrote a query against the table 1 i.e STRC_TYPE who willl divide the STRC_UOM

Select STRC_ID, STRC_NAME, substr)

STRC_UOM,

InStr ("," |) STRC_UOM, ', ', 1, seq).

InStr ("," |) STRC_UOM | (",", "," 1, seq + 1)-instr ("," |) STRC_UOM, ', ', 1, seq)-1) STRC_UOM

of STRC_TYPE, (select seq level of the double connect by level < = 100000) seqgen

where instr ("," |) STRC_UOM, ', ', 1, seq) > 0 order by STRC_NAME;

O/P:

It divides as follows of the UOM_NAME

STRC_ID STRC_NAME STRC_UOM

1               Roads                                                        Square Yards

2               Fields                                                         Square Yards

3               Power                                                         Each

4.              Power                                                         Linear Feet

5.              Irrigation                                                      Each

6 irrigation linear feet

....

....

but now I would create an intermediate table and wait for the exit as follows and need there should be a constraint of integrity on the staging table.

Expected results

Table_ABC

STRC_ID STRC_NAME UOM_CODE (this is the pseudonym of UOM_ID in table 2 above)

1 5 roads (the UOM_ID is 5 of the table above for square yards)

2               Fields                              5

3               Power                             1

4.              Power                             3

5 irrigation 1

6 irrigation 3

...

...

can you please suggest me how to write code for this requirement.

Thank you

with

strc_type as

(select 1 strc_id, strc_name 'Roads', 'Square Yards"uom of union double all the)

Select 2, 'Fields', 'Square yards' double Union all

Select 3, 'power', 'Each, linear feet' from dual union all

Select option 4, 'Irrigation', 'Each, linear feet' from dual union all

Select 5, "Navigation", "Each, linear feet" dual Union all

Select 6, 'Museum', 'Each' from dual union all

Select 7, 'Storage', 'Each, linear feet' of the double

),

uom_type as

(select 1 uom_id, 'Each' uom_name of all the double union)

Select 2, 'Lane Miles' from dual union all

Select 3, 'The linear feet' from dual union all

Select option 4, 'Miles' from dual union all

Select 5, "Square Yards' from dual union all

Select 6, 'Square Feet' from dual

)

Select row_number() on strc_id (st.strc_id, st.strc_name),

St.strc_name,

UT.uom_id uom_code

from (select strc_id,

strc_name,

-case when instr (Glu, ',') > 0

then substr (Glu, 1, instr (Glu, ',') - 1)

unit of measure to another

unit of measure of end

of strc_type

Union of all the

Select strc_id,

strc_name,

LTRIM (substr (UOM, InStr (GLU, ',') + 1))

of strc_type

where instr (Glu, ',') > 0

) st.

uom_type ut

where st.uom = ut.uom_name

STRC_ID STRC_NAME UOM_CODE
1 Roads 5
2 Fields 5
3 Power 1
4 Power 3
5 Irrigation 1
6 Irrigation 3
7 Navigation 1
8 Navigation 3
9 Museum 1
10 Storage 3
11 Storage 1

Concerning

Etbin

Tags: Database

Similar Questions

  • TestStand table average

    Hello community,

    Using 32-bit Teststand 2014

    I have a one-dimensional array with a size ten (Array [10]). I want to be able to take an average of this table in Teststand. Using an expression of the statement, I am able to do digital = ((Array [0] + tableau [1] +...)) Array [10]) / 10), but this is tedious. Especially, if I have a table for more than a decade.

    In Teststand, is there a mathematical operation or another way to get the middle range?

    I don't think it's possible in a single expression.  Consider the attached example that does it in a single step.

    Hope this helps,

  • Tables average Sub

    Hello

    I try to have a vi that receives an array of file, and then built the sup boards (according to the FPS/mid-range everything), then take the average, detects the difference between each data point and count the number of times where the difference is greater than the threshold. Please see the attached file - my block diagram.

    At this point, the vi is running but the is a bug in the code that I can't find :-(.

    When I run it on a counter of data sample returned ~ 350 where it suppose to be only 3.

    I will appreciate if you can take a look.

    Thank you

    PS.

    I am happy to download the vi and an example of data file if necessary.

    simply_me,

    You take a subset of the table, get the average which seems ok.  But then understand you the difference between the average and all you started with instead of the subset of the array that allowing you to calculate the average.  Guess you have to do this.

  • creating a table/average question

    I'm new to labview and I have problems to understand how to create a table.

    I use an Arduino Uno as my DAQ and when I take an anolog measure I've seen a lot of fuctuation to my measure. I know with arduino, you can perform with an average simple by using the function "Get a finished sample of Analog", but I know that I not be using an Arduino in the long term and trying to figure out the right way to do it.

    When I have on average with the Arduino IDE I usually code that looks like this:

    float analogsum = 0;

    for (int i = 0; i)< 10;="">

    analogSum += analogRead (analogPin); where analogRead converts the analog value to a value\ digital 10-bit

    }

    average = analogSum/10;

    I am trying to create this same feature in LabView. The only way I can imagine the analog value of each iteration, in summary would be to store each value in a table, then add them together and divide by the number of iterations in my loop for.

    How would I do this in Labview?

    Hi awwende,

    show all 3 suggestions above:

    You really should go LabVIEW101 the ni.com site to learn the fundamentals of LabVIEW!

  • Selective table average

    Hello

    I have a 2D chart. The following code generates a random array of 3 x 3.

    I want to get the mean (or average) only values greater than a set value (user-defined) in the table.

    Could someone help me.

    I tried to use a "superior to", type the case statement, but when I do this, for less than the value set elements a zero is placed in a new table. This changes the average because it includes the zero element.

    Almost, I need to create a table 1 d of the righteous elements above the value of the definition of the matrix 3 x 3.

    I want to adapt what I learn here much larger bays of 400 x 400 and upwards.

    Any help would be appreciated.

    Thank you

    K

    Attached to the LV 8.6. Please note that I have not downconvert another example since it is my humble opinion, nothing is done for you.

    Norbert

  • Save and write data from table to table - easy

    Hello

    I got this system delivered to me. I'm new to LabView and just save the data from the table "average voltage" (inside the while loop) to do some additional testing of our product.

    I will like to do similar to this.

    (1) save in excel file.

    (2) save only when a button button and save it then 5 ilteration.

    (3) save and manipulate the data, so it is displayed in 6 columns (each LED 1) instead of 1 long colum.

    I tried different things with structure business T/F, which resolved the buttom-request. But I am in doubt I should use, writing to the file of the measurement or write to us to the worksheet (by using labview 15.0)-delimited according to my offer the best possible?

    He also seems to be too much to handle when I try to write in txt file, because it pops up with and error that I do not know how to fix, but it says this:

    Error-200279

    Possible reasons:

    The application is not able to cope with the acquisition of equipment.

    Increase in the size of buffer, most frequently the reading of data or by specifying a fixed number of samples to read instead of reading all available samples would correct the problem.

    Property: RelativeTo

    Corresponding value: current playback Position

    Property: Offset

    Corresponding value: 0

    Task name: analog channel

    Thanks in advance

    I agree with Taki, but want to make some additional remarks:

    • LabVIEW is a data flow language.  Think of the "flow" of your data.  You talk about "save only when a key is pressed" and a finite set of data.  You are collecting before the press the button and everything just do not save?
    • Data are collected at some rate, and likely, you don't want to "Miss" data points.  This means that you shouldn't do anything in the loop of the Collection that takes a long time.  If your recovery rate is low and your treatment is fast, you can have everything in a single loop.  Otherwise, to use the technical stream (producer/consumer is a good) to process the data in a single loop in parallel with the collection in a loop independent (and asynchronously).
    • How do you write your data?  You want to write "on the fly", as it is, or can you wait, collect everything, any format and then write it "all at once"?
    • What do you mean by 'save the file in Excel?  Do you mean a 'native' Excel file, one with the extension .xls or .xlsx?  Do you mean a Comma-Separated Variable (.csv) file this reading peut of Excel (and, indeed, usually registers itself to read, change the icon of the .csv files to "look like" it is really an Excel file)?  If the first case, I recommend using the report generation tool.  But for the latter, you can also use write delimited spreadsheet, which can be easier to use.

    Bob Schor

  • Manipulation of Image data display

    Hello

    So I'm a first time LabVIEW user and I am struggling with programming graphically the project I have to do...

    The type of data, I work with are bitmap images.  Basically, a single image is there (along the y-axis) data and length of wave (along the x axis).  Each successive image shows these data for a certain value of x.  Thus, all images in the folder hold a data cube (x, y, wavelength).

    I want to do is create a VI to display these data nicely.  I want to average all wavelength data (which are in rows) to a point given y in a given image (point x) and then make sure the average value of table in a table to index x 2D, y.

    I would like for this 2D table correspond to a bitmap "average."  And if you click on a pixel/cell in this table/image (which is formed by an average of all wavelength for each pixel data), then a spectral wavelength data diagram is plotted in a separate chart.  In this way, you see the overall picture, but if you are interested in a certain point you can graphically see the raw data of wavelength after clicking on this point.

    For now, I created test data.  I run an Excel Macro to combine all data into a great file.  Each 'image' is three lines and three wavelengths by rank.  In the attached excel file, you see the 9 lines because I put 3 images together one after the other.  The problem is, LabVIEW, I try to create the new 2D array which is the average of image, but I'm not sure how to extract the data in column "means" in this new matrix.  Because each "image is 3 lines long, I need to take the first 3 values in the 4th row in the data table (average values) and do as my 1st column, then take then 3 values in column 4, making the 2nd column, etc..".  The new 2D array should therefore all 7s.

    I'd appreciate any help to go on this task, but also a response to the problem, I am currently facing.  If I didn't explain that well, let me know and I will clear up everything that was confusing!

    It's generally a bad idea to have data sample degenerate as in this case, where each item is 7. It does not easily check if the correct order and the conversion is achieved. (Also, your second loop is yabba of LabVIEW. )

    Try something like the picture shows... (of course the constant diagram must be replaced my calculations based on the size of the input array).

  • Last row of data in a 2d array is not written, but is written using VI is next time

    Hi all

    I have problems with writing the data. I'm taking some statistics of a bunch of files .tdm and their record in a master file. I have all this down, but the last part data is not written using the program first. When I run the program immediately after, the last line of data from the first run is the first line of the recorded data. I guess that the buffer that contains the table is not be emptied at the end of the program, but I don't know how to "clear" a Board or if such a method exists (I know it does for queues, but tables are supposed to be simpler). I tried including a boot read before hand for loop because I thought that this was an option disabled by a question. This does not resolve the issue. For example, here is what may look like the data:

    1st round:

    A

    B

    C

    D

    2nd round:

    E

    A

    B

    C

    D

    I have included my code and if you see something I can do to fix this problem, please let me know.

    Thank you for your time,

    Seth

    My guess is the race condition critical you created using local variables.

    You have local variables of min table, average, max table, cycle count and names of channel that you use to write to a file.  However, the terminals are readily available that you can branch wires directly from

    The problem is the race condition.  Your local variables will be read very early in the iteration of the loop For, before any valid data was written to the terminals referring to these people.

    Don't use local variables, simply use the son.

  • His doubts stats

    Hi all

    Read the http://210.82.95.68/DOCS/11gR2/server.112/e16638/stats.htm#CIHGDEEI in this moment to collect statistics. Have some doubts in that.

    1. what exactly is this 'Gradually modified Table' average collects stats once in a week or a month.
    2. how to determine the sampling percentage say 10% or 30% for the collection of statistics.

    Thank you
    Baskar.l

    1. the tables ' gradually updated the ' are those who are not "substantially amended". (Please read the entire 13.3.3).
    Thus, a table that contains, say, only 5-15% being changed, lines can be called gradually "changed." A table that has, say, 40% to 100% of lines are deleted and reloaded or updated day might be called significantly "changed."
    The thresholds are for you to determine.

    2. the question of whether you should use 10% or 30%, it is for you to determine. It really depends the nature of the changes to the table, the nature of queries against the table and the criticality of the statistics. A large table where the nature of the changes are predictable (for example a SALES table where the mix of new sales PRODUCT_CDs is usually the same each month or quarter), can do with a smaller sampling. A table where the changes are unpredictable (such as a table of 'zero/staging' where 80-100% of lines are perodically reloaded with new PRODUCT_CDs for a new cycle of batch processing) may well need to 100% sampling.

    Hemant K Chtale

  • His stats in Cube operation log

    Hello

    No one knows what made the "STAT_COMP_TIME" operation that is recorded in the table average Cube_Operations_log?

    "TOTAL_TIME" stats in the table Cube_Operations_log to one of my questions is about 6 seconds, but 'STAT_COMP_TIME' is 7 seconds.

    Thank you

    They will be deleted the next time that your dimension is compiled. This occurs automatically when you hold the dimension, but not, apparently, when delete you it. Try this

    exec dbms_cube.build(' "YOUR_TIME_DIM" USING (COMPILE) ')
    
  • Stats gathering on index.

    Hi all

    Why it is not possible to collect statistics on index in parallel, as mentioned in Metalink Note: 166215.1

    What is different about the collection of statistics for tables and index? What is the internal mechanism for index stats collection using dbms_stats and why it is not possible to perform parallel to compare indexes in the table?

    -Yasser.

    Why it is not possible to collect statistics on index in parallel, as mentioned in Metalink Note: 166215.1

    It is said, if DOP is not specified, the computer runs in the series or ANALYZE. If you specify dbms_default.degree, he returned to parallel as specified from your instance settings.

    Object Stats========Number of rows in the tables being accessed Number of blocks allocated to the table Average table row length Number of distinct values for a column Number of nulls in a column Number of leaf blocks allocated to indexes Number of leveles in the B-Tree Clustering factor - how the order of the index matches the order of the table rows
    
    Index statsNumber of leaf blocksLevelsClustering factor
    

    Take a look at this note: How to switch from ANALYZE to DBMS_STATS - Introduction - 237293.1

  • Mobile tables 1 d average

    Hello world!

    I'm new to the fourms here and I have some difficulties in writing a VI that allows me to calculate a moving average of a waveform continuously sampled (table 1).

    Here's my situation: I am trying to write a VI that duplicates the MEANS of Tektronix o-range mode.  For example, I can run the scope in sample mode, then tell him on average 4 scans and it displays an average waveform.  I think that it works by using a moving average of summons for the first three scans, then when it gets to the fourth, it transforms average exponential for the fourth.  So I think she repeats, but I'm not sure.  Here is a Web of Tektronix page: http://www.tek.com/support/faqs/how-does-scope-calculate-average-when-you-are-ave-mode

    I tried this for a few weeks without result.  Here's a VI I wrote that I thought was correct, but it seems to make a simple smooth of the continuous rather than duplicate the medium function of the bezel-o.  I would gladly take suggestions.  Thanks in advance.


  • Average in the table

    I have a table in which I get some readings. I want to calculate the average of the cells that are displayed in the image. (See the image attached)

    Thanks in advance.

  • average of consecutive items to table

    HI, I want to find the number of consecutive items in table, calculate the average of each segment row, output should be towing tables as shown in the picture attatched.

    Array2 is the number of consecutive items in each segment.

    array3 indicates the average of the consecutive elements in each segment.

    Your average of the 11,12,13 and 21,22 are incorrect...

    Use a loop For iteration in the first table and shift registers allows you to keep a table of previous values in memory. Use this table to previous values to compare the current value to the previous. If there is a deviation of more than 1, the average of the output array and disable it. Write the new value in the registry to offset.

    Here's what I mean: (it can be cleaned up a bit, but it works)

  • Average table in a recursive way

    Hello

    I need a way to calculate the average of continuous 3 x 10 table without doing the math on all values each time.

    I have blocks of 3 x 10 table as input (incoming continuously). First round, t1, I want to take the average of each line, so 3 x 1 table called 'current average '. It will be inserted into a 2d array called "all means".

    The next iteration, t2, I'll have another block of 3 x 10 of incoming data. I will start again the average and insert it into "all means". Now, I want to take the average of the lines of "all means", so that the average of all the data that I currently have, if the average of t1 and t2.

    This method works, except that since I am constantly introduce into array, the size increases and slows everything down.

    Ideally, I want to have only 2 columns of table data at a point in the "all means". The old average calculated previously and the new block of data. So I need a way to save the "means old" and replacing it with the data in a 2d array.

    I have attached a very simple doagram of what I have... it would be in a loop running continuously.


Maybe you are looking for