Howto make view from this query?

Dear forum members,
I have a cursor like this:
  for email_record IN (
    select distinct email_address_1 email_address
    from cl_employees
    where employees_pk in (
      (select responsible_fk from cl_jobs where jobs_pk=l_jobs_pk)
      union
      (select cutter_fk from cl_jobs where jobs_pk=l_jobs_pk)
      union
      (select line_producer_fk from cl_jobs where jobs_pk=l_jobs_pk))) LOOP
        if email_record.email_address is not null then
          l_to:=l_to||email_record.email_address||',';
        end if;
        l_counter:=l_counter+1;
      end loop;Is there any posibility to make a view out of this select statement, so that the cursor will be something like:
  for email_record IN (
    select email_address
    from view_mailaddresses
    where jobs_pk=l_jobs_pk) LOOP
        if email_record.email_address is not null then
          l_to:=l_to||email_record.email_address||',';
        end if;
        l_counter:=l_counter+1;
      end loop;Thanks in advance
Johann

sybrand_b wrote:
and that's all there is to it.Not quite:
SQL> create table cl_employees (employees_pk,email_address_1,jobs_pk) as select 1, '[email protected]', 1 from dual
  2  /
Table created.
SQL> create table cl_jobs (jobs_pk,responsible_fk,cutter_fk,line_producer_fk) as select 1, 1, 1, 1 from dual
  2  /
Table created.
SQL> create or replace view view_mailaddresses
  2  (email_address)
  3  as
  4  select distinct email_address_1 email_address
  5  from cl_employees
  6  where employees_pk in (
  7  (select responsible_fk from cl_jobs where jobs_pk=l_jobs_pk)
  8  union
  9  (select cutter_fk from cl_jobs where jobs_pk=l_jobs_pk)
10  union
11  (select line_producer_fk from cl_jobs where jobs_pk=l_jobs_pk)))
12  /
(select line_producer_fk from cl_jobs where jobs_pk=l_jobs_pk)))
ERROR at line 11:
ORA-00933: SQL command not properly ended
SQL> create or replace view view_mailaddresses
  2  (email_address)
  3  as
  4  select distinct email_address_1 email_address
  5  from cl_employees
  6  where employees_pk in (
  7  (select responsible_fk from cl_jobs where jobs_pk=l_jobs_pk)
  8  union
  9  (select cutter_fk from cl_jobs where jobs_pk=l_jobs_pk)
10  union
11  (select line_producer_fk from cl_jobs where jobs_pk=l_jobs_pk))
12  /
(select responsible_fk from cl_jobs where jobs_pk=l_jobs_pk)
ERROR at line 7:
ORA-00904: "L_JOBS_PK": invalid identifierNo thousand guilders for you :-)
Regards,
Rob.

