Draw lines based on values from database

I want to draw the line based on the data from database.

Number of lines will be the number of records in the query.

line length will be based on the value of the column in centimetres.

by example, if the query selects 3 folders 3 lines will be drawn.

If the first record column value is 5 then 5 cm line will be drawn.

Thank you.

Please find the sample report and xml.

Kaya.

Tags: Business Intelligence

Similar Questions

  • How to fill the area of the bean with values from database

    I have a box of bean shaped which act as last autocomplete, I want to fill it with dynamic values of database, any help will be appreciated.
    http://Forms.PJC.Bean.over-blog.com/article-16369664.html "It is the example that I am"

    Best regards.

    An example with the EMP table:

    DECLARE
      cursor cur is select empno,ename from emp;
    BEGIN
      -- initialise the ComboBox twin values --
      for c in cur loop
       if c.empno is not null then
        Set_Custom_Property('BL.BEAN',1,'ADD_TWIN',c.empno||','||c.ename);
       else
        Set_Custom_Property('BL.BEAN',1,'ADD_TWIN_NULL',c.empno||','||c.ename);
       end if ;
      end loop;
      Set_Custom_Property('BL.BEAN',1,'ADD_TWIN','[END_DATA]');
      Set_Custom_Property('BL.BEAN',1,'SET_ALIGNMENT','right');
    END;
    

    François

  • Treatment of Null values from database

    Hi all

    I created a form very simple record insertion using dreamweaver for an online store.

    According to some products, a field can be left blank. Problem is when I try and treat this this course comes with an error. "The 'colour_1' column cannot be null.

    How can I ignore it for some fields. And this creates a security risk?

    Please find the below coding.

    See you soon

    Tom

    <? php require_once('.. /.. / Connections/connProduct.php');? >

    <? PHP

    If (! function_exists ("GetSQLValueString")) {}

    function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

    {

    If (via PHP_VERSION < 6) {}

    $theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;

    }


    $theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);


    Switch ($theType) {}

    case 'text ':

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "long":

    case "int":

    $theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';

    break;

    case "double":

    $theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';

    break;

    case "date":

    $theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";

    break;

    case "set":

    $theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;

    break;

    }

    Return $theValue;

    }

    }


    $editFormAction = $_SERVER ['PHP_SELF'];

    If (isset {}

    $editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);

    }


    If ((isset($_POST["MM_insert"])) & & ($_POST ["MM_insert"] == "form1")) {}

    $insertSQL = sprintf ("INSERT INTO product (product_ID, product_Name, product_Title, product_Height, product_Width, extra_Info, product_Price, delivery_Price, colour_1, colour_2, colour_3, colour_4, colour_5, colour_6, colour_7) VALUES (%s, %s %s %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", ")

    GetSQLValueString ($_POST ['product_ID'], "int").

    GetSQLValueString ($_POST ["'product_Name"], "text").

    GetSQLValueString ($_POST ['product_Title'], "text").

    GetSQLValueString ($_POST ['product_Height'], "text").

    GetSQLValueString ($_POST ['product_Width'], "text").

    GetSQLValueString ($_POST ['extra_Info'], "text").

    GetSQLValueString ($_POST ['product_Price'], "text").

    GetSQLValueString ($_POST ['delivery_Price'], "text").

    GetSQLValueString ($_POST ['colour_1'], "text").

    GetSQLValueString ($_POST ['colour_2'], "text").

    GetSQLValueString ($_POST ['colour_3'], "text").

    GetSQLValueString ($_POST ['colour_4'], "text").

    GetSQLValueString ($_POST ['colour_5'], "text").

    GetSQLValueString ($_POST ['colour_6'], "text").

    GetSQLValueString ($_POST ['colour_7'], "text"));


    @mysql_select_db ($database_connProduct, $connProduct);

    $Result1 = mysql_query ($insertSQL, $connProduct) or die (mysql_error ());


    $insertGoTo = 'index.php ';

    If (isset {}

    $insertGoTo. = (strpos ($insertGoTo, '?'))? « & » : « ? » ;

    $insertGoTo. = $_SERVER ['QUERY_STRING'];

    }

    header (sprintf ("location: %s", $insertGoTo));

    }


    @mysql_select_db ($database_connProduct, $connProduct);

    $query_rsProduct = "SELECT * FROM lanterns.

    $rsProduct = mysql_query ($query_rsProduct, $connProduct) or die (mysql_error ());

    $row_rsProduct = mysql_fetch_assoc ($rsProduct);

    $totalRows_rsProduct = mysql_num_rows ($rsProduct);

    ? >

    <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""

    " < html xmlns =" http://www.w3.org/1999/xhtml ">

    < head >

    < meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"

    < title > Untitled Document < /title >

    < / head >


    < body > < form action = "" method = "get" > < / make > "

    < do action = "<?" PHP echo $editFormAction;? ">" method = "post" name = "form1" id = "form1" >

    < table align = "center" >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > product name: < table >

    < td > < input type = "text" name = 'product_Name' value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > product title: < table >

    < td > < input type = "text" name = "product_Title" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > product height: < table >

    < td > < input type = "text" name = "product_Height" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = 'nowrap' align = 'right' > the product width: < table >

    < td > < input type = "text" name = "product_Width" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > additional Info: < table >

    < td > < input type = "text" name = "extra_Info" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > product price: < table >

    < td > < input type = "text" name = "product_Price" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > delivery price: < table >

    < td > < input type = "text" name = "delivery_Price" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > color 1: < table >

    < td > < input type = "text" name = "colour_1" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > color 2: < table >

    < td > < input type = "text" name = "colour_2" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > color 3: < table >

    < td > < input type = "text" name = "colour_3" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > 4 color: < table >

    < td > < input type = "text" name = "colour_4" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > 5 color: < table >

    < td > < input type = "text" name = "colour_5" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > 6 color: < table >

    < td > < input type = "text" name = "colour_6" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > 7 color: < table >

    < td > < input type = "text" name = "colour_7" value = "" size = "32" / > < table > "

    < /tr >

    < tr valign = 'of basic">

    < td nowrap = "nowrap" align = "right" > < table >

    < td > < input type = "submit" value = "Insert file" / > < table >

    < /tr >

    < /table >

    < input type = "hidden" name = "lantern_ID" value = "" / > "

    < input type = "hidden" name = "MM_insert" value = "form1" / >

    < / make >

    < p > < / p >

    < / body >

    < / html >

    <? PHP

    mysql_free_result ($rsProducts);

    ? >

    Thread has been moved to the Dreamweaver application development forum, which deals with PHP and other issues aside server.

    sellador315 wrote:

    According to some products, a field can be left blank. Problem is when I try and treat this this course comes with an error. "The 'colour_1' column cannot be null.

    How can I ignore it for some fields. And this creates a security risk?

    In your database, change the definition of the column in which you might want to leave it empty with null. You can do this easily in phpMyAdmin by selecting the column you want to change on the Structure tab and clicking Change icon. Then select the Null checkbox, as shown in this screenshot:

    Allowing a column store null values is not a security risk.

  • You want to varify each form field with the value from database?

    Hello Experts,

    I have to implement a feature that will confirm the change for each text field on the form.

    Scenario:

    I have a form with several fields of database tables.

    We have set the indicator for each column of each table to Yes or no in a master table to access.

    When users navigate to any text field in any database block, procedure, or a function will varify that access is granted for the amendment of this column.

    If the access flag is set to yes, user can change. otherewise fast with the message, you are nor allow to change this field.

    I don't want to call this procedure and a function in each field.

    Also, if in the future if a new field will add to this form, there is no need to change in the code or we should not require to remember to check the indicator of access to this column.

    Please help me.

    Thank you

    Yoann

    NEXT-KEY is always triggered, then you can try to put that code in WHEN-VALIDATE-ITEM trigger. This way you can navigate on this field if it's empty DB, but can not force the user to enter data in a new record. Alternatively, you can ask again priviledge change data in your trigger KNI.

  • Generating lines based on the value of the column?

    Hi all

    I would like to know if there is a function that can help me in creating lines based on a column value and, if so, which. I'm on version 11.2.0.3.0

    for example, I have these data in the table:
    ID O A C
    1 5 3 5
    2 9 2 3

    Where ID is an identifier unique record and column C contains the number of records, I would have returned for this ID. In this example, the folder with the ID 1 would be repeated 5 times and the folder with the id 2 would be repeated 3 times. The result would look like this:

    ID O A C
    1 5 3 5
    1 5 3 5
    1 5 3 5
    1 5 3 5
    1 5 3 5
    2 9 2 3
    2 9 2 3
    2 9 2 3

    Column C contains the number of repetitions Records and is defined as a positive integer > = 1.

    Of course, in real life, the table contains (at this time) 41 M number of records and the value of C can vary between 1 and 554, hardcode on the example above values is not possible.

    Any pointers in the right direction are much appreciated.

    Kind regards
    Lennert
    SQL> ed
    Wrote file afiedt.buf
    
      1  with t as (select 1 as id, 5 as c from dual union all
      2             select 2, 3 from dual)
      3  --
      4  select id, c
      5  from   t
      6  connect by level <= c
      7          and id = prior id
      8*         and prior sys_guid() is not null
    SQL> /
    
            ID          C
    ---------- ----------
             1          5
             1          5
             1          5
             1          5
             1          5
             2          3
             2          3
             2          3
    
    8 rows selected.
    
  • State of color lines based on a value in the same row

    I would like to color report lines based on a value in the same row.

    For bolting with the table 'EMP ':

    I would like job = MANAGER and Red work = CLERK to be green etc etc.

    The other example I found was the possibility of a single color either the nail or the default color.

    I'm looking for a way to do multiple colors.

    Hello

    In the model line, you can use #1 #, 2 # #, etc. to indicate where a field in the report should be released. It doesn't have to be clear - that is to say, you can use it in style tags if you wish.

    So take a query such as:

    SELECT EMPNO,
    ENAME,
    DEPTNO,
    DECODE(DEPTNO, 10, 'green', 20, 'red', 30, 'cyan', 'white') BG_COLOUR
    FROM EMP
    

    You get the column 1 = empno, 2 = ename, 3 = deptno and 4 = bg_colour. In the model line, you can then do:

    Before defining lines (implements the table):

    <table>
    <tr><td>ID</td><td>Name</td><td>Dept</td></tr>
    

    After setting (farm table) lines:

    </table>
    

    Model 1 (used for all lines) line:

    <tr style="background-color:#4#;"><td>#1#</td><td>#2#</td><td>#3#</td></tr>
    

    Then, for each row, the color that has been calculated by using the DECODE function is used in the style tag for color the background of the whole line.

    How to determine the colors, it's you. I used DECODE here, but you can use a field on the DEPT table to hold and use it in your SQL statement.

    Andy

  • Web Forms: Deleting line based on the value of a specific column

    Hello

    I have an online form in which I want to apply delete missing on the ranks, but only on the value of the first column. So, if the first column is #missing I want the deleted row, even if the columns are given in it.

    Is it possible to do this?

    I'm on ver 11.1.2.2 Hyperion Planning

    Shehzad

    Published by: shehzad k on January 24, 2013 11:51

    Unfortunately, no. There is no way to add the delete line based SOLELY on the existence of a value in the first column. It would be nice to see some of the more advanced features "conditional delete", we en flies over to the planning of the entry forms.

    You can do the "clumsy" things with data validations where you gray - out ranks in view of the existence of a value in a particular cell, however while this might SUGGEST that the user should not enter data in a particular line, it would not PREVENT to do so.

    We have seen many improvements in form lately with the introduction of data validations. I hope the momentum continues.

    -Jake

  • Insert a line in a circle from centrepoint and the angle in degrees

    Hello world

    I want to ride a line based on two values, as I arrived, the Center (x, y) and the angle in degrees from the top of the circle, is that possible? (see the attached picture for more details)

    Of course, just draw a line from (x, y) to (x + radius * cos (angle), y + radius * sin (angle))

    Angle must be expressed in radians (so angle = 2 * pi * angle in degrees)

    In fact you will probably have to faff about a bit for that angle you set, so the equation of high I think it would actually (angle 90) instead of the angle. Try it and see what it does.

  • When possible in Oracle Forms to insert a second line based on 1st row, so why not in the ADF?

    Mr President

    When possible in Oracle Forms to insert a second line based on 1st row, so why not in the ADF?

    The user just enter data in the Module of sales in one line of a Bill as below

    and it is displayed in two rows in financial Module.like below how to proceed in the ADF.

    You can see that invoice line contains the sales tax and the gross sales amounts, then it is posted to the financial Module above two lines.

    How to make ADF

    Respect of

    What I realized, this is:

    -You have a table in you screen.

    -You call CreateInsert 2 times to create 2 rows at the same time.

    -You will enter value in a specific column (c1) line1

    Looking for the value that you entered in row1 can be completely copied in the same column (c1), but in line2. is this correct?

    If so try to do the following:

    1. in the table inputText (c1) column set autoSubmit = true and setValueChangeListener to a method in backbean

    
           
    
    

    2. in the inputTextValueChangeListener method to write this code

      public void inputTextValueChangeListener(ValueChangeEvent valueChangeEvent)
      {
        DCIteratorBinding tableIter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("tableIteratorName");// write table iterator name from pageDef.
        for (int i = 0; i < tableIter.getViewObject().getEstimatedRowCount(); i++)
        {
          ViewRowImpl myRow = (ViewRowImpl) tableIter.getRowAtRangeIndex(i);
          EntityImpl entityImpl = myRow.getEntity(0);
          if (EntityImpl.STATUS_NEW == entityImpl.getEntityState())
          {
            System.out.println("New row found");
            myRow.setAttribute("AttributeName", valueChangeEvent.getNewValue());// write attribute name
          }
        }
      }
    

    3 - Add inputText id in the partialTrigger table

    
    

    4 - pageDef. Set of table iterator rangeSize = "-1".

  • Discover the lines of odd values

    Oracle 11.2.0.1

    Windows

    create table marks)

    number of rollno,

    Number of the object,

    Mark VARCHAR2 (3)

    )

    /

    insert into values of brands (1,1,40);

    insert into values of brands (1,2,35);

    insert into values of brands (1,3,35);

    insert into values of brands (1,4,38);

    insert into values of brands (2,1,10);

    insert into values of marks (2.2, "AB");

    insert into values of brands (2,3,50);

    insert into values of brands (2,4,50);

    insert into values of brands (3,1,55);

    insert into values of brands (3,2,50);

    insert into values of brands (3,3,44);

    insert into values of brands (3,4,4);

    insert into values of brands (4,1,78);

    insert into values of brands (4,2,45);

    insert into values of brands (4,3,84);

    insert into values of marks (4.4, "AB");

    insert into values of marks (5.1, "AB");

    insert into values of marks (5.2, "AB");

    insert into values of brands (5,3,50);

    insert into values of brands (5,4,10);

    > select * from brands;

    ROLLNO TOPIC MAR

    ---------- ---------- ---

    1 1 40

    1 2 35

    1 3 35

    1 4 38

    2-1-10

    2 2 AB

    2 3 50

    2 4 50

    3 1 55

    3 2 50

    44 3 3

    ROLLNO TOPIC MAR

    ---------- ---------- ---

    3 4 4

    4 1 78

    4 2 45

    4 3 84

    4 4 AB

    5 1 AB

    5 2 AB

    5 3 50

    5-4-10

    20 selected lines.

    Power required:

    ROLLNO TOPIC MAR

    ---------- ---------- ---

    2 2 AB

    3 4 4

    4 4 AB

    Business rule:

    We need to identify these roll numbers that are:

    1 AB brands in a single subject.  If the student is AB (Absent) in more than one subject then it is unnecessary.

    2. If there is high marks then also these lines flucuation, as in example above, topic 3 4 roll number, there are only 4 points, while he had good grades in other subjects.

    3. we need extract the lines which the corresponding brand values have values of very high/low i.e. assume a number of specific role is there which have markings about 20-30 but in a subject, he got in circulation 80-90, even as there are a number of role, one subject, he got 10-20 While in the other topic, he got 70-80.

    So I do not know how to identify these rows.  Table have about 15000000 rows.

    Even I don't know what is the technical name for this problem, otherwise I would have to search the forum.

    Is not a student or a home project, is our real time requirement, because usually, when I see something like student, roll number, brand etc. in question, it is considered as project for students.

    Kindly help me.

    Thank you.

    user12050217 wrote:

    Thank you very much for your answer.  As always, it is really useful.

    > Maybe if you mean no more than '1' which would then be ok.

    Yes Sir, that's correct.  We are the lines where the student is absent from more than one topic.

    > You have Roll No. 3 with no AB at all, still rule 1. States 'AB marks in 1.

    Roll No. 3 is necessary output because it has 4 brands in the 4th topic while he got good grades in other subjects.  So that's the big difference with other brands of subject.

    > That means 'large fluctuation '?  There is no logical function for 'high fluctuation.  It must be clearly defined.

    Thank you so much for asking the question.  Fluctuation really means, if there is any subject whose marks are not in the range with another topic then this line is to have high/low difference.  For example in the other topic there are 30,35,40 brands exist but in 4th or any other he got say 3 or 5 or 0, then it is the line that have 'strong fluctuation' it please.

    I think it must be a column in the table that will contain a value from 0 to 9 for lines that have fluctuations.  Then it will be probably easier to select higher values of fluctuation; something like:

    Select * brand where fluctuations = 9; means here are the first few lines required, these lines have a difference higher for a topic to other brands of subject.

    Once again thank you Mr President.

    You have not yet responded to what 'large fluctuation' is.

    Computers do not work on subjectivity, they work on fixed logic.  Tell me that a student who scored 5 in a subject and 20 and 30 on two other subjects has strong fluctuation, but another person may say: "well, the marking is on 500, so 5, 20 and 30 are all a note very low and not really important fluctuation."  That is why we must be clear, what you mean by 'high fluctuation'.  As in my example, I specified it as the ratio between the minimum and maximum marks in less than 20%, but you have to tell us what the actual logic is desired; not a fluffy subjective idea.

    What are the changes from 0 to 9?

    Requirements must be clear in the calculation, not the ambiguous words.

    How about something based on average scores?

    SQL > ed
    A written file afiedt.buf

    1 Select rollno, subject, brands
    2, min_mark, max_mark, round (avg_mark) as avg_mark
    3, case when brands! = "AB" then round(marks/avg_mark,2) 0 otherwise fine as mark_ratio
    4 of)
    5. Select rollno
    6, subject
    7, brands
    8, sum (case when brands = 'AB', then 1 else 0 end) on (rollno partition) as sum_AB
    9, min (case when brands! = 'AB', then other brands trailing null) on (rollno partition) as min_mark
    10, max (case when brands! = 'AB', then other brands trailing null) on (rollno partition) as max_mark
    11, avg (case when brands! = 'AB', then other brands trailing null) on (rollno partition) as avg_mark
    brands m 12
    13       )
    where the 14 sum_AB<=>
    15 * and min_mark/max_mark< 0.8="" --="" 20%+="" difference="" between="" min="" and="" max="">
    SQL > /.
    SUBJECT OF ROLLNO MAR MIN MAX AVG_MARK MARK_RATIO
    ---------- ---------- --- --- --- ---------- ----------
    2 1 10 10 50 37.27
    2 2 10 50 37 AB 0
    2 3 50 10 50 37 1.36


    2 4 50 10 50 37 1.36
    3 1 55 4 55 38 1.44
    3 2 50 4 55 38 1.31
    3          4 4   4   55          38         .1
    3 3 44 4 55 38 1.15
    4 1 78 45 84 69 1.13
    4 2 45 45 84 69.65
    4 3 84 45 84 69 1.22
    4 4 45 84 69 AB 0

    12 selected lines.

    If this isn't what you want, then you need to explain why, clearly and concisely, giving the reasons and logic.

  • Unable to display data from database using persistence mobile A-team

    Hello

    We use the accelerator of persistence for Mobile A-team with application of the MAF. We built the REST services based for CRUD operations on a table. We are unable to use the POST CREATE service by application of the MAF. We tried using saveTask and addTask data control methods it generates automatically. Although it is saved locally to the iterator of data control, it doesn't push the data from database. We tried to test the service REMAINS independent and works well.

    Can anyone help regarding if lack us measures in the same?

    Thank you

    Vignesh

    Vignesh,

    Indeed, there are two issues here:

    -the attributes of the payload are different

    -the structure of the payload is different, the GET request has an attribute "Task" that returns an array, the POST request submitting a single object through the attribute "taskDetails.

    By default, the accelerator of persistence assumes that the POST request has the same payload structure and attributes as the GET request that you used to 'discover' the data objects.

    However, you can easily change this as follows:

    -To add additional attributes required in the POST, you should restart the wizard REST-JSON directly access the data object attributes screen and click on the button 'add an attribute '. Add each attribute you need in the POST request and the attribute name to the value required in the POST request payload. No matter that this attribute of the payload does not exist in the payload GET, it will be ignored during extraction of the tasks.

    -To fix the second issue, you must change the persistence - mapping.xml:

    -go to the createMethod task

    -Remove the payloadElementName attribute

    -Add the payloadRowElementName attribute and set the value to "TaskDetails.

    It's a little strange that you post in order to get other attributes, it is there another resource GET that returns all attributes for a task?

    In addition, you cannot derive columns audit as created_by on the server-side? It's a bit unusual set these values at the level of the customer.

    Steven.

  • multi line based on LOV table insert

    SEQ / / desc Ref number value of the option of lov to insert
    15DESC 1011
    16DESC 2022
    17033
    18044
    19055
    20.... 6067

    I have table, need multi line unique insert in process.there is a lov as values from 1 to 10 as number.when return value I select LOV (for example selected value 7) then the rows inserted in table 1 to 7 lines only.the table sequence number must increment as well use.

    Well, if your "seq by trigger" is a sequence number created via a trigger, then you don't need to add yourself as the trigger must do.

    You can then insert the number of rows you want, based on the input parameters...

    Suppose that your values in the apex are: OPT_NUMBER and: SL_NUMBER

    Insert into tablename (option_seq_num, sl_number)
    Select to_char(level,'fm09')
    ,: sl_number + (level-1)
    of the double
    connect by level<=>

    Example of the data...

    SQL > ed
    A written file afiedt.buf

    1 Select to_char(level,'fm09')
    2, & sl_number + (level-1)
    3 double
    4 * connect by level<=>
    SQL > /.
    Enter the value for sl_number: 0
    2 old:, & + sl_number (level-1)
    2 new:, 0 + (level-1)
    Enter the value of opt_number: 10
    4 old: connect by level<=>
    new 4: connect by level<=>

    TO_ 0 + (LEVEL-1)
    --- -----------
    01            0
    02            1
    03            2
    04            3
    05            4
    06            5
    07            6
    08            7
    09            8
    10            9

    10 selected lines.

  • Create lines based on the difference in date

    Hello

    I would like to create lines based on the difference between the start and end dates (per year).

    for example

    ID1  Start_time                                             End_time                                                      ID2
    07/01/2003 1, 12.00.00.000000000 2005-01-07 12.00.00.000000000 123

    07/01/1999 1, 12.00.00.000000000 07/01/2003 12.00.00.000000000 345

    I need:

    ID1  Start_time                                             End_time                                                      ID2
    07/01/2004 1, 12.00.00.000000000 2005-01-07 12.00.00.000000000 123

    07/01/2003 1 12.00.00.000000000 07/01/2004 12.00.00.000000000 123

    1 01/07/2002 12.00.00.000000000 07/01/2003 12.00.00.000000000 345

    07/01/2001 1, 12.00.00.000000000 01/07/2002 12.00.00.000000000 345

    07/01/2000 1, 12.00.00.000000000 01/07/2001 12.00.00.000000000 345

    07/01/1999 1, 12.00.00.000000000 07/01/2000 12.00.00.000000000 345

    Thank you

    Hello

    Here's one way:

    SELECT ID1

    , ADD_MONTHS (start_time, 12 * (LEVEL - 1)) AS start_time value

    , ADD_MONTHS (start_time, 12 * LEVEL) AS end_time

    id2

    FROM table_x

    CONNECT BY LEVEL<= months_between="" (end_time,="" start_time)="">

    AND PRIOR id2 = id2

    AND PRIOR SYS_GUID () IS NOT NULL

    ;

    I'm assuming that id2 is unique.

    Would what results you if end_time wasn't exactly N years after start_time?

  • How not to show duplicate lines, based on a field

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0

    Hello

    I have a query that looks like some scripts that did not stand on a given date compared to what ran the same day about a week ago. We want to include the start_datetime and the end_datetime but when I add it to the select statement, it evokes all instances of jobs that run several times during the day. Is it possible to exclude the extra lines based on the field of script_name?
    SELECT instances.script_name, 
                             instances.instance_name, 
                             REGEXP_REPLACE(master.description, 
                                            chr(49814),  -- em-dash
                                            '-') description
                                            --instances.start_datetime
                      FROM   xxcar.xxcar_abat_instances Instances,
                             xxcar.xxcar_abatch_master  Master
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
                      AND    Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
                      MINUS
                      SELECT script_name, 
                             instance_name, 
                             NULL
                             --NULL
                      FROM   xxcar.xxcar_abat_instances 
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))

    LESS performs a set operation - remove lines from the first series that exactly match the second set.
    When you add columns to the first series, you want a smaller filter - try a NOT IN multi-column:
    To remove several courses, to regroup and get min/max

    SELECT instances.script_name,
                             instances.instance_name,
                             REGEXP_REPLACE(master.description,
                                            chr(49814),  -- em-dash
                                            '-') description,
                             min(instances.start_datetime) start_datetime,
                             min(instances.end_datetime) end_datetime
                      FROM   xxcar.xxcar_abat_instances Instances,
                             xxcar.xxcar_abatch_master  Master
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS')) - (:p_NumOfWeeks * 7)
                      AND    Instances.SCRIPT_NAME = Master.SCRIPT_NAME (+)
                      AND (script_name, instance_name) NOT IN
                    ( SELECT script_name,
                             instance_name
                      FROM   xxcar.xxcar_abat_instances
                      WHERE  1 = 1
                      AND    TRUNC(start_datetime) = TRUNC(TO_DATE(:p_StartDate, 'YYYY/MM/DD HH24:MI:SS'))
                    )
    group by instances.script_name, instances.instance_name, master.description
    

    You do not give the definitions of table and query schemas in him, therefore I don't test it.

    Kind regards
    David

  • Updated lines and default values.

    This is my last thread for a while. My final problem with my apex application is related to the update of lines.

    I have a tabular presentation to display several rows for a table and want to add a hidden 'updated_by' and 'last_updated' column. I put their default values such as user name and sysdate that work well for new records, but how each line to add these to existing records?

    I use 4.02 on 11g.

    Hi Craig,.

    Have you considered using a trigger on the table instead of setting these values from the app? A few advantages are: less logical in the app, especially if these inserts/changes can come from several pages, and once the trigger is implemented it will define values independently from changes and insertions (your form, another form, a non-ApEx client app, etc.).

    CREATE OR REPLACE TRIGGER biu_mytable
       BEFORE INSERT OR UPDATE
       ON mytable    REFERENCING NEW AS new OLD AS old
       FOR EACH ROW
    BEGIN
       :new.updated_by := NVL(v('APP_USER'), USER);
       :new.last_updated := SYSDATE;
    END biu_mytable;
    

    Any insert or update triggers the shutter, define two columns. The NVL call handles the case when a customer non-ApEx brings the insert or update. If APP_USER has a value (ApEx logged-in user), the trigger uses it; Otherwise, it uses the database user ID.

    Hope this helps,
    John

    If you find this information useful, please indicate the 'useful' or 'correct' post so that others benefit. *

Maybe you are looking for