Use of MIN with text data

I am not familiar with using MIN with text data as in the sample below and could use some help in deciphering what it is doing. This SELECT statement is taken from a larger CREATE OR REPLACE VIEW statement. The first line of the WHERE clause is making the connection to look at the correct user's information. The section after the first AND is what I am trying to interpret correctly. I have moved into a new position and wasn't around when this view was created. The statement is designed to assign the correct DOMAIN_ID to each user based on values in the elms.elms_dom_lkup table ed. This table consists of 4 columns: DOMAIN_ID, PROC_LVL, LOCATION, AND POSITION. The DOMAIN_ID is the only field that is not nullable. The primary key for the table is a combination of the 4 columns. The section after the first AND matches the PROC_LVL from the ed (lookup table) to the PROCESS_LEVEL in the cd (reference table) and confirms the process level is associated with the users primary position. It then looks for one of three conditions:
1. process levels match and LOCATION and POSITION are NULL
2. process levels match and LOCATION matches user's location in a reference table
3. PROC_LVL is NULL and POSITION matches user's position in a reference table
(SELECT MIN (domain_id)
FROM elms.elms_dom_lkup ed, mici.const_dept cd
WHERE c.constituent_id = cd.constituent_id
AND ( (ed.proc_lvl = cd.process_level AND cd.pos_level = 1
AND ( (ed.location IS NULL AND ed.position IS NULL)
OR (LOWER (ed.location) = LOWER (loc.campus))))
OR (LOWER (ed.position) = LOWER (c.job_desc)
AND ed.proc_lvl IS NULL))), /*Domain ID*/
My question revolves around the priority on those matches. The ed table is not organized in any manor. The records are in the order they were entered. Does the MIN in the SELECT statement cause the DOMAIN_ID

Hi,
Welcome to the forum!
If v is a string column (such as a VARCHAR2), then MIN (v) is the first string in collating order (that is, alphabetic order, but with numbers and punctuation symols given particular values in the ordering).
It lookw like the code fragment you posted is a Scalar Sub-Query , that is, a sub-query used where an expression is exprected. For example, in a query like this:
SELECT  *
FROM    scott.emp
WHERE   sal     > 1200
;You can replace the literal 1200 with any kind of numeric expression, even
SELECT  *
FROM    scott.emp
WHERE   sal     > (     --Begin scalar sub-query
                SELECT  AVG (sal)
                FROM    scott.emp
            )     -- End scalar sub-query
;You have to be careful that a sclar sub-query produces exactly one column, and either 0 or 1 rows. You'll get a run-time error if the sub-query ever produces 2 or more rows.
People sometimes use MIN in situations like yours when the sub-query might otherwise return 2 or more rows, and either:
(a) all the non-NULL rows will contain the same domain_id, or
(b) it doesn't matter which domain_id is used, just so long as it is one that actually exists in the result set.
842436 wrote:
My question revolves around the priority on those matches. The ed table is not organized in any manor. The records are in the order they were entered. Does the MIN in the SELECT statement cause the DOMAIN_IDSorry, I don't understand exactly what you're asking.
Rows in a relational table are never in any intrensic order.
It looks like the question got cut off. Does the MIN in the SELECT statement cause the DOMAIN_ID to do what?
Edited by: Frank Kulash on Mar 7, 2011 3:01 PM
I see you corrected your first post.
842436 wrote:
... My question is does the MIN in the SELECT statement cause the DOMAIN_ID from the first record that meets any of the 3 conditions to be returned?Yes, it makes the sub-0query return the first domain_id ( in alphabetic order ) that meets all the conditions. If there are 1,000 rows that meet all the conditions, the query will ind all 1,000 of them, keeping track iof which one is first in alphabetic order. Remember that
'127.255.255.0' is less than
'25.0.0.0' in alphabetic order, because '1' is less that '2'.