Similar Messages

  • Single row from this query without create a group by

    Can I have a single row from this query without create a group by on tipo (TIPO can have only 2 value (A,D)
    SELECT
    CASE TIPO
    WHEN 'D' THEN SUM(IMPORTO) ELSE 0 END DIMPORTO,
    CASE TIPO
    WHEN 'A' THEN SUM(IMPORTO) ELSE 0 END AIMPORTO
    FROM MGIORNALE
    WHERE K_CONTO = '100001' --CONTO
    AND DECODE(T_MOVIM,'MRAP',TO_DATE('31/12/'||to_char(a_competenza),'DD/MM/YYYY'),DATA_RG)
    -- BETWEEN DATAA AND DATAB
    BETWEEN '01/01/2006' AND '31/12/2006'
    --GROUP BY TIPO
    --AND TIPO = COL_conto
    Thanks in advance

    Is like this?
    sum (CASE TIPO
    WHEN 'D' THEN IMPORTO ELSE 0 END) DIMPORTO,

  • HELP! How to make RRI from BEX query into Workbook with one report???

    How to make RRI from query into Workbook???

    Hi Alex,
    A workbook is a set format of queries, so when you try to jump to another query , you will definitely open another session and hence another excel file. This is the same for web templates also though you have an option of opening the new result in the same window.
    You would have to use some macros and open the query on the same page. A RRI is a query jump and not a drill down . A drill down would be getting more of the dimensions into the query.
    Regards
    CSM Reddy

  • Why can I not make purchases from this computer?

    When I try to make an I tunes purchase from this computer I get a notice that I can not and referring me to this site. This computer is authorized and my account is up to date and I have no problem from my other computers.
    I would sure like to speak to a warm blooded voice.

    I'm having this problem on my iPhone and iPad when trying to purchase

  • Using "Object from this query" as a filter parameter

    Hi Folks,
    I am looking to find a solution to a requirement where I need to filter data in a report based on the current year. I do not want to use the BEx functionality for filtering and want to leverage the BObj query filters. My idea was to create a "variable" in the BObj query to get the current year and hopefully use that as a filter parameter for 'Object in this query". But The options "Object in this query" and "Result from another query" are greyed out. I am using BObj 4.0 patch 12.
    Do any of you have suggestions on how to accomplish this.
    Regards,
    Doniv

    Hi,
    prerequisite to using the operators you mention is to have 2 dataproviders queries first.
    However, it might be that those kind of operators aren't implemented for the current BICS interface, same goes with Unions, OR operator.
    I know you can do this with Relational UNX, but BEX direct access has shortcomings in the query panel.
    might be worth to try this again if you can get your hands on FP03 ramp up.  things change again , for the better, there.
    Regards,
    H

  • Exclude A/P Credit Memo from this Query

    Hello All,
    i am trying to figure out to exclude A/P Invoice that it was already Credit Memo with my existing Query
    SELECT
    max(T0.DocDate) as 'Date',
    max(T1.CardName) as 'Vendor Name',
    max(T0.Address) as 'Vendor Address',
    count(T0.DocNum) as 'No. of Invoices',
    max(T1.LicTradNum) as 'TIN No.',
    sum(T0.BaseAmnt) as 'Base Amount',
    sum(T0.VatSum) as 'Input Tax',
    max(T1.ECVatGroup ) as 'TaxCode',
    max(T2.WTCode) as 'WtaxCode'
    FROM OPCH T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
    left join PCH5 T2 on T0.DocEntry = T2.AbsEntry
    WHERE T0.DocDate BETWEEN '[%0]' and '[%1]' and T0.VatSum <> 0
    GROUP BY T1.CardCode
    Please help mew revise my Query.
    this is connected with my previous question How to Identify A/P Invoice that was Credit Memo  but i cannot figure out how to incorporate PCH1.TargetEntry
    Please Help.
    Thank You.
    Fidel

    try the below query
    SELECT 
    max(T0.DocDate) as 'Date', 
    max(T1.CardName) as 'Vendor Name', 
    max(T0.Address) as 'Vendor Address', 
    count(T0.DocNum) as 'No. of Invoices', 
    COUNT(T5.DocNum) AS 'No of Credit Memos',
    max(T1.LicTradNum) as 'TIN No.', 
    sum(T0.BaseAmnt) as 'Base Amount', 
    sum(T0.VatSum) as 'Input Tax', 
    max(T1.ECVatGroup ) as 'TaxCode', 
    max(T2.WTCode) as 'WtaxCode' 
    FROM OPCH T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode  
    INNER JOIN pch1 t3 ON t3.DocEntry=t0.DocEntry
    LEFT JOIN dbo.RPC1 T4 ON T4.BaseEntry=T3.DocEntry left JOIN dbo.ORPC T5 ON T5.DocEntry=T4.DocEntry
    left join PCH5 T2 on T0.DocEntry = T2.AbsEntry 
    WHERE T0.DocDate BETWEEN '[%0]' and '[%1]' and T0.VatSum <> 0  
    GROUP BY T1.CardCode 
    --Manish

  • WINPE: different keyboard howto make iso from wim?

    Hi,
    I have created a winpe image with different keyboard by this link
    http://www.windows-noob.com/forums/index.php?/topic/2348-guide-creating-a-bootimage-with-another-keyboard-layout-winpe-3/
    However, I have a WIM and need to have an ISO to be able to boot make a bootable USB.
    Please advise howto.
    J.
    Jan Hoedt

    Poorly documented sure !
    But that's not so difficult. The procedure link I gave you will make you have a bootable USB key with a standard WinPE. Then you just have to replace the boot.wim in the USB key with your own customized WinPE image (just rename it to boot.wim).
    For what it's worth there's in my signature a script that does the keyboard layout change among other stuff (adding files, adding components).
    Mickael,
    My technet galleries contributions :
    ConfigMgr driver injector
    SCCM Collection splitter
    ConfigMgr TS Tools
    Customize WinPE images with powershell

  • No data found in the discoverer Viewer from Apps responsabiltiy

    Hi
    We have built a new responsibility for the discoverer reports, that is we directly access the discoverer viewer from the separate responsibility,all the report that shared with the users can be viewed from this responsibility,
    but when the user tries to run the report it is saying no data found.but for example if the user is trying to run the hrms report from this discoverer reasonability he get no data found but if we attach the function to the HRMS manager menu and try to access the report from the HRMS manager responsabilty we are able to get the data.
    We did the same setup in dev and test.in dev it is working very fine but in test we are not able to see the records in the report if we try to access.
    Please advice
    thanks
    Regards
    Ramesh Kumar S

    Hi,
    I'm not 100% familiar with HR security, but sounds like profile option setup related to security - perhaps Business Group or Initialization SQL Statement - Oracle / Custom? Check the profile options set for the HRMS Manager responsibility and setup the same for your new responsibility.
    PS. Similar sort of thing exists in General Ledger related to security. See:
    GL security issue in discoverer..
    Regards,
    Gareth

  • Help in Tuning this Query

    Hi,
    I have a query in my proj where the same table is looked up twice in the same query.
    Can anybody suggest in improving the performance of this query?
    select * from table1 a1 where (a1.column1, a1.column2, a1.column3, a1.column4, a1.column5, a1.column6, a1.column7, a1.column8, a1.column9,
    a1.column10) in ( select a2.column1, a2.column2, a2.column3, a2.column4, a2.column5, a2.column6, a2.column7, a2.column8, a2.column9,
    a2.column10 from table1 a2 where column20 = '<condn>')
    The table1 used here is same in outer query as well as the sub query. this is a example of what we use here, and the table1 contains 30 million rows. Though, creating index with 10 columns can be a option, we already have a unique index with 11 columns(which includes 10 from this query) and will that be helpful in anyway? or the same existing index can be forced?
    Thanks a lot for ur time

    Depending on the selectivity of column20 I am not sure Index is the best way to go. It might perform better with two full scans and a hash-join.
    Anyway, I do prefer the syntax:
    select /*+ leading(a2) */ a1.*
    from table1 a1, table1 a2
    where a2.column20 = '<condn>'
    and a1.column1 = a2.column1
    and a1.column2 = a2.column2
    and  a1.column3 = a2.column3
    and  a1.column4 = a2.column4
    and  a1.column5 = a2.column5
    and  a1.column6 = a2.column6
    and  a1.column7 = a2.column7
    and  a1.column8 = a2.column8
    and  a1.column9 = a2.column9
    and  a1.column10 = a2.column10;I've added a leading hint to tell oracle that the start table is a2. Might be useless.
    Ensure your stats are up to date. You might need histograms here if your column20 is skewed.
    Hope this helps,
    François
    Edited by: Francois Berger on Oct 24, 2008 1:47 AM

  • Returning a count from a query using Union

    Hi. I'm attempting to select a count from this query and then display the total in a message, but I'm getting a 'Too many rows returned' (ORA-01422). Can anyone tell me how I can achieve a total for this query?
             SELECT nvl(count(*),0)
           INTO conflict_cnt
           FROM dropper_assign
           WHERE dropper_id = :dropper_vacations.dropper_id AND
                trunc(sched_date) between :begin_dt and :end_dt
              union                          
       SELECT nvl(count(*),0)
        FROM exfc.bundle a, splits b
        WHERE a.bundle = b.bundle AND
             b.dropper_id = :dropper_vacations.dropper_id AND
             trunc(a.actual_dt) between :begin_dt and :end_dt;
              call_alert.the_error('test: '||to_char(conflict_cnt));Any help would be greatly appreciated.

    Thanks Christian, I can know return to my favourite present occupation named HOLIDAYS ;)
    btw with count function as the first message
    WITH
      data AS
        SELECT
          COUNT(*) cnt
        FROM
          dual
          CONNECT BY level <= 10
        UNION
        SELECT
          COUNT(*) cnt
        FROM
          dual
          CONNECT BY level <= 20
    SELECT
      SUM(cnt)
    FROM
      data
    SUM(CNT)              
    30        
    /* and */
    WITH
      data AS
        SELECT
          COUNT(*) cnt
        FROM
          dual
          CONNECT BY level <= 10
        UNION ALL /****** returns me also 30 *****/
        SELECT
          COUNT(*) cnt
        FROM
          dual
          CONNECT BY level <= 20
    SELECT
      SUM(cnt)
    FROM
      data
    SUM(CNT)              
    30       result will defer only if both count return exactly the same value so definitely UNION ALL for that case or the simple solution I have provided before ...
    but leave it. that's enough messages for this thread ;)
    Jean-Yves
    Edited by: JeanYves Bernier on 9 août 2011 17:42

  • How to count no of records returned from a query?

    Hello,
    I need to find out how many records displayed from a query without writing any other queries.
    i mean that.
    I have a query such as:
    query = "select * from users";
    and the resultset for it is rs.
    and i need to display how many records fetched from this query without using any other query such as "select count(user_id) from users" etc.
    Is there any function ?

    No, unfortunately there is no method or property that will tell you how many rows have been returned by a query.
    People use many different techniques.
    1.The simplest would be, keep incrementing a counter in while ( rs.next() ) and at the end you'll have the count. But only at the end, after the loop.
    2. Run another query with count(*) just to fetch the count.
    3. Run the same query twice, once for counting and then again for printing out. Very dumb idea though, might as well do 2. suggested above.
    4. If you have a scrollable resultset, you could go to the lastRecord and then getRow number and hence know how many there are and then rewind the resultset. I don't know how advisable using scrollable resultsets is.
    5. Create a slightly clumsy query like : select count(*) as "totalcount", emp_id, emp_name, emp_email, emp_phone from employees group by emp_id, emp_name, emp_email, emp_phone. You'll need to use the group by clause since count() is an aggregate function and you can't mix aggregate functions and columns unless you add the group by to all the columns you're fetching.

  • SharePoint 2013 List View with query string filter stops working after editing view from browser

    I have created one list definition in which I have added one list view which will filter data from query string paramater
    So when I am creating list from my list definition, view with query string filter is working fine.
    But when I am modifying view from UI(I am not changing any thing , just opening "Modify View" page and then click on "Save" button), view gets stop working means it's not filtering data based on query string
    Any suggestion what I am missing?
    Below is my list view schema
    <View BaseViewID="11" Type="HTML" TabularView="FALSE" WebPartZoneID="Main" DisplayName="$Resources:OIPLBScoreCard,viewFilterTasksByTarget;" MobileView="True" MobileDefaultView="False" Url="FilteredTasks.aspx" SetupPath="pages\viewpage.aspx" DefaultView="FALSE" ImageUrl="/_layouts/15/images/issuelst.png?rev=23">
    <Toolbar Type="Standard" />
    <ParameterBindings>
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
    <ParameterBinding Name="TargetId" Location="QueryString(TargetId)" />
    </ParameterBindings>
    <JSLink>hierarchytaskslist.js</JSLink>
    <XslLink Default="TRUE">main.xsl</XslLink>
    <JSLink>clienttemplates.js</JSLink>
    <RowLimit Paged="TRUE">100</RowLimit>
    <ViewFields>
    <FieldRef Name="Body"></FieldRef>
    <FieldRef Name="Title"></FieldRef>
    <FieldRef Name="StartDate"></FieldRef>
    <FieldRef Name="DueDate"></FieldRef>
    </ViewFields>
    <ViewData>
    <FieldRef Name="PercentComplete" Type="StrikeThroughPercentComplete"></FieldRef>
    <FieldRef Name="DueDate" Type="TimelineDueDate"></FieldRef>
    </ViewData>
    <Query>
    <Where>
    <Eq>
    <FieldRef Name="oipscTargetLookup" LookupId="TRUE"/>
    <Value Type="Lookup">{TargetId}</Value>
    </Eq>
    </Where>
    </Query>
    </View>
    I have one lookup field from "Target List" in my source list and I want to filter data based on that lookup field.

    Hi JayJT,
    The Miscellaneous is located in the contact list that you used for the connection.
    So , you need to edit the page, then edit the contact list that you used, in the web part properties of the contact list, you will find Miscellaneous, then expand it and select ‘Server Render’ .
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Unable to create visual composer table view from the Bex Query

    Hi
    I am trying to create the visual composer lay out from a Bex query. The Bex query contains a set of Key figures and a structure.
    These key figure and structure combination is forming a table in the query output. Key figure parameters are coming as rows and Structure parameters are coming as columns.
    example query out put:
    Total, HPC, FDS excel ICe etc are as Structure elements and coming as columns in query out put and
    Invoice value, Gross sale value, Efficient operations etc are as Key figure elements in query and coming as rows in query out put.
    But if I map this query to visual composer table view all these are coming as columns as given below.
    Total Invoice value ,             Total Gross sale value,    Total Efficient operations,      HPC Invoice vale,.........
    And if execute the query will giving the out put in single row.
    Can anybody help me out to map this in the row column format?
    Is it really possible to do in VC?
    I am using CE 7.2. The VC model I need to be embedding in BPM.
    Please help me to solve this issue. I completely stuck up this issue.
    Regards
    Sajith P
    Edited by: Sajith P on Aug 17, 2010 3:07 PM
    Edited by: Sajith P on Aug 17, 2010 3:15 PM

    Hi,
    Try to use some function module which will convert query data into flat tables. (eg., RS_VC_GET_QUERY_VIEW_DATA_FLAT).
    Hope this solves your issue.
    Regards,
    Vinay

  • How to create a normal view from the RDF sparql query?

    Hi,
    I am trying to create a view from the below query.
    select id, name from table(SEM_MATCH('
    (?id rdf:type dm:Conceptual_SMA_Information_Group)
    (?id dm:hasConceptualSmaInformationGroupName ?name)',
    SEM_Models('nyc_sma_curr'), null,
    SEM_ALIASES(SEM_ALIAS('dm','http://www.cdse.com/sbip/dwh/mdm/data_modeling#')), null))
    order by name,id;
    I am trying the below syntax to create a viewa but its giving the error and m unable to create view.
    create view Information_Group as
    select id, name from table(SEM_MATCH('
    (?id rdf:type dm:Conceptual_SMA_Information_Group)
    (?id dm:hasConceptualSmaInformationGroupName ?name)',
    SEM_Models('nyc_sma_curr'), null,
    SEM_ALIASES(SEM_ALIAS('dm','http://www.cdse.com/sbip/dwh/mdm/data_modeling#')), null))
    order by name,id;
    Error: ORA-00600: internal error code, arguments: [17046], [0x46E62D720], [0x46F2485F0], [1], [], [], [], [], [], [], [], []
    Please help me to create a view.
    Let me know if you need more details.
    Regards,
    Kavitha.

    Hi,
    This is a known issue in 11.1 (RDBMS Bug 6688356).
    Please contact Oracle Support to get the patch for this bug. Alternatively, you can upgrade to release 11.2.
    Thanks,
    Matt

  • How to Create/Modify/Delete a query view from the web template in BI 7.0

    All:
    In BW 3.5, the <b>Query Selection View</b>  web item was introduced for users to create a query view to save the navigational state of a query. This web item was also available to modify and delete an existing query view.
    The Query Selection View web item <u>does not</u> exist in BI 7.0. I see the drop down web item can be used to display the query views associated to a query.
    Can anyone share how to create,modify,save or delete a <b>query view</b> on the web in BI 7.0
    Thanks,
    Kumar

    Sanjay, we experienced the same issue. Below are a few pieces of information that may be of help: 1-The Save As button on the 0ANALYZER template saves the query to the portal. From Bex Web or Bex Analyzer, you have no access to these saved views. We created a ZANALYZER copy of the 0ANALYZER template and removed the Save As button. 2- If you right mouse click on any item in the query results grid of Bex Web, you get a small menu. Clicking on the menu item Save View will save the view to BI. You do not have the ability to delete the saved views from Bex Web. However, you can delete them from Bex Analyzer. This was not an option for us since most of our users are using Bex Web. 3- On the same menu, clicking on Bookmark, saves the navigation and also opens the Internet Explorer Favorites maintence window. The navigation is saved as an entry into the users Internet Explorer favorites where they can organize and delete their entries. However, deleting the favorite does not delete the entry for the bookmark in BI. The bookmarks are stored in table RSWR_DATA. Program RSWR_BOOKMARK_REORG can be used to manage the saved bookmarks. We are loading RSWR_DATA into a chracteristic so that we can query the information in order to help us manage it. I hope this helps you and others that appear to be struggling with the issue of saved views in Bex Web.

