Question on the use of expressions and aliases in the FROM clause

Hello

I have the following query
 select substr(e.ename, iter.pos, 1) as C
   from (select 'KING' as ename from dual) e,
        (select rownum as pos from dictionary where rownum <= 100) iter
  where iter.pos <= length(e.ename);
outputs (of your choice):
C
-
K
I
N
G
For the purposes of hardcode 'KING' was made for the test, IRL would be a column from other tables. Is the other piece that is hardcoded "where rownum < = 100 ' and it's the one I would like to find a way to remove.

I tried the following:
 select substr(e.ename, iter.pos, 1) as C
   from (select 'KING' as ename from dual) e,
        (select rownum as pos from dictionary where rownum <= length(e.ename)) iter
  where iter.pos <= length(e.ename);
Unfortunately this does not work because the SQL parser has not analyzed enough of the FROM clause to know e.ename causing the length (e.ename) expression return a message identifier unknown.

I tried to restructure the query above to make the SQL parser aware of the e.ename early enough and therefore accept it. My efforts have failed.

I would like to know if there is a way to restructure the statement length (e.ename) can be used instead of Hardcoding an artificial upper limit (for example 100 as in the first statement).

Thank you

John.

Use CONNECT BY LEVEL:

SQL> select substr(ename, level, 1)
  2  from ( select 'KING' ename
  3         from   dual
  4       )
  5  connect by level <= length(ename);

S
-
K
I
N
G

4 rows selected.

Tags: Database