Similar Messages

  • What is the best file type to use when dealing with text data?

    Hello,
    I am trying to read off text information from a file stored on the phone. I am currently using a txt file to store the data; however the input streaming process is very slow. Is there another way, or file type I can use which is much quicker?
    Regards,
    vj

    do buffering in stead of reading char by char.

  • Editing a document done in Word 2004. I can't remove lines done in Word. Using Mac Mini with 10.9.4

    I am unable to a remove lines from a document originally done in 2004 using  Mac Word 2004 while running it on Pages. Using Mac Mini with OSX 10.9.4.
    Tried to delete lines. Delete is not highlighted in Pages.
    Message was edited by: francinefromkent, 08/8/2014, 5p.m. EST. Edited to give more information.

    The version of Pages is the most useful extra information, it hardly matters what Mac you are using.
    Menu > Pages > About Pages
    The line could possibly be an underline or a paragraph border or a line which is a separate object underneath the rest of the text.
    Probably it is a paragraph border.
    Peter

  • How to use a queue with dynamic data

    When using a collector I have found that it significantly slows down my loop times. I am using LabView7.1 on a Dell PC with Windows XP.  If I use a queue with dynamic data do you think that will require less of my processor and allow for faster loop speeds?
    I have created a queue using dynamic data in one loop and I want to retrieve all available samples each iteration in a slower loop. If I use the flush queue I get a 1d array of dynamic data. What is the best way to convert the 1d array of dynamic data so that the array of dynamic data is consolidated back into a single dynamic data type? Any help would be much appreciated.

    Hi Dennis,
    You could for instance wire the array to an auto-indexed for loop. I attach an example. I assume you wish to concatenate the arrays a singel waveform.
    Hope it helps,
    Pelle S
    District Sales Manager
    National Instruments Sweden
    Attachments:
    Dynamic queue.vi ‏245 KB

  • Anyone using durable topics with high data volumes?

    We're evaluating JMS implementations, and our requirements call for durable subscribers, where subscribers can go down for several hours, while the MQ server accumulates a large number of messages.
    Is anyone using Sun MQ in a similar scenario? How is it holding up?
    Sun folks, do you know of production installations that use durable topics with high data volumes?
    thanks,
    -am

    We are using a cluster of Sun�s JMS MQ 3.6 with durable message queues and persistent topics. In a 4 hour window each night we run over 20,000 messages through a queue. The cluster sits on two Windows servers, the producer client is on a AIX box and the consumer is running on a iSeries. Within the 20,000 messages are over 400,000 transactions. Each message can have many transactions. Yes, the iSeries client has gone down twice and the producer continued with the message queue pilling up, as it should. We just use the topic to send and receive command and status inquiries to the clients. So every thing works fine. We have only had a couple issues with a client locking and that maybe fixed with sp3, we are in the process of installing that. The only other issue we have had is that once in a while the producer tries to send an object message with to many transactions and it throws and JMS exceptions. So we put a cap on the size of the messages, if its over a set number of transactions it send each transaction as separately, otherwise it sends all the transactions in one object type (linked list of transactions) message. Compare the cost of this JMS system with Tibco or Sonic and you�re looking at big savings.

  • HT4108 can I use my IPAD with a data projector?  and does the data projector have to be an iOS compatible one?

    can I use my IPAD with a data projector?  and does the data projector have to be an iOS compatible one?

    You can connect via a cable or wireless using an Apple TV.
    http://ipad.about.com/od/iPad_Guide/a/How-To-Connect-Your-Ipad-To-Your-Tv.htm
    iPad Accessories: Connections for a TV or Projector
    http://www.dummies.com/how-to/content/ipad-accessories-connections-for-a-tv-or-p rojector.html
    You may be interested in AirPlay on the Apple TV:
    Apple - AirPlay - Play content from iOS devices on Apple TV
    http://www.apple.com/airplay/
    Alternately, there are Apple Digital AV Adapters for hardwired connections:
    iOS: About Apple Digital AV Adapters
    http://support.apple.com/kb/ht4108
     Cheers, Tom

  • Can I use gps applications like tomtom at the ipad mini with mobile data transfer turned off?

    Need help about ipad mini.
    The information on the apple web page refers that only the 3G versions have gps capabilities.
    Wath is not clear to me is if the gps works only when coneted with 3G data transfer, or it works without it, if I download some software like tomtom or navigon.
    Best regards
    Pedro

    You can use it without being connected to 3G. Only the 3G/4G iPads have a built-in GPS chip, the wifi-only models don't, and you can use apps such as TomTom with it which contain the maps, you don't need to be connected to 3G (or even have activated 3G on the iPad) or wifi to then use it.

  • Using Calc Manager to update values for Members with Text Data Type

    Hi All,
    In my outline I have a member of text data type. The purpose is to allow users to be able to enter comments.
    Each line item is created through a business rule and I am prompting the user to enter the key values at the launch of the calc manager rules. I want to be able to prompt the user for the comments in the calc manager rule because I know that it supports variables of type string. However I am unable to assign this string variable directly to the member.
    I appreciate that essbase only stores numeric data and that all text data type members really store numeric values which are basically the id's of the text string stored in a relational table by planning. however I cannot update the database table through calc manager and then bring in the generated id. Is there any way I can do this?
    I don't want to skip this field in the calc manager rule and expect the user to enter the comments AFTER the line item has been created because the users want this to be a mandatory field and insist that a new line item not be created unless comments are specified.
    Many thanks in advance for any help I can get.
    Shehzad

    If the comments are a set definition you could you smart lists in your planning forms.
    create this in your smart list
    xxxx = 1
    yyyy = 2

  • Using htmlmarkup.xsl with a data template

    Has anyone used a file called htmlmarkup.xsl, http://blogs.oracle.com/xmlpublisher/2007/01/formatting_html_with_templates.html, with a data template?
    If I create my BI Publisher report using a data query in my data model, htmlmarkup.xsl works fine in converting the html text to bold or underline, or whatever I want it to be. But if am using a data template in my data model, the tags don't get converted and I still see the tags.
    Any thoughts would be appreciated!
    Thanks!!
    Kris Henning
    www.piocon.com

    I was hoping you would help me with this!
    Here is the data template:
    <dataTemplate dataSourceRef="oltpdev" name="html" defaultPackage="html">
         <properties>
              <property name="xml_tag_case" value="upper"/>
         </properties>
         <parameters>
         </parameters>
         <lexicals>
         </lexicals>
         <dataQuery>
              <sqlStatement name="Q_1">
    select manager_product_id,notes
    from manager_product_note
    where trunc(note_timestamp,'mm')='01-jun-2008'
                             </sqlStatement></dataQuery>
         <dataStructure>
              <group name="G_notes" dataType="varchar2" source="Q_1">
                   <element name="notes" dataType="clob" value="NOTES"/>
                   <element name="manager_product_id" dataType="number" value="MANAGER_PRODUCT_ID"/>
              </group>
         </dataStructure>
    </dataTemplate>
    I just want to see the NOTES column correctly. Instead I get:
    <p><strong>New Note</strong></p>
    <ol>
    <li>numbered list - normal font</li>
    <li><strong>bold font</strong></li>
    <li><strong><em>bold and italic</em></strong></li>
    <li><u>underlined</u></li>
    <li><em>italic only</em></li>
    <li><strike>strike out</strike></li>
    </ol>
    <ul>
    <li>bulleted list</li>
    <li>next item</li>
    <li><strong><i><u><strike>Bold, Italics, Underlined and Strikeout</strike></u></i></strong></li>
    </ul>
    You can tell this is a test case.
    Thanks for your help!
    Kris Henning
    www.piocon.com

  • Using alternate rows with Spry Data Set

    Can anyone provide more information on how to implement alternate row colors with a Spry Data Set?  What I have done is:
    Create spry data set using HTML page as the data set
    The html page that displays the data set is:  <div spry:region="equipment">
    In the default.css page that is linked, I added the info in note #1 below
    When the page displays, no colors appear. Tried changing the colors and still no luck.  Is there another step to do?
    Note #1:
    within the default.css, the following are declared:
    #equipment odd {
    background-color: #CCC;
    #equipment even {
    background-color: “#F2F2F2;
    Note #2:
    Here is a link to see the actual pages referenced above.
    Any ideas? Getting frustrated!!  Thanks in advance for any advice.

    You are going to kick yourself, but, you haven't assigned any page element the ID #equipment. The region is called that but the table or the DIV does not have an idea and your selector matches nothing...

  • Using Mac mini with LCD TV

    I intend to use the mac mini with a 26" HD LCD TV with a resolition of 1366 * 768. Can anyone tell me if this will give a good quality display?

    I intend to use the mac mini with a 26" HD LCD TV
    with a resolition of 1366 * 768. Can anyone tell me
    if this will give a good quality display?
    That would depend on the quality of the TV. I am using my mac mini with a Samsung 26 inch HD tv. It works fine at that resolution using the VGA connector on the TV but If I use a DVI to HDMI connection to samsung wont let me use the native resolution which is annoying. So until there is a fix for this I have to use the VGA connection.

  • Using perspective tool with text in AI CS5

    Hi,
    I am new to AI CS5 and was wondering if someone could please tell me how to use the Perspective tool with text?  Also, does the text have to be expanded in order to use the perspective tool or is that not recommended? 
    Thank you,
    Diane

    Hi Diane,
    Here's a video showing how to do it http://vector.tutsplus.com/tutorials/tools-tips/quick-tip-put-text-into-perspective-using- illustrator-cs5/
    For more, please refer to the Illustrator CS5 help docs on Perspective drawing.

  • Create offline interactive forms using webdynpro java with XML data source

    Hi Gurus,
    I am having a scenario like below:
    Sales guy request for order list online from portal- Sytem receives the request and creat XML file- from xml file need to create a Offline interactive form-Sales guy fills it offline at customer site- uploads in portal -on submit xml has to be generated with captured data at customer site-Process to  ECC.
    So my questions are:
    How to create the offline interactive form  from XML?
    Once filled offline interactive form uploaded into portal how to create XML again from pdf ?
    Please give some idea on this as this is my first Offline interactive form using XML datasource.
    Thanks
    Ravi
    Edited by: Ravi Sunkara on Jul 27, 2010 5:25 PM

    Hi Otto,
    Sorry for replying lately. First of all  I did not get your suggestions as your are editing the same posting.
    Secondly we will be using WDJ. Actually in between SAP Portal and ECC we are having adobe LCES so we need to create Interactive form using XML only. Once it is filled again the form will be submitted to another application which is running on FLEX, which will process the order.
    if you can give me your personal id i can send you the detailed process
    Thanks
    Ravi

  • Using 2 Minis with only 1 monitor

    I have posted elsewhere about the possibility of using 2 Minis (one PPC and one Intel core duo) with only a single monitor, keyboard and mouse.
    I thought that Apple Target Disk Mode would be the answer,but I was reminded here that the remote Mac would only be useable as an external HD, not as a computer.
    I am wondering therefore if a KVM switch is what I need, to operate either one Mac or the other. Then I would only use the FW remote control when I needed to transfer files.
    Belkin makes one such KVM switch for the Mac mini, exactly the same footprint and finish, but rather pricey. There may be similar devices from other makers, possibly cheaper.
    If anyone who used one of these KVM switches could give us some comments it would be much appreciated.

    A USB-based KVM switch would be a good way to go.
    If your connection to your monitor is digital, rather than VGA, these switches are somewhat expensive.
    If you are willing to use VGA, then there are many options available in KVM switches at reasonable prices.
    I'd recommend buying from a store with easy return policies, because it can take a few tries to get a model that suits your hardware.
    Depending on how you intend to use your secondary Mini, a network remote control program like VNC might be a reasonable alternative to a KVM.
    And transferring files through ethernet cable, an alternative to using Target Disk Mode.

  • I would like to use your 6035E with Matlab, Data aquisition toolbox.

    What drivers do I have to have to use the 6035E AD card with Matlab, Data aquisition toolbox?
    thanks

    You will have to check with Mathworks and see if they have a driver for that board that works with their software.
    Otis
    Training and Certification
    Product Support Engineer
    National Instruments

