All possible combinations of the strings in the array in PL/SQL

Hello

I'm trying to figure out how to build a list of all possible combinations of string values that are stored in a single table.

There are several 'levels' (a level being of the order in which the value appears in the output string) and multiple values per level...

I am using Oracle 10 g R2, and my table structure is as follows:
--not the best naming conventions, but it works for discussion...
CREATE TABLE FamilyValues
(
  myID      INTEGER                             NOT NULL,
  FamilyID  INTEGER                             NOT NULL,
  myLevel     INTEGER                             NOT NULL,
  myValue     VARCHAR2(10)
)

insert into familyvalues values(1,1,1,'I',);
insert into familyvalues values(2,1,1,'E',);
insert into familyvalues values(3,1,2,'2',);
insert into familyvalues values(4,1,2,'J',);
insert into familyvalues values(5,1,2,'B',);
insert into familyvalues values(6,1,3,'0',);
insert into familyvalues values(7,1,3,'1',);
insert into familyvalues values(8,1,3,'2',);
insert into familyvalues values(9,1,3,'3',);
insert into familyvalues values(10,1,3,'4',);
insert into familyvalues values(11,1,3,'5',);
insert into familyvalues values(12,1,3,'6',);
insert into familyvalues values(13,1,3,'7',);
insert into familyvalues values(14,1,3,'N',);
insert into familyvalues values(15,1,3,'T',);
insert into familyvalues values(16,1,3,'V',);
insert into familyvalues values(17,1,3,'W',);
insert into familyvalues values(18,1,4,'0',);
insert into familyvalues values(19,1,4,'1',);
insert into familyvalues values(20,1,4,'2',);
insert into familyvalues values(21,1,4,'3',);
insert into familyvalues values(22,1,4,'4',);
insert into familyvalues values(23,1,4,'B',);
insert into familyvalues values(24,1,4,'D',);
insert into familyvalues values(25,1,4,'F',);
insert into familyvalues values(26,1,4,'H',);
insert into familyvalues values(27,1,4,'J',);
insert into familyvalues values(28,1,4,'K',);
insert into familyvalues values(29,1,4,'L',);
insert into familyvalues values(30,1,4,'M',);
insert into familyvalues values(31,1,4,'N',);
insert into familyvalues values(32,1,4,'P',);
insert into familyvalues values(33,1,4,'R',);
insert into familyvalues values(34,1,4,'T',);
insert into familyvalues values(35,1,4,'V',);
insert into familyvalues values(36,1,4,'W',);
insert into familyvalues values(37,1,4,'X',);
insert into familyvalues values(38,1,4,'Y',);
insert into familyvalues values(39,1,4,'Z',);
I want to get results, for the sample data above (using only 3 levels for a reasonable amount of data):
I     2     0
I     2     1
I     2     2
I     2     3
I     2     4
I     2     5
I     2     6
I     2     7
I     2     N
I     2     T
I     2     V
I     2     W
E     J     0
E     J     1
E     J     2
E     J     3
E     J     4
E     J     5
E     J     6
E     J     7
E     J     N
E     J     T
E     J     V
E     J     W
so far my best attempt is:
select
    A.myValue || '-' || B.myValue || C.myValue || D.myValue
from
    FamilyValues A
    FULL JOIN FamilyValues B ON (B.myLevel -1) = A.myLevel
    FULL JOIN FamilyValues C ON (C.myLevel -1) = B.myLevel
    FULL JOIN FamilyValues D ON (D.myLevel -1) = C.myLevel
WHERE
    A.myValue IS NOT NULL
    AND B.myValue IS NOT NULL
    AND C.myValue IS NOT NULL
    AND D.myValue IS NOT NULL
I read on the post to (Re: all possible combinations of string in PL/SQL but think it is a slightly different implementation...)

I wish I could recusively pass by the table and make all possible combinations with each of the values in the table in the positions provided by the level...
select ltrim(sys_connect_by_path(myValue,' ')) combination
  from  familyvalues
  where connect_by_isleaf = 1
  start with myLevel = 1
  connect by FamilyID = prior FamilyID
         and myLevel = prior myLevel + 1
