Limited by the Clause order

Respected by all!

I found, but fail looking for a limit by the clause order please help me! multiple is, my name in the "name of the substance" column, I want the value of the name research material is stems from the table 'material_reg '.

1 carton
2 - cains
3 - Cain sticker
4 - caps
5 joints
6-other names (means the rest of the others)
Pls help to solve this type of order by otherwise I have to take a lot of pain on the report

Concerning

Hello

If I understand the question, you can use a DECODE and order them by it.

For example CHOOSE..., DECODE (col, 'cardboard', 1, 'cains', 2, 'sticker cain', 3, 'selections', 4, 'seals', 5, 6) ord from... ORDER BY DSB

Good bye
Marie France

Tags: Database

Similar Questions

  • Clause ORDER of NORDER sequencing

    DB version: 11.2.0.3

    Discover the clause ORDER of ALL creation of sequence in literature 11.2

    http://docs.Oracle.com/CD/E14072_01/server.112/e10592/statements_6015.htm

    Can anyone show me an example on how sequence behaves differently with ORDER and NORDER?

    >
    DB version: 11.2.0.3

    Discover the clause ORDER of ALL creation of sequence in literature 11.2

    http://docs.Oracle.com/CD/E14072_01/server.112/e10592/statements_6015.htm

    Can anyone show me an example on how sequence behaves differently with ORDER and NORDER?
    >
    Using CARS? If this isn't the case, then your sequences will be generated in the order that you use the COMMAND or the default ALL.

    As this link text doc says
    >
    The ORDER is necessary only to guarantee ordered generation if you use Oracle Real Application Clusters. If you are using exclusive mode, the sequence numbers are always generated in order.
    >
    You can easily imagine your own example.

    Have you ever seen a roll of numbered tickets? You know, the kind of ticket they give to people when they offer a drawing prize at a meeting or event? You enter the event, pay your money and someone hands you a ticket with a number on it.

    Is there is only a SINGLE roll of tickets and distributing tickets then tickets will be, of course, ONLY one distributed in the order.

    But if there is that a SINGLE roll of tickets, but TWO people who need to get out them you have a problem. Then you pull a series of 50 or 100, and give the second person to distribute. So no #1 has a roll of bills that now begin with number 101 and #2 nobody 100 tickets numbered from 1 to 100.

    Each of them give their tickets to people in their line. Today, 200 people appear, put it online and begin to enter.

    Will the tickets get delivered in the order of 1 to 200? Of course not, line #2 can exceed the speed of line #1 because an old lady in line #1 let fall her purse and made everyone behind her wait until she picked it up. During this time nobody #2 distributed ALL their tickets. Once the Lady picked up his bag and went out the way #1 person distributed the rest of their tickets.

    Welcome to the RAC! Each node of the CARS gets their own "cache" tickets (sequence numbers). If you create a sequence using CACHE 100 each node gets a block of 100 numbers in sequence. When they have more than 100 numbers, they go back and get another block of 100 numbers.

    As each node is different things, they use their numbers upward at different rates. The numbers will NOT appear in the order.

    If you use the COMMAND force you each RAC node use the SAME cache of 100 numbers. Of course, this is NOT a good thing.

    This example helps explain the difference between the ORDER and ALL? And it does not explain why you do NOT want to use the COMMAND unless absolutely necessary? It serializes the use of sequence numbers. Serialization is not scalable.

  • Question about the order of evaluation of the clause WHERE CLAUSE when the Oracle OF the syntax used to join tables

    Hello

    Oracle version: 11.1.0.7.0 - 64 bit

    I read the documentation online at joins. The page is avialable here: joins at

    My question is about the join order of evaluation of the conditions in clause and the conditions of those

    are not the join conditions and are placed in the WHERE clause.

    Consider the following pseudocode

    SELECT

    T1. Col1,

    T2.Col1

    Of

    Table1 t1 LEFT OUTER JOIN table2 t2

    WE

    (condition_expression1)

    WHERE

    (condition_expression2)

    Is it correct to say that if there is no column on the status of join (condition_expression1) in condition_expression2, then condition_expression2 is executed before condition_expression1? In other words, oracle always trying to filter based on the WHERE clause individually each table as much as possible before joining them based on the conditions on the article?

    Thanks in advance,

    Hello

    dariyoosh wrote:

    Hello

    Oracle version: 11.1.0.7.0 - 64 bit

    I read the documentation online at joins. The page is avialable here: joins at

    My question is about the join order of evaluation of the conditions in clause and the conditions of those

    are not the join conditions and are placed in the WHERE clause.

    Consider the following pseudocode

    SELECT

    T1. Col1,

    T2.Col1

    Of

    Table1 t1 LEFT OUTER JOIN table2 t2

    WE

    (condition_expression1)

    WHERE

    (condition_expression2)

    Is it correct to say that if there is no column on the status of join (condition_expression1) in condition_expression2, then condition_expression2 is executed before condition_expression1? In other words, oracle always trying to filter based on the WHERE clause individually each table as much as possible before joining them based on the conditions on the article? ...

    The reverse is actually closer to the truth, but we can't really make general statements like that.

    SQL is not a language of the proceedings.  Looking at the code SQL, we could say that the code does, but we cannot say much about how that code it.  In other words, SQL is a language that describes the results you get, not the way to get them.

    The optimizer will do everything what he thinks is faster if it does not change the results.  If any order in which they are applied (in outer joins or CONNECT BY queries, for example), then think of the join is done first, and the value of the WHERE clause is applied to the result of the join.

    Here is a query looks very much like you posted:

    SELECT d.deptno

    e.ename, e.sal

    OF scott.dept d

    LEFT OUTER JOIN scott.emp e ON e.deptno = d.deptno

    WHERE e.sal > = 3000

    ORDER BY d.deptno

    ;

    Output:

    DEPTNO ENAME SAL

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

    10 KING 5000

    20 FORD 3000

    20 3000 SCOTT

    The scott.dept table contains deptnos 30 and 40; Why are they not in the result set?  The query behaves as if the outer join is made first (production 15 rows), then the WHERE clause has been applied.  All lines with deptno = 30 had sals down han 3000 and all single line with deptno = 40 was NULL in the sal column, then these lines are excluded (as well as other lines of deptnos 10 and 20), and only 3 lines above are left.

  • Join the table orders from clause

    Hi all

    Who is the effective way to join the tables in from clause. I have two tables first with 20 lakh records and second containing 10 lakh recods.
     
    QUERY 1:  SELECT T4.ID,T4.ISO_NAME  FROM T,T4 
    WHERE T4.ISO_NAME LIKE '%US%' AND T.ID=T4.ID;
    
    QUERY 2:  SELECT T4.ID,T4.ISO_NAME  FROM T4,T 
    WHERE T4.ID=T.ID AND  T4.ISO_NAME LIKE '%US%';
    
    T(ID IS PRIMARY KEY) 
    (20 lakh records)
    
    T4 (ID IS PRIMARY KEY ) 
    (10 lakh records)
    ---------------------
    ID     ISO_NAME
    100  US,UK,IN,BR
    101  UK,US,BR,IN
    102  BR,UK,US,IN
    
    
    Note: No index on ISO_NAME .
    Who is the effective query 1 or 2. Please suggest me if you have an idea to rewrite the query.



    Kind regards
    Rajasekhar

    Published by: SuNRiZz68 on January 29, 2009 04:22

    In practical terms, Alex is right. Sometimes it matter what table is selected first, but does the CBO generally a very good job of deciding what you need to select the first (assuming that your statistics are up to date) but this is the situation you are trying to avoid as much as possible.

    If you specify a table main command tables in the clause is not reliable and should be used - but think before using advice and don't do that when necessary.

    Which table to select depends firstly on the join method in the execution plan. Nested loops joins perform better by selecting in the smaller table first, make a loop on the largest table. Joins the smaller set hash table in memory first, and then go through the larger table, perform searches in memory. He can't make any difference, what table is read using first the merger joins and sort.

    Back to your original question. Using the cost-based optimizer, both queries will probably roll the same because newer versions of Oracle (9i, 10g) often transform queries for efficiency before the execution anyway. According to what do you or do not request should probably run a nested loop or hash join. With a small set of data creaing index and using a search of nested loops will probably be faster to avoid full table scans. the '%' in the LIKE clause leader would ignore an index on the ISO_NAME column in any case if a main column may be used in a composite index. All this is based on the approximation using the information provided; Tuning questions should always be tested to unexpected developments.

  • Keep the build order when replacing image?

    Hi guys this problem has plagued me for a while.

    I create a video model in Keynote. The intro slide has a video file (locked) followed by an (unlocked) image and finally another video file (locked). The three of them follow a specific build order with delays, which in turn creates the complete animation.

    I want that the user don't just replace this the Middle image on the slide with one of their choice.

    The problem is, once replace it user order image, positioning of the image and delay in construction are lost. Unfortunately I don't think users are sophisticated enough to follow instructions on how to set the build order, then replace the timing delay, the image needs.

    Is there anyway someone (with a limited understanding of Keynote) can replace the Middle image without compromising the build order?

    Thank you!

    Use an image placeholder:

    • Add a picture to the slide in the format (vertical or horizontal)
    • position and size according to the needs
    • Add a formatting required (picture frame, shadow, etc.)
    • Select the image then: Inspector > Format > advanced > define as media placeholder

    users drag and drop any image on the support of the place that adopts the formatting of the placeholder and keep the animation settings

  • Engine step doesn't fail before reaching its physical limits for the sinusoidal movement

    Hello

    My ultimate goal is to skip a XY (via 2 linear actuators) in a circular motion (radius of 0.47 ") at a frequency of 1 Hz. I run the example VI 'Demo circle' which received my copy of LabView, version 9.0.

    The problem I encounter is that given the physical limitations of the engine and the drive motor, the task should technically be feasible (see calculation *). However, even when the engines are completely discharged (no not attached to anything whatsoever), they start missing steps away from my final goal. I'm only able to reach a radius of 0.2 "(vitesse de pointe de 1.25" / seconde). "

    My question; Is the system set up incorrectly or is my final goal unrealistic, given performance reductions inevitable due to software/hardware?

    I apologize for the naivety of this question, but if there is any information that you may provide which might shed some light on this problem, I would be very happy.

    Possible theories:

    Torque is decreased more at high speeds because of microstep

    A closed loop system would improve performance at high speed

    The VI 'Demo circle' is not the best method to create a circle

    The acceleration is the limiting factor, not speed

    * RADIUS = 0.47 "

    Maximum speed = (RADIUS * 2 * pi) * cos(2 * pi)

    Maximum speed = 2.9 "/ second"

    System:

    LabView v9.0

    PCI-7340

    open loop configuration

    MID-7604

    1 4 a per axis

    10 micro steps

    Linear actuator (form is attached)

    NEMA 17 ordered by motor (sold by ultra-motion).

    Maximum speed of 3.3 inches per second

    1. 2A voltage coil

    1.8º step angle

    Kind regards

    Nick

    Nick-

    I really wonder the max speed in the datasheet.  0,0833 "/ to 3.3" rev / s = about 40RPS (2400 RPM), which is extremely fast for a motor, especially at 24VDC.  Know exactly what engine is on the cylinder and go to www.applied-motion.com and you should be able to find curves of torque for that or a similar engine with various readers.  You will see that couple to 24VDC curves are not good.  In addition, ask Ultramotion if their speed/strength curve is theoretical, or tests have been conducted.

  • Range Focus limiter on the 100mm Macro F2.8

    On an ILCA - 77M 2, just how to deal with this switch

    Of the operating instructions of the Macro Sony SAL100M28 100 mm f/2.8 lens:

    "To focus on subjects at close range..., update fixed anywhere near the object, and then set focus-range up to LIMITlimiter; the focus range is limited to the range of big point. Similarly, when shooting subjects at an extreme range, set thefocus anywhere near the object and then set the limiter of development-range up to LIMIT; the focal range is limited to the range Far-getting to the point. Set the limiter of development-range FULL to allow the range of focus. »

    The SAL100M28 is a macro lens, and as such, it has a long beach of possible focus distances. In addition, in order to get the sharpest image possible, it adjusts the focus more slowly than a conventional lens. This means that should naturally be for some time to focus on a subject. The focus range limiter gives you the ability to limit the movement of the lens at half of its normal range, which speeds up the process.

    Do not use it at all ever, but it can help to to focus on your topic before it moves.

  • WITH THE CLAUSE

    Hi all

    I'm using oracle 11.2.0.4

    I m using this for the purpose of learning

    Below is my table and insert statement

    CREATE TABLE COMPANY (NUMBER EMPLOYEE_ID, EMPLOYEE_NAME VARCHAR2 (30), NUMBER OF MANAGER_ID)

    INSERT INTO THE COMPANY'S VALUES (1, 'FRED', ");

    SOCIETY VALUES (2, 'BARNEY', '1');

    SOCIETY VALUES (3, 'WILMA', '1');

    SOCIETY VALUES (4, 'BETTY', '3');

    INSERT IN THE VALUES(5,'PEBBLES','3') SOCIETY;

    INSERT IN THE VALUES(6,'BAM-BAM','4') SOCIETY;

    INSERT IN THE VALUES(7,'DINO','4') SOCIETY;

    INSERT IN THE VALUES(8,'HOPPY','4') SOCIETY;

    WITH RSFC(CK,PK,LVL,HIER) AS

    (SELECT EMPLOYE_ID, MANAGER_ID, 0 AS LVL, EMPLOYEE_NAME LIKE YESTERDAY)

    SOCIETY

    WHERE MANAGER_ID IS NULL

    UNION ALL

    SELECT EMPLOYE_ID, MANAGER_ID, LVL + 1, YESTERDAY. '/' || EMPLOYEE_NAME

    OF THE RSFC R INNER JOIN COMPANY F

    ON R.CK = F.MANAGER_ID

    )

    WIDTH OF SEARCH FIRST BY CK ORDR SET

    SELECT A.LVL, A.CK, A.PK, A.HIER, ORDR

    THE RSFC HAS

    ORDER BY ORDR

    01FRED1
    121FRED/BARNEY2
    131FRED/WILMA3
    243FRED/WILMA/BETTY4
    253FRED/WILMA/PEBBLES5
    364FRED/WILMA/BETTY/BAM-BAM6
    374FRED, WILMA, BETTY, DINO7
    384FRED, WILMA, BETTY, HOPPY8

    First part, I believe, as well, explains Frank

    hierarchical queries

    next part in bold, I need to understand

    Thanks and respect.

    Guylaine

    Hi, lyly,

    You said that you did not understand the part highlighted in your query.  It looks like the 2 lines are highlighted:

    WIDTH OF SEARCH FIRST BY CK ORDR SET

    SELECT A.LVL, A.CK, A.PK, A.HIER, ORDR

    I guess that it's a typo.  The 2nd day of these lines is just the main SELECT clause; This is the 1st line, the clause of the SEARCH, who really needs an explanation.

    As far as I know, the SEARCH clause is only for the sorting of the results.  In other words, the a WITH recursive clause results will be the same, no matter what you put in the SEARCH clause, or if you omit the clause of RESEARCH.  The only purpose of the clause of RESEARCH is to generate the column command (ORDR in your example), which reflects where each row fits in the graph defined by your recursive query.  (Maybe, if you use non-deterministic user-defined functions, it can be a difference in the results.  Chances are, you never have to worry about this).

    If you do not use a clause in RESEARCH at all, it seems like by default

    WIDTH OF SEARCH FIRST BY NULL...

    In other words, the lines appear in order by level and in no particular order after that.  In your case, that would mean 'FRED' would come first, then "BARNEY" and "WILMA" (not necessarily in that order), followed by all the children of 'BARNEY' or 'WILMA' and so on.  No column order would be generated, so you could not guarantee order in the ORDER BY clause.

    I'm not sure that there is nothing you can do with a clause of RESEARCH that you can not do without a.  In other words, the SEARCH clause automatically generates a command column.  I believe you can still create an equivalent ordering column in the recursive query itself.  In your example, you could say

    ORDER BY lvl, ck

    to get the results sorted the same way.  Sometimes, using a SEARCH clause is much more convenient, and I bet that sometimes it is therefore more effective, too.

    2937991 wrote:

    Hi all

    I'm using oracle 11.2.0.4

    I m using this for the purpose of learning

    Below is my table and insert statement

    CREATE TABLE COMPANY (NUMBER EMPLOYEE_ID, EMPLOYEE_NAME VARCHAR2 (30), NUMBER OF MANAGER_ID)

    INSERT INTO THE COMPANY'S VALUES (1, 'FRED', ");

    SOCIETY VALUES (2, 'BARNEY', '1');

    ...

    As always, thank you for posting this information: it really helps!

    Manager_id is a NUMBER, it would be better if you don't quote it.  In other words, it would be more clear, more effective and less prone to say:

    INSERT INTO COMPANY (EMPLOYE_ID, EMPLOYEE_NAME, MANAGER_ID) VALUES (1, 'FRED', NULL);

    INSERT INTO COMPANY (EMPLOYE_ID, EMPLOYEE_NAME, MANAGER_ID) VALUES (2, 'BARNEY', 1);

    ...

    In this example, the unnecessary quotation marks do not hurt a lot, but they do not help all.

  • Why im getting this error: "ORA-22813: value of the operand exceeds the limits of the system.

    HI EXPERTS...

    Please helpme to fix this...

    I have a database of oracle 11g, runnint on a Windows Server 2008:

    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production

    I have two tables:

    CREATE TABLE UTILS. SEG_ROLES

    (

    VARCHAR2 (12-BYTE) APPLICATION,

    ROL VARCHAR2 (12-BYTE),

    USERS VARCHAR2 (255 BYTE)

    )

    TOGETHER TO DEFINE

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ('MULTIPLAN', 'ADMIN', 'ADMIN');

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ("MULTICLIP", 'CAR01', 'PATY');

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ("MULTICLIP", "CAR02", "FABIOLA, ERIKA");

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ("MULTICLIP", "CON01', 'LUCY, PATY');

    Insert into SEG_ROLES (APPLICATION, ROL, USERS) Values ("MULTICLIP", 'CON02', 'VALERIA');

    COMMIT;

    CREATE TABLE UTILS. SEG_ACCESOS

    (

    VARCHAR2 (12-BYTE) APPLICATION,

    ADMROL VARCHAR2 (12-BYTE),

    VARCHAR2 (20 BYTE) MENU,

    OPCION VARCHAR2 (20 BYTE),

    TYPE VARCHAR2 (5 BYTE),

    OBJETO_MENU VARCHAR2 (40 BYTE),

    ACCESO VARCHAR2 (2 BYTE),

    ROLES_ACCESOS VARCHAR2 (255 BYTE)

    )

    TOGETHER TO DEFINE

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "ROOMMA", NULL, am', 'm_coloca', the of ', 'CAR01, CAR02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "PUT", "PREVALIDA", "SM", "sm_prevalida", the from ', 'CAR01, CAR02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "PUT", "PRECOLOCA", "SM", "sm_preColocacion", the from ', 'CAR01, CAR02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", 'ADMIN', 'LOVE', "COLOCACIÓN", "SM", "sm_colocacion", the from ', "CAR01");

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "PUT", "REGCOLOCA", "SM", "sm_regcoloca", the from ', "CAR01");

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", NULL, am', 'm_PLD', the of ', "CAR01, CAR02, CON01 CON02");

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", "LN_CONSULTA", "SM", "sm_PLD_LNConsulta", the from ', 'CAR01, CAR02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", "LN_BARRIDOMASIVO", "SM", "sm_PLD_LNBarridoMasivo", the from ', "CAR01");

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", "REP_INICICLO", "SM", "sm_PLD_ReporIniciclo", the from ', 'CON01, CON02');

    Insert into SEG_ACCESOS (APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS)

    Values ("MULTICLIP", "ADMIN", "LDP", "LN_BITACORA", "SM", "sm_PLD_LNBitacora", the from ', "CON01");

    COMMIT;

    - And this point of view:


    CREATE VIEW UTILS. VW_ROL_USER AS

    Select distinct APPLICATION, ROL, trim (column_value) USUARIO

    from (SELECT APPLICATION, ROL, USERS USER

    FROM UTILS. SEG_ROLES

    WHERE IT IS NOT NULL TO USERS

    ORDER BY APPLICATION, ROL

    ) t,.

    XMLTable ((' «' ||)) Replace (USER, ",", "",""). '"'))

    order by APPLICATION, ROL, trim (column_value)

    CREATE VIEW UTILS. VW_ACC_ROL AS

    Select distinct APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, trim (column_value) ROL

    (SELECT APPLICATION, ADMROL, MENU, OPTION, TIPO, OBJETO_MENU, ACCESO, ROLES_ACCESOS ROL

    FROM UTILS. SEG_ACCESOS

    WHERE ROLES_ACCESOS IS NOT NULL

    ORDER BY APPLICATION, ADMROL, MENU, OPTION

    ) t,.

    XMLTable ((' «' ||)) Replace (ROL, ",", "",""). '"'))

    MENU, TYPE, OPTION, APPLICATION control, trim (column_value)

    CREATE VIEW UTILS. VW_SEG_ACCESOS AS

    SELECT VACR. APPLICATION, VACR. MENU, VACR. TIPO, VACR. OPCION, VACR. OBJETO_MENU, VACR. ACCESO, VACR. ROL, VUSR. USUARIO

    FROM UTILS. VW_ACC_ROL VACR,

    UTILS. VW_ROL_USER VUSR

    WHERE VACR. ROL = VUSR. ROL

    ORDER OF VACR. APPLICATION, VACR. ROL, VACR. MENU, VUSR. USUARIO, VACR. TIPO, VACR. OPCION

    When I ask the last posting, it works fine:

    SELECT VSEG.* IN UTILS. VW_SEG_ACCESOS VSEG

    But when I add conditions:

    SELECT VSEG.* IN UTILS. VW_SEG_ACCESOS VSEG

    WHERE VSEG. APPLICATION = "MULTIPLAN.

    AND VSEG. USER = 'PATY '.

    It generates this error:

    ORA-22813: value of the operand is greater than the limits of the system

    Cause: The value of the object or the Collection was too big. The size of the value might have exceeded 30 k in a context of TYPE, or size may be too large for the available memory.

    Action: Choose a different value, and try the operation again.

    Why?

    Thanks in advance...

    Finally found a SOLUTION at: http://stackoverflow.com/questions/14328621/oracle-10g-splitting-string-into-multiple-rows

    just change the way we create the view using the regexp_substr.

    CREATE VIEW UTILS. VW_ROL_USER AS

    SELECT distinct trim APPLICATION, ROL, (regexp_substr (USERS, ' [^,] +', 1, level)) USER

    FROM UTILS. SEG_ROLES t

    WHERE IT IS NOT NULL TO USERS

    CONNECTION BY instr (USERS, ',', 1, level - 1) > 0

    order by APPLICATION, ROL

    Thank you all

  • SQL query help needed in the Clause type

    Hello

    I'm currently learning Clause type. How can I write in the clause type to get the result below:

    I have a table like this

    DEPTNO ENAME

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

    20 SMITH

    CELINE 10

    BOND 20

    ALLEN 30

    WARD 30

    20 JONES

    30 MARTIN

    30 BLAKE

    10 CLARK

    SCOTT 20

    10 KING

    30 TURNER

    20 ADAMS

    30 JAMES

    20 FORD

    10 MILLER

    I want the output should look like this

    DEPTNO ENAME

    ------     -----

    CELINE 10, CLARK, KING, MILLER

    20 JONES, ADAMS, BOND, FORD, SCOTT, SMITH

    30 MARTIN, JAMES BLAKE, WARD, TURNER, ALLEN

    Hear is the script I am currently working on.

    with emp_group as

    (

    Select 20 deptno, ename 'SMITH' Union double all the

    choose 10, 'CÉLINE' from dual union all

    Select 20, "BOND" of all the double union

    Select 30, 'ALLEN' from dual union all

    Select 30, 'WARD' of all the double union

    Select 20, "JONES' from dual union all

    Select 30, 'MARTIN' from dual union all

    Select 30, "BLAKE" from dual union all

    choose 10, 'CLARK' from dual union all

    Select 20, 'SCOTT' from dual union all

    choose 10, 'KING' of the dual union all

    Select 30, 'TURNER' from dual union all

    Select 20, 'ADAMS' from dual union all

    Select 30, 'JAMES' of the dual union all

    Select 20, 'FORD' Union double all the

    choose 10, 'MILLER' from dual

    )

    Select

    DEPTNO

    A1

    of emp_group

    model

    ignore the nav

    partition (deptno)

    dimension (ROW_NUMBER() over (PARTITION BY deptno ORDER BY ename DESC) rn)

    measures (ename, LPAD(' ', 100) A1)

    rules)

    A1 [rn > 0] = ename [cv ()],

    A1 [0] = ename [cv ()]

    )

    order by deptno

    ;

    your help is very appreciated.

    Thank you in advance.

    Try this.

    Select

    *

    Of

    (

    with emp_group as

    (

    Select 20 deptno, ename 'SMITH' Union double all the

    choose 10, 'CÉLINE' from dual union all

    Select 20, "BOND" of all the double union

    Select 30, 'ALLEN' from dual union all

    Select 30, 'WARD' of all the double union

    Select 20, "JONES' from dual union all

    Select 30, 'MARTIN' from dual union all

    Select 30, "BLAKE" from dual union all

    choose 10, 'CLARK' from dual union all

    Select 20, 'SCOTT' from dual union all

    choose 10, 'KING' of the dual union all

    Select 30, 'TURNER' from dual union all

    Select 20, 'ADAMS' from dual union all

    Select 30, 'JAMES' of the dual union all

    Select 20, 'FORD' Union double all the

    choose 10, 'MILLER' from dual

    )

    Select

    DEPTNO

    names

    rn

    of emp_group

    model

    ignore the nav

    partition (deptno)

    dimension of)

    ROW_NUMBER() over (PARTITION BY deptno ORDER BY ename) rn

    )

    measures (ename, cast (null as names of varchar2 (40)))

    rules

    (

    names [any] order by desc = ename [cv ()] rn | «, » || names [cv () + 1]

    )

    order by deptno

    )

    where rn = 1

    Best regards, Andrei

  • How to use the clause type conditionally create new lines

    This question is just for learning - no object other than to start real world to create versions of some queries known to learn how to measure the performance of the MODEL clause clause of the MODEL versions.

    The question is: How can you write a STANDARD clause that pivots (updates) ONLY the lines that actually need to rotate and do NOT change the lines that have no value and cannot be rotated.

    I found a good site that has about two dozen example articles on different pieces. This first link is the beginning of the series.

    SQL features tutorials - Clause TYPE

    http://www.sqlsnippets.com/en/topic-11663.html

    This link is to a clause of FAQ of BluShadow MODEL version "how to convert rows to columns."

    Line - MODEL method string

    http://www.sqlsnippets.com/en/topic-11987.html

    The solution to this link uses this line of source:

    POSITION KEY VAL

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

    R08 0 v1, v2, v3,.

    and this result set:

    POSITION KEY VAL

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

    R08 1 v1

    R08 2 v2

    R08 3 v3

    The reason why it produces that result set is this clause of the statement of MODEL

    RETURN THE UPDATED LINES

    If you comment on this article, you will see that the original lines are all in position 0. This means that the solution reproduced EACH SOURCE LINE even if there is only one item in the list of values.

    Thus, even a line source with a single value (for example, the r01 'a') will be updated and updated this line is returned.

    For a large number of data sources with only a few lines that actually need to rotate it would be a great performance of infringement.

    This is the sample data source

    with t as (button 1, 'a' value 'abc' col2, col3 'def' of the double
    Select Union all 2, 'b', 'ghi', 'jkl' from dual
    Union all select 3, 'c, d, e, 'mno', 'pqr' from dual.
    Union all select 4, 'f', 'stu', 'vwx' from dual
    )
    Select the key, value, col2, col3
    t

    KEY, VALUE, COL2, COL3
    1, a, abc, def
    2, b, GHI, jkl
    3, "c, d, e, mno, pqr.
    4, f, stu, vwx

    Lines 1, 2 and 4 only have a value of (a, b, c respectively.

    Only line 3 must rotate. It contains "c, d, e" and which must become 3 lines in the result set

    Value of the key, col2 col3
    1 an abc def
    2B ghi jkl
    3 c mno, pqr
    3 d mno, pqr
    3 e mno, pqr
    4 f stu vwx

    The nut of the problem is that if the clause 'RETURN UPDATED ROWS' is used, then the lines 1, 2 and 4 must be updated in order to be returned in the result set. And if this clause is NOT used, then line 3 must be updated by 'c', d, e 'c' and two new product lines: one line for a ' and one for 'e '.

    How can you do this with the TYPE clause without the help of the clause "Return LINES UPDATE"? I don't have a solution to sample showing what I tried because I can't understand what it takes to even try.

    I have a solution that uses "RETURN UPDATED ROWS" but I want to compare this performance to the exercise, when this clause is NOT used.

    We ask BluShadow to add the solution of MODEL clause to this FAQ with other similar solutions.

    Like this?

    SQL > with t as
    () 2
    3 select the 1 key, 'a' val, 'abc' col2, col3 'def' of the double


    Select 4 Union all 2, 'b', 'ghi', 'jkl' from dual
    5 union all select 3, 'c, d, e, 'mno', 'pqr' from dual.
    Select 6 Union all the 4 'f', 'stu', 'vwx' from dual
    7)
    8. Select the key
    9, key_1
    10, val
    11, regexp_substr (val, ' [^,] +', 1, key_1) val_new
    12, col2
    13, col3
    14 t
    model 15
    16 partition by (key)
    dimension (1 key_1) 17
    18 measures (val, col2, col3, (length (val) - length (replace (val, ",")) + 1) as len)
    19 rules
    (20)
    21 val [for 1 to increment of len key_1 [1] 1] = val [1]
    22, col2 [for 1 to increment of len key_1 [1] 1] = col2 [1]
    23, col3 [for 1 to increment of len key_1 [1] 1] = col3 [1]
    24)
    25 order
    26 by key
    27, key_1;

    KEY KEY_1 VAL VAL_N NECK NECK
    ---------- ---------- ----- ----- --- ---
    1 1 has an abc def
    2 b 1 b ghi jkl
    3 1 c, d, e c mno pqr
    3 2 c, d, e d mno pqr
    3 3 c, d, e e mno pqr
    4 1 f f stu vwx

    6 selected lines.

  • Problem with the case where the clause

    Hello

    I want to use cases in which clause. I wrote a very simple query to test how it works. However, I always got an error message. Here's what I did.

    Select eid, firstname, lastname from employee where eid = 1 works fine

    Select eid, name, name of the employee

    where

    cases where 1 = 1 then eid = 1

    When 1! = 1 then eid = 2

    end

    I ORA-00905: lack of keyword.

    Did I miss something?

    Thank you

    Jennifer

    Hi, Jennifer.

    Why do you want to use BOX in a WHERE clause?  The wonderful thing about the CASE is that it allows you to do IF-THEN-ELSE logic.  In a SELECT clause, or an ORDER BY clause, this is really useful, but the WHERE clause already allows you to use the IF-THEN-ELSE logic.

    However, if you use the BOX in a WHERE clause, it is as it does nowhere else.  Always BARGAIN instead of a single expression in a SQL data types.  All the clauses THEN (and ELSE, if there is one) must return a single expression, such as the NUMBER.  (There is no BOOLEAN data type in SQL).  So, you can use a CASE statement like this:

    ...

    CASES WHERE

    WHEN 1 = 1 THEN 1

    WHEN 1! = 1 THEN 2

    END = eid

    Here, the CASE expression takes the place of a NUMBER.

    However, if I was not sure if 1 = 1 or not, I would write the condition in this way, without a CASE expression:

    WHERE (1 = 1 AND eid = 1)

    OR (1! = 1 AND eid = 2).

  • As for the Clause on Oracle 10 g db

    Hi experts,

    I had little doubt about my simple request

    When I go through the black book of Oracle for db10g article on the clause
    They stated something like this
    SELECT * FROM EMPLOYEES (EMPLOYEE_ID = '1981');
    on the clause simliar to the place where clause.

    SELECT * FROM EMPLOYEES WHERE EMPLOYEE_ID = '1981'.

    When I run this statement .it fine.

    ' using ' ON clause ' instead of ' where clause.

    He didn't accept the clause on, run the command not properly ended sql.

    where I'm not kidding...?


    Thank you & & looks
    ADF7.

    Version
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

    Oracle provides the clause TO specify join conditions in the SELECT statements involving multiple tables. It is independent of data types and column names. As the USING clause, the clause and NATURAL JOIN are mutually exclusive.

    In cases where the tables participating are more two CLAUSES, Oracle uses the first specification of the clause to join the two tables. He uses the second ON the specification of the clause to combine the next table with the result of the join of the first.
    The key word THERE is also used in other contexts, such as in GRANT and INDEX statements.

    Notes:

    After the keyword ON the join condition is written, in general, it can contain predicates connected with Boolean AND, OR, and NOT
    The order of the tables is not relevant
    The use of parentheses are optional in syntax, but the readability of the increases

    Syntax example:

    SELECT

    FROM TABLE_1

    JOIN TABLE_2

    ON (join condition)

    Usage example:

    The SQL query below shows the employee's name and the name of Department of their work:

    SQL > SELECT E.ENAME, D.DNAME

    EMPLOYEE E JOIN DEPT D

    WE (E.DEPTNO = D.DEPTNO)

  • Select "ordinate inline-view" - the output orders or not?

    Request always generates data ordered by "T1.col3"?
    select * from (select col1 from T1 where col2=10 order by Col3 desc ) where ROWNUM <= 5;
    As you can see I ordered in line-view, then I select data from this view inline with external selection. It is ensured that the data is output now as he was ordered inside inline-wiew? Can watch tests that Yes, the data seem to be ordered as order is defined inline-notice. I understand inline-view is as something static snapshot, area, where the data are well classified, and if I now running on such thing an external "select * from"-clause, then he should get out of the well-ordered way, because I don't join what anyone or to do something else, I simply by selecting all the lines in one ordered in line-view. "» Am I right or not?

    (Oracle 10g, Solaris OS)


    ---

    The example data:
    with T as
    (select 1 as col1, 10 as col2, 106 as col3 from dual union all
    select 5 as col1, 10 as col2, 100 as col3 from dual union all
    select 6 as col1, 10 as col2, 104 as col3 from dual union all
    select 3 as col1, 10 as col2, 101 as col3 from dual union all
    select 4 as col1, 10 as col2, 105 as col3 from dual union all
    select 2 as col1, 10 as col2, 103 as col3 from dual)
    select * from (select col1 from T where col2=10 order by Col3 desc ) where ROWNUM <= 5;
    Edited by: CharlesRoos the 10.12.2010 15:49

    Hello

    CharlesRoos wrote:
    The following query always generates data by "T1.col3"?

    select * from (select col1 from T1 where col2=10 order by Col3 desc ) where ROWNUM <= 5;
    

    The output will contain the 5rows with 5 larger values for Col3.
    These 5 rows not necessarily appears in order. Add an ORDER BY clause in the main query if you need ensure that.

    Maybe it's that, on your version of Oracle and your platform, the main request happen to keep the agenda constantly. This is exactly the kind of thing that stops working when you move to another version or another platform. If you want the end result in good standing, to use an ORDER BY clause in the main query.

  • WITH the clause as inline view

    I m using oracle DB 11.2.0.2.0
    I have a question about usage WITH the clause which made a temporary transformation (Materializing) automatically.
    I want the query to operate as a point of view WITH clause online because the transactions table materailizing would kill performance.
    I m able to see the transformation of the temporary table in the explain output plan.
    Have we not all suspicion to stop the transformation of Temp table?

    Here is an example of the sample
    I have the query union multi (2 requests), couple of table is common to all the union queries. the request should not be materialized. It must operate as a point of view common inline.

    WITH ORDERS AS
    (SELECT h.order_number,
    l.line_number,
    l.line_id
    order_headers h, order_lines l)
    SELECT...
    COMMANDS, X, Y
    WHERE THE...
    UNION ALL
    SELECT...
    ORDERS, A, B, C
    WHERE THE...

    Try this...

    WITH ORDERS AS
    (SELECT /*+ inline */ h.order_number,
    l.line_number,
    l.line_id
    from order_headers h, order_lines l)
    ...
    

    To achieve the opposite effect, you can use SELECT / * + materialize * /.

    However, keep in mind that these tips are undocumented, so use them at your own risk. If you think that Oracle is to choose a bad execution plan, you must sign a deal with Oracle Support to see if this is a bug.

    Kind regards
    Bob