Maybe you are looking for

  • Program for Automatic Payment Transaction

    Hi All, I'm trying to generate the spool for APP through F110 transaction. The program I configured is the standard program <b>RFFOEDI1</b> in the Printout/Data Medium tab. I'm sure that along with the above program, the program RFFOUS_C will also ge

  • Laptop recommendations for a graphic designer?

    I am trying to figure what laptop I'd want to upgrade to since I'll be doing Graphic Design work very soon for college online. I have never been a Mac user but I know that the Mac notebooks can come with a lot of great tools for graphic design. When

  • Display only the last record per material in SAP query

    Hi, I have created a SAP Query using the quickviewer that is a join between 2 tables (MSEG and MKPF) that consist of material document information and date of posting. The results are fine however I would like only the last record per material to be

  • Any other ideas on the reception issue?

    I am wanting to ask if anyone else has any other ideas on fixing the reception issue? I just got off the phone with an Apple "Supervisor". He agreed with me that the software update will only correctly display AT&T's signal that I am getting. He agre

  • Fontagent Pro 4.0.2 is very slow on importing fonts

    Everytime I try to import fonts into Fontagent, I have to wait a looong time. Importing 16 fonts with about 162 files took about 15(!) minutes. Furthermore, if FAP is unable to import a certain font, it does not display a warning message. Instead it