/
COMBINATION
--------------------------------
I 2 0 0
I 2 0 1
I 2 0 2
I 2 0 3
I 2 0 4
I 2 0 B
I 2 0 D
I 2 0 F
I 2 0 H
I 2 0 J
I 2 0 K
I 2 0 L
I 2 0 M
I 2 0 N
I 2 0 P
I 2 0 R
I 2 0 T
I 2 0 V
I 2 0 W
I 2 0 X
I 2 0 Y
I 2 0 Z
I 2 1 0
I 2 1 1
I 2 1 2
I 2 1 3
I 2 1 4
.
.
.

SY.

Tags: Database

Similar Questions

  • The best way to generate all possible combinations of 5 digits

    Hi Experts,

    I'm on Oracle 11.2.0.2 on Linux. I have a task to generate all possible combinations of five digits (1 to 5) and each number can be used only once. I wrote the code below, but I wonder if this is optimal - or if it can be improved on. I will be grateful for your commens on this subject:

    DECLARE
    BEGIN
       FOR i IN 1 .. 5
       LOOP
          FOR j IN 1 .. 5
          LOOP
             IF i = j
             THEN
                CONTINUE;
             ELSE
                NULL;
             END IF;
             FOR k IN 1 .. 5
             LOOP
                IF (j = k OR i = k)
                THEN
                   CONTINUE;
                ELSE
                   NULL;
                END IF;
                FOR l IN 1 .. 5
                LOOP
                   IF (k = l OR i = l OR j = l)
                   THEN
                      CONTINUE;
                   ELSE
                      NULL;
                   END IF;
    
                   FOR m IN 1 .. 5
                   LOOP
                      IF (l = m OR i = m OR j = m OR k = m)
                      THEN
                         CONTINUE;
                      ELSE
                         NULL;
                      END IF;
                      DBMS_OUTPUT.put_line (
                         i || ' ' || j || ' ' || k || ' ' || l || ' ' || m);
                   END LOOP;
                END LOOP;
             END LOOP;
          END LOOP;
       END LOOP;
    END;
    /
    

    Thnaks,

    OrauserN

    Hello

    orausern wrote:

    Hi Frank

    Wow! It's all just awesome.

    Can you please elaborate more and explain this code? I mean that I do not understand how this sql. You can exaplain in detail how it works?

    Thanks again!

    OrauserN

    What, precisely, do you understand?  I guess it's CONNECT BY, I used twice.

    CONNECT is a feature that allows for recursion in SQL.  It includes an optional to BEGIN WITH and a clause CONNECT BY, which are both similar in a WHERE or HAVING clause conditions.  Which respect the terms of the START WITH clause are supposed to be at the level of the line = 1.  When it does not START WITH paragraph, all lines are LEVEL = 1.  (This is the case in two of my CONNECT garages).  A line is on LEVEL = N (N.1) if he meets the conditions CONNECT BY, when you look at some PREVIOUSLY already selected line in this query at level N-1 =.  It is often useful to consider the lines forming a graph oriented; the SYS_CONNECT_BY_PATH function returns a string that represents how we traveled through this graph to get each line of output.

    As used in the subquery called universe, START WITH is particularly difficult to understand.  For now, do not try to understand; just accept that it is a quick and convenient to generate a set of results with 5 rows, numbered from 1 to 5.  Let us look at the CONNECT BY the main query instead.  This query is very similar to this one, using the scott.dept table:

    SELECT path SYS_CONNECT_BY_PATH (deptno, ',')

    deptno

    LEVEL

    OF scott.dept

    DeptNo CONNECT BY NOCYCLE <> deptno PRIOR

    ;

    Output:

    DEPTNO LEVEL PATH
    -------------------- ---------- ----------
    , 10                         10          1
    , 10, 20                     20          2
    10, 20, 30 30 3
    10, 20, 30, 40 40 4
    10, 20, 40 40 3
    10, 20, 40, 30 30 4
    , 10, 30                     30          2
    10, 30, 20 20 3
    10, 20, 30, 40 40 4
    10, 30, 40 40 3
    10, 30, 40, 20 20 4
    , 10, 40                     40          2
    10, 40, 20 20 3
    10, 40, 20, 30 30 4
    10, 40, 30 30 3
    10, 30, 40 and 20-20-4
    , 20                         20          1
    , 20, 10                     10          2
    20, 10, 30 30 3
    ...

    40, 30, 20 20 3
    4 10 10, 20, 30, 40

    64 selected lines.

    As you can see, the above query shows all possible combinations of the 4 values distinct deptno.  The query starts by taking a line (in this case, the line with deptno = 10, I'll just say 10 in the future) and the place level = 1.  Then he sees what lines are connected to 10 (as defined by the CONNECT BY clause) and places them on LEVEL = 2.  All lines except 10 itself are connected to 10 of this affection.  Such a line is 20.  The lines are connected to 20?  Again, all the lines except 20 himself. (10 <> 20, so if you think 10 would seem still level = 3, but it is not.)  By default, CONNECT BY will raise an error if a line is connected to itself, directly or indirectly, as in the path ", 10, 20, 10'.»  The NOCYCLE keyword tells Oracle to ignore these connections rather than trigger an error).

    If there is a WHERE clause, it is applied after the CONNECT BY is completed.  In your problem, we did not all combinations, we wanted only the combinations that included all 5 lines, so I used a WHERE clause to display only lines that went up to the LEVEL of output = 5.

    For an introduction to CONNECT BY, see

    START BY and CONNECT in Oracle SQL

    or

    Hierarchical queries in Oracle & #8211; The CONNECT BY clause. Welcome to the server Oracle by Massimo Ruocchio

  • Best way to sum up all possible combinations (different) in a table?

    Hey guys,.

    Say that I have an array of sorted values (for mitigation), I want to build a table of all possible sums of these values, sorting, and then refer to him as a list of all the possible attenuation values (say theyre bits on a discrete digital attenuator).  I'll try to show you an example of what I mean with letters:

    Wait table: [a, b, c and d]

    I want a table like this: [a + b, a + c, a + d, a + b + c, a + b + d, a + c + d, b + c, b + d, b + c + d]... I hope that I'm not missing combos here...

    I enclose my attempt at this idea, but it lacks something I think, I'm doing something wrong...

    Thanks for any ideas or help them.

    The challenge will be to all possible combinations.

    Have you considered looking at this as a variation on binary counting?

    The total number of combinations is 2 ^ (NumberOfSettings) If you include 'None '.

    Then build a ramp between zero and the total number possible.

    Convert each number in a table of Boolean and then use the Boolean value to determine if its corresponding value gets add in total.

    After processing all the values of the ramp, the final table should be in ascending order.

    I hope this plan helps,

    Ben

  • Get all possible combinations in SQL

    Hi all

    I try to get all possible combinations for a given set of points.

    For example, the elements (A, B, C) I want to output all possible combinations that are ordered from left to right:
    A
    B
    C
    AB
    AC
    BC
    ABC
    Basically, I want the sys_connect_by_path output, but instead of having groups that are concatenated in the same line, I want to have the lines. The query I bellow gives the output I want, but has the limitation that sys_connect_by_path can't handle more than 4,000 sizes.
    WITH t AS
     (SELECT 1 seqno,
             'A' txt
        FROM dual
      UNION ALL
      SELECT 2 seqno,
             'B' txt
        FROM dual
      UNION ALL
      SELECT 3 seqno,
             'C' txt
        FROM dual
      UNION ALL
      SELECT 4 seqno,
             'D' txt
        FROM dual),
    src AS
     (SELECT rownum combination_id,
             substr(sys_connect_by_path(txt, ','), 2) txt
        FROM t
      CONNECT BY seqno > PRIOR seqno)
    SELECT combination_id,
           regexp_substr(txt, '[^,]+', 1, l) list
      FROM (SELECT DISTINCT combination_id,
                            txt,
                            column_value l
              FROM src,
                   TABLE(CAST(MULTISET (SELECT LEVEL
                                 FROM dual
                               CONNECT BY LEVEL <= nvl(length(regexp_replace(src.txt, '[^,]+', NULL)), 0) + 1) AS
                              sys.odcivarchar2list)))
     ORDER BY combination_id,
              l;
    Is it possible to get this output in SQL without using sys_connect_by_path?

    Thanks in advance.

    Published by: Manuel Vidigal on March 21, 2011 10:45

    Hi, manual,.

    I'm not sure that I understand why you cannot use SYS_CONNECT_BY_PATH. You have thousands of lines? The number of combinations is 2 ^ N ^-1, so it will be billions of combinations!

    The problem you have only a few lines, but only the data you want to display are not a single character (as txt in your sample data), but may be present of the characters, and that is what exceeds the limit of 4000 characters?
    If Yes, you can use the SYS_CONNECT_BY_PATH on just the primary key and then join this list to get the data you really need, like this:

    WITH       got_path    AS
    (
         SELECT     SYS_CONNECT_BY_PATH (seqno, '/') || '/'          AS path
         FROM     t
         CONNECT BY     seqno > PRIOR seqno
    )
    SELECT       DENSE_RANK () OVER (ORDER BY  p.path)     AS c_num
    ,       t.txt
    FROM       got_path     p
    JOIN               t  ON   INSTR ( p.path
                                 , '/' || t.seqno || '/'
                              )    > 0
    ORDER BY  c_num
    ,            t.seqno
    ;
    

    c_num lists the combinations of 1, 2, 3... You can use the actual path (perhaps with the/s deleted) If you wish.

    Sven had a good idea, but it takes you to know how many lines is in the table and hardcode a lot of self-joins (minus 1) in the query. What a pity that you have Oracle 11.1. If you use Oracle 11.2, you can use the approach of Sven with a WITH recursive clause, without knowing how many lines there and with a fixed amount of coding.

  • Is it possible to use the default value as sql expression in obiee 11g report?

    Hi all

    Is it possible to use the default value as sql expression in obiee 11g report?. Actually what I'm trying to make is that we send an ibot users. They want the same default values that are assigned in the command prompt in the report. So when we send the ibot it shows the report for default values assigned in the report criteria which is obsolute. As a solution, I kept the report in a dashboard page and send the dashboard like ibot page. But the problem here is that I can send only pdf format. Is it possible to do so at the level of the report (without using session variables). I want something like that

    Date between Date ' @{PV1} {Timestampadd (SQL_TSI_DAY,-90, CURRENT_DATE)} and Date ' @{PV2} {CURRENT_DATE}

    Thanks in advance

    Thank you

    AJ

    http://www.w3.org/2001/XMLSchema-instance"container ="http://www.w3.org/2001/XMLSchema"xmlVersion ="201201160' xmlns:sawx="com.siebel.analytics.web/expression/v1.1" > "

    "Question time '." Date '.

    "Question time '." Date '.

    BOX WHEN (DAYOFWEEK (cast (max (CURRENT_DATE) date)) = 1) THEN TIMESTAMPADD (SQL_TSI_DAY,-2, cast (max (CURRENT_DATE) as date)) WHEN (DAYOFWEEK (cast (max (CURRENT_DATE) date)) = 2) THEN TIMESTAMPADD (SQL_TSI_DAY,-3, cast (max (CURRENT_DATE) as date)) WHEN (DAYOFWEEK (cast (max (CURRENT_DATE) date)) = 3) THEN TIMESTAMPADD (SQL_TSI_DAY,-4, cast (max (CURRENT_DATE) as date)) WHEN (DAYOFWEEK (cast (max (CURRENT_DATE) date)) = 4) THEN TIMESTAMPADD (SQL_TSI_DAY-5 (, cast (max (CURRENT_DATE) date)) WHEN (DAYOFWEEK (cast (max (CURRENT_DATE) date)) = 5) THEN TIMESTAMPADD (SQL_TSI_DAY,-6, cast (max (CURRENT_DATE) as date)) WHEN (DAYOFWEEK (cast (max (CURRENT_DATE) date)) = 6) THEN TIMESTAMPADD (SQL_TSI_DAY, 0, cast (max (CURRENT_DATE) as date)) WHEN (DAYOFWEEK (cast (max (CURRENT_DATE) date)) = 7) THEN TIMESTAMPADD (SQL_TSI_DAY-1, cast (max (CURRENT_DATE) date)) END

  • In SQL Developer, is it possible to send the results of a sql statement?

    In SQL Developer, is it possible to send the results of a sql statement?

    Right-click on the query results pane, select "Export data" in the context menu, then select "xls".

  • Firefox displays all possible options in the menu contextual (right-click)

    Hello
    A few hours previously, firefox itself has upgrade the new version, 20.0.
    After the reboot, it seems that everything works fine. But when I right click to display the context menu (and copy the location of the image), I saw a long list with options like 'Pause', 'Play', 'Mute' and so on.

    Here is a picture:
    http://2imgs.com/2I/i/515c6224/79903d27bae38742936c6eea68084f43/d1af1c36e5.f.PNG

    Try Firefox Safe mode to see if the problem goes away. Safe mode is a troubleshooting mode, which disables most of the modules.

    (If you use it, switch to the default theme).

    • You can open Firefox 4.0 + in Safe Mode holding the key SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • Or open the Help menu and click on the restart with the disabled... modules menu item while Firefox is running.

    Once you get the pop-up, simply select "" boot mode safe. "

    If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to understand that one. To do this, please follow article Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems .

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

    When find you what is causing your problems, please let us know. It might help others who have the same problem.

  • All possible means for the conversion of P2V Windows 2008 R2 (even with workaround solutions?)

    We have several production servers, that we have recently upgraded to Windows 2008 R2, only to discover after the fact that VMWare Converter currently does not support convert a physical machine to a VMWare image. The servers are actually images of Hyper-V, but since there is no way to convert the computer virtual Hyper-V to VMWare, we have always used the P2V conversion with our Windows 2008 Server (not R2) without problem.

    Its imperative that we find a way to do this and I was hoping to see if anyone has found any workaround for this problem.

    We would prefer not to have to buy another product for that (i.e. using Acronis or Symantec Backup), as one would expect VMWare to support it eventually (even if it is the only option, we will have to examine it). We simply need a workaround solution for us until they do.

    Thanks a bunch!

    Hello.

    Have you tried the StarWind V2V Converterfree?

    Good luck!

  • Help with oracle sql to get all possible combinations in a table.

    Hello guys I have a small predicatement which has me a little confused. I have a table similar to the following. (It is a sample of my real of the table. I use this to explain the original table containing sensitive data).
    CREATE TABLE TEST01( 
    TUID VARCHAR2(50),
    FUND VARCHAR2(50),
    ORG  VARCHAR2(50));
    Insert into TEST01 (TUID,FUND,ORG) values ('9102416AB','1XXXXX','6XXXXX');
    Insert into TEST01 (TUID,FUND,ORG) values ('9102416CC','100000','67130');
    Insert into TEST01 (TUID,FUND,ORG) values ('955542224','1500XX','67150');
    Insert into TEST01 (TUID,FUND,ORG) values ('915522211','1000XX','67XXX');
    Insert into TEST01 (TUID,FUND,ORG) values ('566653456','xxxxxx','xxxxx');
    "TUID"                        "FUND"                        "ORG"                         
    "9102416AB"                   "1XXXXX"                      "6XXXXX"                      
    "9102416CC"                   "100000"                      "67130"                       
    "955542224"                   "1500XX"                      "67150"                       
    "915522211"                   "1000XX"                      "67XXX"                       
    "566653456"                   "xxxxxx"                      "xxxxx"                       
    The 'X' is wildcard character elements * (I inherit it and I can not change the table format) * I would like to make a query as follows

    select tuid from test01 where fund= '100000' and org= '67130'
    However I like to do is to retrieve all the records that have have these segments in them including ' x
    in other words the output expected here would be

    "TUID"                        "FUND"                        "ORG"                         
    "9102416AB"                   "1XXXXX"                      "6XXXXX"                      
    "9102416CC"                   "100000"                      "67130"                       
    "915522211"                   "1000XX"                      "67XXX"                       
    "566653456"                   "xxxxxx"                      "xxxxx"  
    I started to write a massive sql statement that would have the 12 as the instruction inside, because I must compare the org and finance every possible way.
    This is where im headed. but im wondering if there is a better way.
    select * from test02
    where fund = '100000' and org = '67130'
    or fund like '1%' and org like '6%'
    or fund like '1%' and org like '67%'
    or fund like '1%' and org like '671%'
    or fund like '1%' and org like '6713%'
    or fund like '1%' and org like '67130'
    or fund like '10%' and org like '6%'...etc
    
    /*seems like there should be a better way..*/
    can someone give me a hand to come with this sql statement...

    mlov83 wrote:
    If I run the present

    select tuid,fund, org
    from   test01
    where '100000' like translate(fund, 'xX','%%') and '67130' like translate(org, 'xX','%%');
    

    That's what I

    "TUID"                        "FUND"                        "ORG"
    "9102416AB"                   "1XXXXX"                      "6XXXXX"
    "9102416CC"                   "100000"                      "67130"
    "915522211"                   "1000XX"                      "67XXX"
    "566653456"                   "xxxxxx"                      "xxxxx"
    "9148859fff"                  "1XXXXXX"                     "X6XXX"                       
    

    the last item should be excluded. The second digit in "org" is a "7".

    Fund is bad, too. Looking for 6 characters ("100000"), but the funds on this line is 7 characters ("1XXXXXX").

    and it's always get picked up.

    That's why you should use the Joker _ instead of %

    select  tuid, fund, org
    from    test01
    where  '100000' like translate (fund, 'xX', '__')
    and    '67130'  like translate (org,  'xX', '__')
    ;
    

    It is difficult to see, but in two calls to TRANSLATE, the 3rd argument is a string 2 ' _.

  • Operation range (get all possible combinations of characters)

    Hello
    Example: the string '1,2,4'
    Output:
    1, 2
    1, 4
    2, 4
    1,2,4

    Looking for a simple way.

    Thank you.

    Hello

    Here's one way:
    First, splits the string into a separate line for each item.
    Then use CONNECT BY and SYS_CONNECT_BY_PATH for all combinations of lines.

    WITH     separate_rows     AS
    (
         SELECT     REGEXP_SUBSTR ( txt
                         , '[^,]+'
                         , 1
                         , LEVEL
                         )          AS item
         FROM    (
                   SELECT     '1,2,4'     AS txt
                   FROM     dual
              )
         CONNECT BY     LEVEL <= 1 +REGEXP_COUNT ( txt
                                                , ','
                                         )
    )
    SELECT     SUBSTR ( SYS_CONNECT_BY_PATH (item, ',')
                , 2
                )     AS combination
    FROM     separate_rows
    WHERE     LEVEL     > 1
    CONNECT BY     item     > PRIOR  item
    ;
    

    REGEXP_COUNT was new in Oracle 11.1. In earlier versions, find the number of commas in txt by seeing how the LENGTH decreases when you delete them.

  • Is it possible to avoid the or in this sql?

    Hello

    I have a subquery to work which is givng me some performance issues... (I've changed the names of tables and columns).
    select h.name, h.age, h.sex, h.height, h.occupation
      from human h
     where h.newest = 'Y'
       and h.death_date is null
       and (i_department_ids is null or
           (i_department_ids is not null and
           h.unique_id in
           (select m.unikt_id
                from departments d
               where d.department_id like i_department_ids)) and
           (INSTR(i_apartment_numbers, aki.apartment_id) > 0 or
           i_apartment_numbers is null))
    i_department_ids and i_apartment_numbers can be null at the time, but not both at the same time, it is also checked. My problem is with two operators OR . As soon as I have the OR, a full scan is completed. A search can take as long as 13 seconds. Without the operators OR there 0,0062 dry. I use the OR operators because, if the input variable is zero, the condition must return True.

    If we scan a way I can avoid using the two operators OR , so I'll avoid the fulltable?

    Thank you very much

    William

    A shooting blind. Try this.

     select h.name, h.age, h.sex, h.height, h.occupation
       from human h
      where h.newest = 'Y'
        and h.death_date is null
        and case when i_department_ids is null then 1
                 when i_department_ids is not null and
                         h.unique_id in
                         (select m.unikt_id
                              from departments d
                             where d.department_id like i_department_ids))
                               and INSTR(nvl(i_apartment_numbers,aki.apartment_id), aki.apartment_id) > 0) then 1
                 else 0 end = 1
     
    

    Published by: Karthick_Arp on November 3, 2010 05:42

    Included the Toon conditino aswell.

  • It is possible to change the text in the admin console?

    I'm just curious... as someone who is trying to create a site of BC for a non-profit, is it at all possible to change the language or the language of the console administrator of BC? I think especially of the e-Commerce section.

    Thank you!

    Hello

    Not at this stage that the CRM admin cannot be customized yet.

    Only option we provide is the translation of language (Spanish, Japanese, Dutch, German, Swedish, French).

    Kind regards

    -Sidney

  • Is it possible to make the condition depending on the sql statements in the data models

    Hi all

    Is it possible to include the condition based on sql statements in the data models.

    For example
    if (some parameter is not null)
    <sqlstatement name="STATEMENT_1">
    ...
    </sqlstatement>
    else
    <sqlstatement name="STATEMENT_2">
    ...
    </sqlstatement>
    Is something like this? Also, the good doc is available for ' how to take full advantage of the "data models" in BI Publisher?

    Thank you
    -Sookie

    Hello Sookie,
    I couldn't find the time to get a data model of demonstration of work for you, but I'll try to explain.

    First, write a PL/SQL package. Make sure that you set all the parameters of model of data such as a global variable in the default PL/SQL package.

    CREATE OR REPLACE
    package as employee
    function BeforeReportTrigger return Boolean;
    query_text varchar (2000);
    number of p_DEPTNO;
    END;
    /

    CREATE OR REPLACE
    package as body employee
    function BeforeReportTrigger return Boolean IS
    Start

    IF (p_DEPTNO = 10) THEN
    query_text: = select col1, col2, col3 from HR.
    elsif (p_DEPTNO = 20) THEN
    query_text: = select col1, col2, col3 hr_history.
    on the other
    query_text: = select col1, col2, col3 hr_history1.
    end if;
    Returns true;
    end;
    /

    Use this package in the default package in your data model. Check the "defaultPackage ="employee"in the following data model header.

    Sample data model
    ------------------------------












    --
    --
    --
    --

    Before running the query SQL, data engine reads the "before the release of the report" and all the texte_requete argument based on the p_DeptNo value. When executing the Q1, engine sqlQuery analyze the query ' & quert_text and replace it with the actual value. For example if the p_deptno = 10, the query will be "select col1, col2, col3 from HR.

    Try it...

  • What is the latest version of SQL Developer?

    Hi all

    What is the latest version of SQL Developer?

    Also let me know is free or licensed?

    It can be downloaded for free from the link below.

    Oracle SQL Developer downloads

  • What is the new method of SQL joins

    Dear all,

    What is the new method of SQL joins

    1

    SELECT <fields>
      FROM TableA a INNER JOIN TableB b ON a.key = b.key
    

    2

    SELECT <fields>
      FROM TableA a, TableB b
     WHERE a.key = b.key
    

    Above the two queries work very well in PL/SQL, but request that no 1 does not work in Oracle Forms 10 g

    Kind regards

    Zafar Iqbal

    Hello

    Zafar Iqbal wrote:

    Dear all,

    What is the new method of SQL joins

    1

    1. SELECT
    2. TableA, TableB INNER JOIN a and b WE a.key, b.key =

    2

    1. SELECT
    2. FROM TableA, TableB b
    3. WHERE a.key, b.key =

    Above the two queries work very well in PL/SQL, but request that no 1 does not work in Oracle Forms 10 g

    Kind regards

    Zafar Iqbal

    What, exactly, is your question?

    Literally ask you which of these 2 methods is new?  As mentioned above, none is really new.  Both participated in Oracle at least 13 years.

    Query 1, above, ANSI join syntax uses, which is more recent.   As mentioned above, Oracle has started to support that the syntax in version 9.1 (2001) previous versions only supported syntax used in query 2.

    Did you mean to ask something else?  Maybe "How can I use a query as a query 1 forms?" or "are there other places where a method works, but the other is not?

Maybe you are looking for