Similar Questions

  • I'm using Outlook Express and from time to time, the box "leave a copy of messages on the server" becomes disabled automatically.

    Hi, Im using Outlook Express and from time to time, box "leave a copy of messages on the server" becomes disabled automatically.

    Ive checked the Task Manager, its not running after close Outlook.

    Appreciate your comments.

    This can be dependent on ISP or it could just be OE spoil.  I saw this happen at any time.  You can try to backup the message store, and then delete the mail account completely (you will not lose messages).  The file to run. Folder | All compact.  Then close and reopen OE and then add the account back again.  See if things stick after that.

    Steve

  • I do not use outlook express and still get msg, oe can compact the message. How to stop

    I do not use outlook express and still get msg, oe can compact the message.  How do I prevent this every time that I turn on computer to come.

    You must tell Windows Search to stop indexing OE.

    In the control panel. Indexing Options. Change. Clear the check box for Outlook Express.

    If you see the prompt again, let the compact once to reset the counter and it should be.

  • Effect of an additional table in the FROM clause in the query results?

    I recently helped a colleague debug one of their SQL statements

    The output was showing some very unexpected totals, and I was able to shrink down to an additional table in the FROM clause, but not used anywhere else in the application.

    Thus, for example

    SELECT A.ID, B.CODE
    Of
    EMPLOYEE,
    B OF THE STATUTE,
    PAY THE SAL
    WHERE A.ID = B.ID
    AND
    A.ID = 1;

    I was wondering, how can an extra table in a FROM clause influence directly on the rest of the query?

    The query above is just an example of what I've seen, the my co worker was working on is a bit larger and a lot more code to read. I noticed that when I added/removed the extra table in my query to co workers and then it worked as expected.

    I always thought that an additional table is not attached to what anyone would be just to do the inefficient code, but does not affect output
    just do the inefficient code

    Yes, that too, you will get a Cartesian product by calling is not the entries in the where clause for this table 'disappeared' :(

  • A subquery in the From Clause

    How can I model the RPD with the sub query that has the subquery in the from Clause.

    SELECT

    o948938. CONSOLIDATED_NAME,

    (SUM (o948992. YTD_COMPLETED)) / (SUM (TOTAL_OCC_AP)) AS C_1,.

    SUM (TOTAL_OCC_AP) AS TOTAL_OCC_AP,

    Of

    ORG_DIM o948938,

    TIME_MONTHLY_DIM o948963,

    INSPECTION_FACT o948992,

    (SELECT TDS_NUM,

    MONTH_ID,

    SUM (TOTAL_APTS) TOTAL_AP,

    OF SUMMARY_FACT

    TDS_NUM GROUP,

    MONTH_ID

    ) O949126

    WHERE (o949126. MONTH_ID = o948992. MONTH_ID (+)

    AND o949126. TDS_NUM = o948992. TDS_NUM (+)

    AND (o948938. TDS_NUM = o949126. TDS_NUM)

    AND (O948963. MONTH_ID = O949126. MONTH_ID))

    Group

    O948938. NEW_BOROUGH_GROUPING

    Hello

    You can do this via an opaque view.

    You can also do this by modeling the cumulative value as a calculation LOGIC in the group by aggregation "pinned" to a specific dimension hierarchy that reflects consolidation in the online posting.

    Hope this helps,

    Robert.

  • Results of the query variant with unused table in the from clause

    Hi all

    I (processing_table2) table specified in the FROM clause in the SQL query , but I have not used any of its value in the SQL statement , but it still affects the results of the query. Please help me out here I'm naïve.

    This is the provided query

    SELECT SUM((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    cssp sales_split,
    processing_table2
    WHERE crev.order_num = '7631090072'

    Results of the above query : 344028065018.359



    SELECT

    Sum((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    sales_split PCSS

    WHERE crev.order_num = '7631090072'

    Results of the above query : 26463697309.1046


    Someone here suggest me pls!

    924804 wrote:
    Hi all

    I (processing_table2) table specified in the FROM clause in the SQL query , but I have not used any of its value in the SQL statement , but it still affects the results of the query. Please help me out here I'm naïve.

    This is the provided query

    SELECT SUM((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    cssp sales_split,
    processing_table2
    WHERE crev.order_num = '7631090072'

    Results of the above query : 344028065018.359

    SELECT

    Sum((CREV.sadc_extd*CSSP.redit_pcnt)/100)

    OF crev revenue_lines,.
    sales_split PCSS

    WHERE crev.order_num = '7631090072'

    Results of the above query : 26463697309.1046

    Someone here suggest me pls!

    CARTESIAN PRODUCT of the changes result set

  • Number of tables in the from clause

    Hello
    Can someone tell me how many tables can we have clause in oracle.

    As you can see it

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14237/limits003.htm#i288032

    Subqueries levels Maximum of subqueries in a unlimited SQL in the FROM clause in subqueries queries Top Level 255 in the WHERE clause

    Subqueries in the FROM-> unlimited, so number of tables is also unlimited (limited only by the size of SQL and probably time of your life while waiting to join thousands of tables :)) results

  • When Windows XP is finished in April 2014, will I still be able to use Word? I'll always be able to use Outlook Express and Internet Explorer? Or they all will be unavailable?

    I have Windows XP Service pack 3.

    Hi Christine,

    Support for Windows XP will be completed; However, you will be able to use Microsoft Word, Outlook Express and Internet Explorer without any problem.

    For reference:

    Record the lifecycle of Windows:

    http://Windows.Microsoft.com/en-in/Windows/products/lifecycle

     

    I hope that the information above helps you.

  • INSERT the SEQ WITH the question of the Select clause

    Hello
    I have Insert statement that I want to use seq with the select clause, but does not please help in this...

    Insert in aaa (rowname, rowid, rowadd)
    aa_seq.nextval, empaddress, and Select empname from emp;
    Please, do not help to accommodate seq in the insert statement.
    Insert into aaa(rid,rowname,rowadd)
    select aa_seq.nextval, empname,empaddress from emp;
    

    Do not use as ROWID column name.

  • How to put the subquery in the from clause

    Hi all

    I want to put a my from clause subquery. I want to show the details of an account, when the status is active, but I want to show the date when he opened.

    Here is my report query.

    Select t.acct_id, x.acct_status_Dt
    of cust_acct t, (select t1.acct_id, t1.acct_status_Dt from t1 cust_acct where t1.acct_status_code = 'OPEN') x
    where t.acct_id = x.acct_td
    and t.acct_status_code = 'ACTIVE'

    Someone knows how to impliment this kind of query in OBIEE without RPD Exchange.

    Help, please...

    Hello

    To be more clear, ask in the Advanced tab of the request, should look like:

    select A.saw_0, x.saw_1 from (select acct_id saw_0 from cust_acct)A, (select acct_id saw_0, acct_status_Dt saw_1 from cust_acct where cust_acct.acct_status_code='OPEN') x
    where a.saw_0=x.saw_0
    

    Actual query that you pasted:

    select t.acct_id,x.acct_status_Dt
    from cust_acct t , (select t1.acct_id, t1.acct_status_Dt from cust_acct t1 where t1.acct_status_code='OPEN') x
    where t.acct_id= x.acct_td
    and t.acct_status_code='ACTIVE'
    

    I think it is x.acct_id in where clause... not x.acct_td, I corrected and wrote the sql above...

    Published by: Kishore Guggilla, July 17, 2009 12:00

  • How to activate the 'POP 3' in order to use Outlook Express and transfer my contacts list and then cancel Hotmail

    I am currently using Hotmail, with my old Outlook acct always on my computer.   I want to switch it to Outlook because I like the tab 'Cancel', but when I tried, I was shown the POP 3 wasn't available.

    I have to let you know that I have absolutely zero knowledge on Hotmail. Never needed it so I have never used or heard.

    First of all, you need to access your Hotmail account via OE to download messages. The links above should help, or you have to go on the WLHotmail forums.

    I could find this to Setup OE to use Qwest.
    http://www.CenturyLink.NET/files/CenturyLink/support/EmailPrograms/outlook_express.php

  • What is the use of FPGAS and how it differs from the IO Modules

    Hi all

    Maybe it's a silly question for most of you.  But I have very less knowledge about the basic concepts of electronic (FPGA, real-time) to cRIOs. I know that FPGA

    can be used to generate circuits within the chip that helps by some logical functions.

    I've just started working in the cRIO.  My question is that we have Modules e/s making it outputs all the application entry.  So, what is the purpose of e/s in the FPGA.

    Lets consider that we entered for an application of RTD.  In this case the module NI 9217 itself exits 24 bits of data from the RTD measurement which may be the process of the LabVIEW VI.  What will be this FPGA between the i/o Modules and the processor will help in?  Also I want to know what type of communication is used to send data between the FPGA and host modules.

    Thanks in advance

    Ajay HI:

    Sorry, you do not have an answer to your original question. However, you are right about the benefits of the FPGA. You said, if you build pre-processing in the FPGA, you can unload a lot of potentially CPU calculations out of the host processor. In addition, the program running on the FPGA is highly deterministic and can run the code very quickly. So if you build a kind of guard or evanescent dog part of your application, the FPGA is a good place to put it.

    To answer your other questions, communication between the modules and the FPGA is generally above the SPI and the data can be transferred between the FPGA and host via DMA FIFO operating on the PCI bus or single point save access using read/write in the FPGA host Interface controls. You can also use interruptions in signal of disputes between the FPGA host.

    I hope this helps, but let us know if you have any other questions.

  • Use regular expressions to extract .llb file from the path name

    I'm trying to be smart (always a dangerous thing) and use a regular expression to extract the name of a library to a filepath converted to a string.   While I appreciate there are other ways to do this, regex seems to be a very powerful way of neat, I would be able to operate.

    IE, if I have a string of type, C:\applications\versions\library.llb\toplevel.vi, I want to be able to extract the library.llb of the string, because it will be of variable length, may include the numbers & spaces and may be located in a file of variable depth hierarchy.   In other words, I want to extract the part of the string between the last-which ends with .llb

    The best I managed so far is \\+.*llb who all returned less the drive letter and the toplevel.vi

    Can someone help me to achieve this goal, or I'm better by using an alternative method (for example filepath string in array, search for .llb)

    Thank you

    Matt

    Hi Matt,

    attached you will find two other options.

    Mike

  • Question APC UPS - using documents lamw and j.holland - VIMA ESXi 4.0

    Hi guys,.

    I've implemented our UPS with our ESXi server according to document (revision 4)

    http://VIOPS.VMware.com/home/docs/doc-1341/version/4

    Note

    that revision 4 of the document is not that scripted lamw,

    but using the ssh hack. Everything works beautifully when I invoke the

    script ups_shutdown manually from the console for ESXi does not support:

    #!/bin/bash
    VMID=$(/usr/bin/vim-cmd vmsvc/getallvms | grep -v Vmid | awk '{print $1}')
    
    for i in $VMID
    do
      STATE=$(/usr/bin/vim-cmd vmsvc/power.getstate $i | tail -1 | awk '{print $2}')
     
      if [ $STATE == on ]
      then
      
        /usr/bin/vim-cmd vmsvc/power.shutdown $i
    
      fi
    
    done
    
    sleep 30
    
    /sbin/shutdown.sh
    /sbin/poweroff
    

    First of all, to the right of the bat in the first line of the script throws and error (-file of ashes not found error). So I had to remove that (no idea why?).

    When I run this script from the (unsupported) ESXi console, all right, all the computers shut down virtual and, in the end, therefore the ESXi.

    When I run this script to VIMA (ssh to the console, remote script execution), only the VIMA machine stops. If I modify the above script does not close the VIMA, all virtual machines (except of course VIMA) stops and made the ESXi...

    VIMA is the first machine that gets shutdown - it has the Vmid lowest. It seems that this causes the rest of the script to stop running... How is that possible when in fact it is running on the ESXi Server?

    I'm pulling my hair out on this one (or what's left of them). Does anyone have an idea why it does not work...? lamw?

    Thanks in advance guys.

    Andrzej

    The reason why you should delete/bin/bash because ESXi 4.0 not supported console Busybox has more a symbolic link to/bin/Ash bash that resembles the bash environment, so that would make error if you try to specify the path that does not exist.

    About the scheduling of the production of vmsvc/getallvms, you can always do a grep - v on VIMA VM is not part of the list and have a separate condition which which will close at the end.

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    VMware Code Central - Scripts/code samples for developers and administrators

    150 VMware developer

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    Twitter: @lamw

    If you find this information useful, please give points to "correct" or "useful".

  • Using Outlook express and cannot connect to Hotmail to download e-mail messages.

    Get error message depending on whether the connection to the server has failed. Account: 'Hotmail', server: 'mail.hotmail.com', Protocol: POP3, Port: 110, secure (SSL): no, Socket error: 10060, error number: 0x800CCC0E

    See this: http://windowslivehelp.com/solution.aspx?solutionid=99d4b13d-13db-40d8-9cdf-172002d4194c

Maybe you are looking for