Problem with my aggregate function

Hello

I tried to build my own global function in the chain, but I have a problem when I use it in my application. When I'm with her, he wrote ORA904, considering that this idenfifier exists. Do you know what is the problem?

here my aggregate function:
create or replace FUNCTION aggme (query_in in VARCHAR2) RETURN VARCHAR2 IS
    incoming    varchar2(4000);
    hold_result varchar2(4000);
    c sys_refcursor;
Begin
    open c for query_in;
    loop
        fetch c into incoming;
        exit when c%notfound;
        hold_result := hold_result||','||incoming;
    end loop;
    return ltrim(hold_result,',');
END;
and here my request using my aggregate function aggme:
select
  RES.LASTNAME as "LASTNAME",
  RES.FIRSTNAME as "FIRSTNAME",
  aggme('select NAME from PATHOLOGY where ID= RES.PATHOLOGY_ID') as "PATHOLOGY"
from
  TBK_RESOURCE RES

user539451 wrote:
Hi BluShadow,

I followed your advice and try to use the aggregation of clob. No problem to compile the function but when I use the clobagg to my query, is not aggregated. Perhaps, I don't use it correctly.

select
RES.PATIENT_LASTNAME as "LASTNAME",
RES.PATIENT_FIRSTNAME as "FIRSTNAME",
(select trim(',' from clobagg(name||',')) as "pathology" from pathology where ID= RES.PATHOLOGY_ID)
FROM
TBK_RESOURCE RES

output, I have:

FIRSTNAME. LASTNAME. PATHOLOGY
TOTO | OTOT | ACB
TOTO | OTOT | GB

instead of having:
TOTO OTOT ACB, GB

Well, I don't have data to work with, but it works well for me...

SQL> ed
Wrote file afiedt.buf

  1  with t as (select 'TOTO' as FIRSTNAME, 'OTOT' as LASTNAME, 'PBR' as PATHOLOGY from dual union all
  2             select 'TOTO', 'OTOT', 'GB' from dual)
  3  --
  4  -- end of test data
  5  --
  6  select firstname, lastname
  7        ,trim(',' from clobagg(pathology||',')) as pathology
  8  from t
  9* group by firstname, lastname
SQL> /

FIRS LAST PATHOLOGY
---- ---- --------------------------------------------------------------------------------
TOTO OTOT PBR,GB

Tags: Database