Maybe you are looking for

  • MacBook Pro running v.slow - is there a way of optimising HD?

    My MBP is running like an absolute dog! It's seriously frustrating, feels like I'm working on an 8MB RAM 15 yr old machine at times. I bought it from a printer 2nd hand 2 yrs ago, and was running fine for the first 18 months. It came with Adobe CS3 a

  • What is the file name of the thunderbolt driver?

    Does anybody know the file name of the thunderbolt driver that will allow me to access a thunderbolt drive from Windows? The BIOS see's the Promise controller/drive, but device manager doesn't see it. The boot camp support files from Apple are not in

  • Is Organizer lousy vs. iPhoto or is just my ignorance?

    WIth all the good stuff packed into organizer as a data mangement tool for photo and film media files, I am astonished about the lack of 2 minor features, that would have given the application an A+1 from me. First I am sooooooo missing the GPS tags

  • Joins in OBIEE

    Hi, If we have a table A and B having Name column in common and A table stores Name value in uppercase and B table stores name values in lower case. Then how can we join these two tables. In physical we can convert the column having name in lowercase

  • Photoshop CS5 - Current Users of 10 bits per pixel color

    Hello, I'm looking for feedabck from anyone who currently has a full 10 bit display pipeline using Photoshop CS5.  I've got a question in on another thread about info on 10 bpp hardware support but I wanted to also start a new thread to get comments