Maybe you are looking for

  • Does anyone know how to display along with the app on the Mac App Store in the Sierra of MacOS?

    Does anyone know how to display along with the app on the Mac App Store in the Sierra of MacOS? I've just updated to Sierra. Since the upgrade did several reboots. When I discover an app the side also shows "4 +" or similar and I click on the note to

  • Update Windows KB2833941 error code 0 x 643

    Original title: update Windows KB2833941 error code 0 x 643. With the help of windows XP Edition family. Version 2002 sp3, Explorer 8, Vr 8.0.6001.18702, 128-bit. Used security is Bitdefender Total Security.  Thank you. Get the error code 0 x 643 on

  • Error 0 x 80070057 in installing windows 7

    OK, here's my situation. Data sheet: Mobo: Asus asus m5a97 r2.0 Graphics card: Sapphire 380 Nitro 4 GB AMD RAM: 8 GB HARD DRIVE: WD Blue 1 TB Desktop 3.5 inch SATA 6 GB/s 7200 RPM internal hard drive Location: I recently had problems with slowing dow

  • On Windows 7 Ultimate sound problem

    Hello I use Creative 4.1 sound system on my PC for some time. But, recently, I reinstalled Win 7 32 bit on my PC again and now only work 4 speakers. I tried to install the latest drivers from Realtek HD sound card, but still works as a single. Moreov

  • Download the OPA cloud policy template by using the command line

    Hi OPA developers,.Our project aims to automate the migration process models of political Test for Production environment. We use the OPA Cloud Aug2015, but if I understand correctly, we can enter the private cloud installation command-line tool and