Similar Questions

  • Problems with the Row_Number function

    I have problems with the Row_Number function. I use to assign line numbers to records where a student has a note of passage on a module and the exclusion of the modules failed (I want to show her a 0 as the line number for the modules failed). The problem is that when I try to use a condition, the report still assigns a line number to a defective module if it does not display it (it shows a 0 I wanted to show him). The results are displayed as follows:

    Line number Module Grade
    1ModuleAPass
    2ModuleBPass
    0ModuleCIn case of failure
    4 (instead of 3)ModuleDPass

    How can I make him jump to assign a line number to all the modules failed? Please help.

    Thank you.

    Thank you very much, Melanie. I made changes to query as per your suggestion, which is a union of the modules failed and passed (using row_number on success modules). Thanks for the solution.

  • Problem with the GetParameter() function in IScript

    Hello

    I am facing a problem with the GetParameter() function in IScript. I created a URL below and appellant IScript

    GenerateScriptContentURL ("EMPLOYEE", "MFC", Record.WEBLIB_REPT_SJ, Field.ISCRIPT1, "FieldFormula", "IScript_GetAttachment"). "? FileName =' | & AttachUserFileURL;

    before generating URLS, I'm just encrypt the name of the ZIP file & assignment in the variable string & AttachUserFileURL I concatenated in link above.

    and try to take the value encrypted text of decryption by %Request.GetParameter("FileName") in IScript who isn't able to get special characters such as +, is.

    Please get this.

    Thank you

    Edited by: 936729 may 25, 2012 03:35

    + and = are allowed in URLS. You just have to URL encode like this EncodeURLForQueryString(&AttachUserFileURL) before adding them to your URL:

    GenerateScriptContentURL("EMPLOYEE", "HRMS", Record.WEBLIB_REPT_SJ, Field.ISCRIPT1, "FieldFormula", "IScript_GetAttachment") | "?FileName=" | EncodeURLForQueryString(&AttachUserFileURL);
    

    Here is the entrance of PeopleBook for EncodeURLForQueryString:

    http://docs.Oracle.com/CD/E28394_01/pt852pbh1/Eng/psbooks/TPCL/htm/tpcl02.htm#_6453b1b1_1355ab71343__503e

  • Bug with the aggregate function and no group

    When I run the following query:
    with the_table as
    (
      select 1 as id, 100 as cost from dual
      union all select 2 as id, 200 as cost from dual
      union all select 3 as id, 300 as cost from dual
      union all select 4 as id, 400 as cost from dual
      union all select 5 as id, 500 as cost from dual
    )
    select id, cost
    from
    (
      select id, cost
      from the_table
      --
      union all
      --
      select 0 as id, sum(cost) as cost
      from the_table
      where 0 = 1
      -- group by 1
    )
    order by id;
    I get this result:
    ID    COST
    --  ------
     0  <null>     
     1     100
     2     200
     3     300
     4     400
     5     500
    However, when I "uncomment" the line "Group 1", the query works as expected (without the id = rank 0).

    This occurs even when "the_table" is an array.

    Someone else comes through this (and if so, how long is a problem)?

    The database is 11.2.0.2.0 64-bit.

    EDIT: It also happens without a Union - the following returns a single line (with null 0 and cost of id) without the Group By and no line with her:
    select id, cost
    from
    (
      select 0 as id, sum(cost) as cost
      from 
      (
        select 1 as id, 100 as cost from dual
        union all select 2 as id, 200 as cost from dual
        union all select 3 as id, 300 as cost from dual
        union all select 4 as id, 400 as cost from dual
        union all select 5 as id, 500 as cost from dual
      )
      where 0 = 1
      -- group by 1
    )
    order by id
    Edited by: Donbot February 15, 2012 10:29

    Donbot wrote:
    Someone else comes through this (and if so, how long is a problem)?

    The database is 11.2.0.2.0 64-bit.

    This is a documented behavior.

    http://docs.Oracle.com/CD/E11882_01/server.112/e26088/functions003.htm#SQLRF20035

    "
    All except COUNT (*) GROUPING and GROUPING_ID aggregate functions ignore NULL values. You can use the NVL function in the argument of an aggregation function to substitute a value for a null value. COUNTY and REGR_COUNT never return null, but return a number or zero. For all remaining functions of aggregation, * if the DataSet contains no line, * or if it contains only the rows with NULL values as arguments to the aggregate function, * then the function returns null.*
    "

  • Problem with the search function

    I use firefox 10 and I have a problem with the search feature. If the word that I will try to find begins with the capital letter I can't find with control function if I write the word only with small letters. a the opposite. For example, if the word is 'Letter' I can't find this word if I type 'letter' in the search bar

    Is the option 'Option match case' in the verified search bar? If so, uncheck it.

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You may need to update some plug-ins. Check your plug-ins and update if necessary:

  • Problem with current path function screws...

    Hello world...

    Yesterday my application suddenly started to behave in a weird way...

    I have a Sub VI, in which I currently have function of path of screws. I created my app executable. launched and observed the current path of screws gives me some stupid trail all of a sudden.

    It should give me...            Program files\application\app.exe\subVI.vi

    but I'm files\application\app.exe\D:\Application name\sub directory\subvi.vi program

    "D:\Application name\sub directory\subvi.vi", this is the path where the real VI was located on the development computer

    While preparing the exe, I have selected "same as appellant" in the destination domain.

    and you know what?... This occurs only for a project.all other applications are very well... and still I created a test project and tried to reproduce this problem in that. but I'm way in the test EXE project...

    I don't know if I'm the first person to get that kind of weird error with current path of screw...

    I solved my problem at present using the property node: App Dir that I just wanted to know where my EXE is installed...

    Thank you

    Anil

    You're running in one of the new features in LabVIEW 2009. In order to solve the problem where by LabVIEW could end up having tons of screws outside the executable if LVLib or LVClasses was used, NOR changed the internal structure of a LabVIEW EXE to have folders rather than just a flat file list. This is a great advantage if your like me and use classes and lvlibs, but means that the old logic for dynamically calling screws must be changed a bit

    If you want the old behavior, check the advanced settings in the build definition and look for a setting called "8.x File layout" (or something like that).

  • Problem with copy paste function (for images) using the TinyMCE editor

    Can not copy paste images (a document - text Copies OK) to the tinyMCE editor in Windows 8. Seems to be the specific question of operating system.

    Use the tinyMCE editor for info on the download Web site. Copy-paste function works very well on a Windows7 machine

    Hi Anand,

    I would be grateful if you can help me with the following information related to the TinyMCE editor:

    1. What is the Web browser that you use to copy and paste images via the application editor TinyMCE?
    2. What exactly happens when you try to copy and paste images using the editor? You receive an error message?

    This problem may occur because of the compatibility of the browser with the TinyMCE editor.

    Check out these links and check if the suggestions help you to solve the problem:

    http://www.TinyMCE.com/forum/viewtopic.php?PID=34916

    http://www.TinyMCE.com/develop/bugtracker_view.php?id=6075

    If the problem is specific to the TinyMCE editor, you can also contact the support of TinyMCE:

    http://www.TinyMCE.com/enterprise/support.php

    Please let us know if you need more help on this issue. Otherwise, feel free to ask for more queries on Windows.

  • Problem with validation popup function and af bean.

    I have the following code from the model:

    View1.JSPX contains a popup with 2 text entry. the text of entry has a custom validator (is not allowing the user to enter text containing 'A'):
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1">
          <af:form id="f1">
          <af:commandButton text="Show Popup" id="cb1">
            <af:showPopupBehavior popupId="p1Adauga2"/>
          </af:commandButton>
          <af:popup id="p1Adauga2">
            <af:panelWindow id="pw2" title="Adauga entitate la lista">
              <af:panelGroupLayout id="pgl7" layout="horizontal" halign="center"
                                   valign="top">
                <af:panelFormLayout id="pfl1">
                  <af:inputText label="text1:"
                                maximumLength="10"
                                id="it11" 
                                rendered="true"
                                validator="#{TestBean.validateText1}"
                                autoSubmit="true">
                  </af:inputText>
                  <af:inputText label="text2:"
                                maximumLength="10"
                                id="it9"
                                rendered="true">
                  </af:inputText>
                </af:panelFormLayout>
                <af:spacer width="10" height="30" id="s7"/>
              </af:panelGroupLayout>
              <af:panelGroupLayout id="pgl8" layout="horizontal" valign="bottom"
                                   halign="center">
                <af:commandButton text="Add" id="cb11Adauga"/>
                <af:spacer width="10" height="30" id="s9"/>
              </af:panelGroupLayout>
            </af:panelWindow>
          </af:popup>
          </af:form>
        </af:document>
      </f:view>
    </jsp:root>
    The validation function is contained in a bean managed with a scope of application:
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    
    public class TestBean {
        public TestBean() {
        }
    
        public void validateText1(FacesContext facesContext,
                                  UIComponent uIComponent, Object object) {
            String val = (String) object;
            if (val.contains("A")) {
              FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, 
                                                      "Eroare", "Cannot contain A");
              facesContext.addMessage(uIComponent.getClientId(facesContext), 
                                      message);
              ((RichInputText)uIComponent).setValid(false);
            }
        }
    }
    My problem:

    1. I enter invalid text
    2. an error message is displayed, saying that that text I put in place is not valid.
    3. I press the Add - button the popup is closed. Why? The component is not valid. Shouldn't the blocked popup until all text entry are valid?

    How to achieve this.

    Please see the screenshot below, it better describes my problem:


    Published by: Andrei Ciobanu on 12 Aug 2011 06:16

    Published by: Andrei Ciobanu on 12 Aug 2011 06:19

    You should read the documentation of af: popup [http://download.oracle.com/docs/cd/E16162_01/apirefs.1112/e17491/tagdoc/af_popup.html url] and understand everything about auto-licenciement

  • Problems with the sound function and scrolling on the touchpad on my Satellite A500/026

    Hello

    I just brought a new laptop A500/026 and when I play music from my ipod I get a little static pop sound at regular intervals during the song... this happens on all my music. I accidentally scroll horizontally through my touhpad and my screen minimizes or maximizes. I try to find how I did it, but can never seem to return to its normal state. There is obviously some sort of function here, can someone help me with it? I installed the x 64 bit version of windows 7.

    Thank you

    Eddie

    Hello

    The touchpad settings are placed in Control Panel-> mouse
    You can find the additional tab which would be you can access touchpad properties.

    As I know the touchpad properties contains many different options that allows you to configure the scrolling function, to activate and assign different actions to the touchpad corners, etc.

    Check it!

  • problems with pallets of functions/commands

    Hey everybody,

    Recently I had to reformat my hard drive and reinstall Labview from scratch.

    Previously, when I right click on the BD or FP, I'd get my pallets of functions/commands as a list of text for me to choose.

    Now, I can't to the way it was. First of all, when I right click, I get only an option to choose a vi in a file. Programming, mathematics, connectivity, pallets etc are gone from that. I can go to view-> set of features and I get my palette of functions in this way, but I can't set it to the only option of text-list, and I'd really rather just right click my FP or BD. Any suggestions?

    Thanks in advance.


  • Pivot with several aggregate function calls?

    Hello

    You use Oracle 11 g R2, with APEX 4.2.3 I'm taking of the cross tab (pivot) built this query:

    Start
    return ' with pivot_data like)
    SELECT department_id, job_id, salary
    Of oehr_employees
    )
    SELECT *.
    OF pivot_data
    PIVOT)
    Salary
    FOR department_id
    IN ('| v ('P5_DEPT_LIST') |')
    )';
    end;

    That works very well and add in the comm column and also have the sum of pivot and build department_id in database columns...  I've not found no documents showing how have several columns summed up in a pivot query again.

    Any ideas?

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

    TexasApexDeveloper wrote:

    I've not found no documents showing how have several columns summed up in a pivot query again.

    Not even THE official documentation?

    http://docs.Oracle.com/CD/E11882_01/server.112/e25554/analysis.htm#DWHSG8731

  • I have problems with the sensitive function by using bootstrap? My navigation bar is elegantly expansion and contraction, but my image of lead left at some point and the navigation bar extends beyond? Is there an optimal size should I use?

    And here's the code? Am new to this so we have recently upgraded to this version of the Creative Suite? Really like the design and functionality, but can't seem to get my header image at the top to fill the screens? It's using the latest Mac version.

    <! DOCTYPE html >

    < html lang = "en" >

    < head >

    < meta charset = "UTF-8" >

    < meta http-equiv = "X-UA-Compatible" content = "IE = edge" >

    < meta name = "viewport" content = "width = device-width, original scale = 1" >

    < title > wastewater education 501 c 3 < /title >

    <!-"bootstrap"->

    < link href = "css/bootstrap.css" rel = "stylesheet" > "

    < style type = "text/css" >

    .the {}

    Width: 100%;

    position: relative;

    }

    . Right {}

    }

    < / style >

    <! - HTML5 shim and Respond.js for IE8 take in charge of the HTML5 elements and questions from the media - >

    <!-WARNING: Respond.js does not work if you view the page via file://-->

    <!-[if lt IE 9] >

    " < script src =" https://OSS.MaxCDN.com/html5shiv/3.7.2/html5shiv.min.js "> < / script > .

    " < script src =" https://OSS.MaxCDN.com/respond/1.4.2/respond.min.js "> < / script > .

    <! [endif]-->

    < / head >

    < body >

    < div class = "container-fluid" >

    "< img src="images/2015/2015header.jpg "class ="img-reagent"alt =" WasteWaterEducation.org logo ">

    < nav class = "navbar, navbar-reverse" >

    <!-brand and toggle get grouped together for better mobile display->

    < div class = "bar navigation-header" >

    < button type = "button" class = "toggle navigation bar has collapsed" data-toggle = 'collapse' data-target = "#inverseNavbar1" > < span class = 'sr-only' > toggle navigation </span > < span class = 'bar icons' > < / span > < span class = 'bar icons' > < / span > < span class = 'bar icons' > < / span > < / button >

    < a class = 'bar of navigation-brand' href = "index.html" > home < /a > < / div >

    <!-collect the nav links, forms, and other content to alternate->

    < div class = "navbar-collapse collapse" id = "inverseNavbar1" >

    < ul class = "navbar-nav nav" >

    < class li = "active" > < a href = "whatsnew.html" > What's New! ' " < span class = "sr only" > (ongoing) </span > < /a > < /li >

    < class li = "active" > < a href = "boardlist.html" > about us < span class = "sr only" > (ongoing) </span > < /a > < /li > "

    < class li = "active" > < a href = "search.html" > this Site Search < span class = 'sr-only' > (ongoing) </span > < /a > < /li >

    < /ul >

    < ul class = "navbar-nav, navbar-right nav" >

    < li > < a href = "newsletter.html" > subscribe to updates < /a > < /li > "

    < /ul >

    < / div >

    <!-/ .navbar-collapse->

    < / div >

    <!-/ .container-fluid->

    < / nav >

    Because the image is 1000 x 364, it will extend not to a larger size unless you give the instruction to do so.

    The best way is to assign the image to a width of 100% and make sure the extra size has not negatively affected the quality of the image.

  • Anyone having problems with the export function 20141

    I've recently updated to InDesign 20141 and am having annoying problems try to export jpg, PDF files and print pages. It is a large part of my work and I need to do this for every job, every day. Also when I try to open the files from the Finder it gives me an error message saying "cannot open the document. You may not have permission... "No one has the file open and I have to read the information and then close the information window to open the file. I've been waiting for an update solve these problems, but it didn't happen. I'll have to use computers of others make export that I do and I am getting fed up. Help, please.

    What operating system? Looks like it's maybe a permissions issue. If a Mac, go to Applications > utilities > disk utility, select your drive and choose repair disk permissions.

  • Problem with the not() function

    Hello

    I saw on the various posts that there is a function to make a 'not like' combining funtion 'not' and 'contains' but when I do the one, it contains works fine but when I got the no, the test set is a failure.
    For example, I did the following test:

    <? If@inlines:not(contains('OTHERS',ENT_CODE))? >

    I don't know why this test does not work if someone has some tips.

    Concerning

    You can try the other way around?

  • Problems with the search function

    Hello!

    I have links to projectB projectA. When I open the projectA.chm the doesn´t of research show (topics) results of project b. (even with keywords in the index). Can I change this?

    Janine

    Hi Janine

    I noticed you said "projectA links for that project b. Does this mean that you do not have merge two projects? Note that simply create a link from one project to another does not cause a merger to occur. It simply allows to temporarily show the subject of the other project.

    If you merge, you insert a reference in your table of contents and a behiind the scenes file that sets things upwards so that the search and Index entries are now mixed that you are looking for.

    See you soon... Rick

    Useful and practical links

    Wish to RoboHelp form/Bug report form

    Begin to learn RoboHelp HTML 7 or 8 days - $24.95!

    Adobe Certified RoboHelp HTML Training

    SorcerStone blog

    RoboHelp EBooks

Maybe you are looking for