SQL Report with Total Salary

I have a select statement like this:
Select first_name, last_name, salary From Employee
I am getting report properly with this query. But my question is : How can get total salary at the bottom of report?
If I crate another region with a new SQL, I could do that but I want in single SQL or PL/SQL.
Any help would be appreciated.
Thanks,
Mushtak

Hi, you can do something like this:
Select first_name, last_name, salary From Employee
Union
Select null first_name, 'Total salary' last_name, Sum(salary) From Employee
order by first_name
Hope this helps
George

Similar Messages

  • SQL Report with Scroll - javascript

    This is an example of Apex SQL Report with Scroll - made with javascript: http://tryapexnow.com/apex/f?p=12090:9
    Waiting for comments here.

    Yes, because of the page generated by APEX, if you use the Report Template APEX 4.0 Standard, the div created for the report table has the ID "with_scroll" but there is another div which actually contains the table, and it's ID is "report_with_scroll", they just add a "report_" in front of it.
    I find the table by searching through the childs of that div: var table = document.getElementById(myRegion).rows[1].cells[0].firstChild;
    You can use the first one, with the ID "with_scroll", but this code line will be longer.
    Also to addapt the script for other report templates, you just need to see the code generated by every template, and correct this line, to get the real table containing your report.

  • SQL report with delete capability

    I want to create a SQL report with the capability of delete rows (show checkboxes next to each row). Is this possible?

    You can create a page type of Tabular Form, remove all buttons but delete, change all the edit boxes to display as text (saves state) and use that.

  • Problem of POP LOV  in a  SQL Report  with pagination

    I am using a pop up lov (along with some other fields), HTMLDB_ITEM.POPUP_FROM_LOV(5, null, 'EMPLOYEE_LIST', '20', '50')), in a sql report. This is a report with pagination. Whenever I select any value from pop up lov on first page of the report it gets populated properly in the corresponding text field. But from second page onwards it doesn’t populate any value.
    For example, my report fetches a total of 50 rows, of which I am displaying 15 at a time. The popup lov comes with a text field for each row. Whenever I do select from popup lov for 1-15 rows which come on page 1, the values come up in the text field properly, but for rows 16-30 on second page, 31-45 on third 46-50 on fourth the values do not get populated. When I changed the pagination settings to display 40 rows..the values were still coming properly on page 1(1-40 rows) and not on the next page. Any clues… how to resolve this problem?

    good find. this is a bug that has already been identified and will be corrected in the upcoming patch release for htmldb. a good work-around for now is to use the equivalent declarative options in the tool. so rather than coding your query like...
    select ename , HTMLDB_ITEM.POPUP_FROM_LOV(2, null, 'DEPARTMENT', '20', '50') as "department" from emp
    ...just code it like this...
    select ename , null as "department" from emp
    ...and then use the column attributes screen for your "department" column to indicate that you'd like that col to be rendered as a "Popup LOV (named LOV)" using your DEPARTMENT list of values.
    hope this helps,
    raj

  • Pl-sql report with parameter

    Hi
    I have created report with region source as pl-sql. In pl-sql block, calling package where i am passing query. In query's where clause i want to pass paramter value which user had selected.
    There are two regions on page. On upper part, there is select list, on lower part there is report with pl-sql region but value of select list is not found in query. I am trying to access with bind variable, select list of item :SL_TEXT. But it is not showing any value in it.
    How to use select list value in query of report? Or let me know how to use parameter in pl-sql report which is selected in other region?
    Thanks in advance

    I am attempting to define the variable as a date variable through Oracle BI and yes it does use a colon to signal variable substitution.
    So thank you the first way you stated should work.
    The only problem I'm running into now I believe steems from the date format that column that I am trying to filter on. It is in what appears to be the worst format possible.
    Is it common for dates to be stored in a DD-MON-YY format? (e.g. 01-JAN-08) I thought we as a community had moved past that post Y2K scare. lol.
    When I set up the bind variable in BI it allows me to define the date format, much similar to the TO_DATE function but then it says (must be java date format). So I'm thinking that maybe DD-MON-YY is not a java date format.
    In that case is there a way to cast or convert my date format in the sql so that it is a supported java date format?
    Or should I just give up and pass it as a varchar2?

  • SQL Report with 1 updatable column - help urgent

    Hi,
    I have a SQL report. I am using collection to store value of selected record by link column.
    I have a updatable text item (NULL) in the column. I am able to store that value in the collection.
    Any clue?
    Code
    1. Creating a collection in parent page:
    apex_collection.create_or_truncate_collection
    (p_collection_name => 'ORDER');
    2. Query to populate item rows with option to key 'QTY' before pressing 'Add to Order' link.
    select
    itemcode,
    description,
    NULL AS qty,
    'Add to Order' add_to_order
    from itemtab
    3. Made 'QTY' to Text item -- to allow users to key value
    4. Created 'hidden & protected' items P1_ITEMCODE, P1_QTY
    5. Set values of itemcode, qty in add_to_order link
    6. Created a process to add values into collection:
    for x in (select * from itemtab where itemcode = :P1_ITEMCODE)
    loop
    apex_collection.add_member(p_collection_name => 'ORDER',
    p_c001 => x.ITEMCODE,
    p_c002 => x.DESCRIPTION,
    p_c003 => :P1_QTY
    end loop;
    7. Display value of itemcode, description, qty in report region
    select c001, c002, c003
    from apex_collections
    where collection_name = 'ORDER'
    Probem: The value of qty is not being stored in the collection and not appearing in the #7 report. itemcode and description values are fine.
    Thanks,
    Dip

    Dip,
    I'm guessing here as I can't see your application, I think your missing the page process to collect the data from your QTY field.
    I created a quick demo of what i think your trying to achieve on apex.oracle.com
    http://apex.oracle.com/pls/apex/f?p=19923:2
    I added this to the html expression on the report Field add to:
    <input type="button" onclick="doSubmit(#RANDOM_ID#)" value="Add To" />
    Then the page process to collect and set the page item:
    DECLARE
    l_qty number;
    BEGIN
    FOR i in 1..APEX_APPLICATION.G_F03.COUNT LOOP
    l_qty := nvl(APEX_APPLICATION.G_F03(i),0);
    IF l_qty > 0
    THEN
    :P2_QTY := l_qty;
    :P2_RANDOM_ID := :REQUEST;
    EXIT;
    END IF;
    END LOOP;
    END;
    Let me know if this helps
    Mark
    Don't forget to mark reply as helpful or correct as this may help others reading this thread in the future!
    Edited by: cptbutcher on Mar 25, 2010 10:40 PM

  • How to update SQL Database with totals from Crystal Report

    Hello,
    I am converting a Crystal Report done using CR 11 and VB6 to VB.Net and Visual Studio 2010.  The report is now working fairly well but there is 1 last thing to figure out.  In the vb6 version there was a report footer event that I used to update the report totals to a record in a database table. 
    It appears that in the .net version we have less events to allow outside processing to occure when a report is produced. Looking thru the available events I don't see a way to do this. Would some be so kind as to suggest a way this might be accomplished?
    Thanks,
    Vic

    Only thing I can think of is the InProc RAS SDK and using the RowSet Controller to query the footer, then parsing out the info you need to submit to the database.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • Discoverer Custom SQL Report with Group By,Having

    Hi all,
    I'm working with Discoverer 4.1.41.05 and retrieve data from Oracle HRMS.
    I want to create a report based on a custom SQL Folder in Discoverer Administration to solve the following scenario:
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F
    MINUS
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F,PER_EVENTS, PER_BOOKINGS
    GROUP BY EMPLOYEE_NUMBER
    HAVING SUM(PER_EVENTS.ATTRIBUTE1) >= 10)
    The problem is when I run the sql from SQL*Plus is working fine producing the correct result.
    When I create the Custom Folder and create a Discoverer report based on it I retrieve all employees since the second select statement retrieve no rows!
    Does anyone has any idea how I can solve this problem or if there is another way to create this scenario?
    Any feedback is much appreciated.
    Thanking you in advance.
    Elena

    Hi Elena,
    I think you are missing some joins, you could try something like:
    SELECT EMPLOYEE_NUMBER FROM PER_ALL_PEOPLE_F p
    WHERE NOT EXISTS
    (SELECT NULL
    FROM PER_EVENTS e, PER_BOOKINGS b
    WHERE b.person_id = p.person_id
    AND e.event_id = b.event_id
    GROUP BY b.person_id
    HAVING SUM(e.ATTRIBUTE1) >= 10)
    Rod West

  • How can I get a report with total number of pages printed on my HP Officejet Pro 8610?

    Since knowing the number of pages I print is so critical to a choice of using the "HP Instant Ink Plan" or not, how can I find the total number of pages I have printed on my brand-new (installed 2 days ago) 8610?  And if I can, is it a "resettable" or rolling total?  Don't see anything in user guide and a search yields nothing usable on this blog.
    Printer is installed wirelessly on an older PC with Windows XP SP3.  I can also of course intstall it with network cable but so far it works OK on my home network without network cable.  If it matters which OS, I also have a Lenovo laptop running Vista on which I can install this printer. 
    Please do not respond that I can find the total by counting the number of pieces of paper I have.  Surely the internals of this fine machine must have the requested data so that HP can tell my usage if I select the monthly ink plan!
    This 8610 was a good buy (net $89.00 after trade-in of my six year old J36xx Deskjet) at Office Depot/Max which of course influenced my decision to buy it.  So far I am very happy with printing qualities and speed, have not tried the scanner yet and will probably never use the fax since I have no land line phone. 
    Thanks,
    Harry
    This question was solved.
    View Solution.

    Hi,
    Section #2 of the Printer Ststus report will tell you. Please try:
    Printer status report
    Use the printer status report to view current printer information and ink cartridge status. Also use the printer status report to help you troubleshoot problems with the printer.
    The printer status report also contains a log of recent events.
    If you need to call HP, it is often useful to print the printer status report before calling.
    To print the Printer Status Report
    1. From the printer control panel display, touch and slide your finger across the screen and then touch Setup.
    2. Touch Print Reports and then touch Printer Status Report.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Analysis report with totals on specific columns

    I have an analysis report that I need to create totals on specific columns. If I turn on "Grand Totals" from the "Edit View: Table" section, all of the numeric columns will display grand totals. This is a nice automatic feature, but I only need totals of specific columns. Not all numeric columns need totals nor do Grand Totals of some columns make any sense.
    For example, to display opportunity details, we will have on the report:
    Opportunity Name, Item number, Item Description, Quantity, Price, Extended Price
    Since the opportunity may have multiple items on it, having a grand total of quantity and unit price makes no sense. All we need is Grand Total of the opportunity extended price.
    Is there a way to selectively turn on/off column totals or is it an all or nothing option?
    Thanks in advance.
    Edited by: nsidev on Sep 1, 2009 10:10 AM

    Actually, i just solved the problem.
    Here is what I did:
    1. I added a column to the "Design Criteria" section (step 1). To keep the units consistant, I made sure that the data element was suitable for the value (I used a currency element). Ensure you note the position of the new column, mine was in position 11.
    2. Under the newly added elements "Column Properties", I set it to HIDDEN and changed the name to "Grand Total"
    3. Under the "Edit Formula", I changed the formula to be: SUM(<numeric column>)
    4. In "Create Layout" (Step 2), I added a narrative view to the bottom of the page.
    5. In the "Edit Narrative View", I set the appropriate formatting and added the following: Total Extended Price: @11
    6. Ensure that "Rows to display" is set to 1.
    Save and run
    All done, works like a charm.

  • PLSQL-generated SQL report with variable number of columns

    I created an app to track college football bowl picks:
    http://apex.oracle.com/pls/otn/f?p=21723
    The main report region includes columns for the various games as well as a column for each participant. In order not to hard code the number of participants, I used PLSQL to generate the SQL so that new columns could be added on the fly.
    However, whenever I add a new user I get this result -
    report error:
    ORA-01403: no data found
    If I copy and paste the PLSQL into a new report region and then delete the old one, however, all is well.
    Is there something I can do to overcome this?
    Thanks.
    Bill

    Roberto
    <br><br>
    Here are the tables:
    <br><br>
    BOWL_GAMES<br>
    ID     NUMBER<br>
    NAME     VARCHAR2(30)<br>
    FAV     VARCHAR2(20)<br>
    DOG     VARCHAR2(20)<br>
    BDATE     DATE<br>
    LINE     NUMBER(3,1)<br>
    FAV_SCORE     NUMBER(4,0)<br>
    DOG_SCORE     NUMBER(4,0)<br>
    <br>
    BOWL_USERS<br>
    ID     NUMBER<br>
    USERNAME     VARCHAR2(20)<br>
    PW     VARCHAR2(20)<br>
    NAME     VARCHAR2(20)<br>
    EMAIL     VARCHAR2(50)<br>
    <br>
    BOWL_PICKS<br>
    ID     NUMBER(5,0)<br>
    USERID     NUMBER(10,0)<br>
    GAMEID     NUMBER(10,0)<br>
    PICK     NUMBER(1,0)<br>
    <br>
    <br>
    Below is my PLSQL. Feel free to try out the app. Thanks.
    <br><br>
    Bill<br><br>
    declare<br>
    p_sql varchar2(32767);<br>
    cursor c1 is select * from bowl_users order by id;<br>
    begin<br>
    p_sql := q'! select to_char(b.bdate, 'Mon FMdd') "Date", b.name, '< a href="javascript$pickEm(''' || b.fav || ''')">' || b.fav || '</ a> -' || b.line || ' < a href="javascript$pickEm(''' || b.dog || ''')">' || b.dog || '</ a>' "Line" !';<br>
    for a1 in c1 loop<br>
    p_sql := p_sql || q'! , bowl_strike(b.id, !' || a1.id || q'! , 0) || (select decode(p.pick, 0, substr(b.dog,1,4), 1, substr(b.fav,1,4), 'No pick') from bowl_picks p where p.userid = !' || a1.id || q'! and p.gameid = b.id) || bowl_strike(b.id, !' || a1.id || q'! , 1) "!' || upper(a1.name) || q'!" !';<br>
    end loop;<br>
    p_sql := p_sql || q'! , bowl_score(b.id) "SCORE" from bowl_games b order by b.bdate !';<br>
    return replace(p_sql,'$',':');<br>
    end;
    <br><br>
    Message was edited by:
    [email protected]

  • Dynamic PL/SQL Report with html embedded in result

    Hi,
    I am trying to embed an html image tag element in an query result. I have followed the how to example (MS SQL down; Oracle up) successfully. However I now require the query to be dynamic based upon sone filtering criteria simalar to the how to example:
    So the query code looks something like this:
    <p>
    declare
    <p>
    q varchar2(1000);
    <p>
    begin
    <p>
    q:= ' select ';
    <p>
    q:= q || ' decode(status, ';
    <p>
    q:= q || ' 1, ''&lt;img src="up.gif"&gt;'', ';
    <p>
    q:= q || ' 0,''&lt;img src="down.gif"&gt;'') status, ';
    <p>
    q:= q || ' item_id item ';
    <p>
    q:= q || ' from item_table ';
    <p>
    return q;
    <p>
    end;
    (note this is a simplified example)
    The problem is that the image does not display and I think it is because of the double quotes - " - embedded within the query string for the html image element.
    Can anyone help, point out my error or suggest an more appropriate implementation.
    Thank for any help!
    sinclair

    Sorry for the previous post. Here is what I did based on your example:
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    and it works.
    The query is like:
    DECLARE
    q VARCHAR2 (1000);
    BEGIN
    q := q || 'SELECT deptno, DECODE(deptno, ';
    q := q || '10, ''&lt;img src=" #IMAGE_PREFIX#bullet1.gif" >'',';
    q := q || '20, ''&lt;img src=" #IMAGE_PREFIX#bullet2.gif" >'',';
    q := q || '30, ''&lt;img src=" #IMAGE_PREFIX#bullet3.gif" >'',';
    q := q || '40, ''&lt;img src=" #IMAGE_PREFIX#bullet4.gif" >'') ';
    q := q || 'image, dname FROM DEPT ';
    RETURN q;
    END;
    In your query you wrapped the image file name in double quotes, which wasn't necessary.
    Denes Kubicek

  • Create a report with PL/SQL

    Hi,
    I have two pages: the first page contains two text fields and a submit button. In the first text field you can enter a name and in the second field you can enter a number. That means you can search a record by name or by number.
    In the second page the report is generated depending on the used text field of the first page.
    I tried to to define a region source code with PL/SQL for the report, but nothing appears on the report page although the record I was looking for exists in the database.
    begin
    if :ENTERNAME IS NOT NULL then
    FOR item IN (select "TB_PERSON_INSTITUTION"."PI_ID" as "PI_ID",
    "TB_PERSON_INSTITUTION"."PI_NAME" as "PI_NAME",
    "TB_PERSON_INSTITUTION"."PI_VORNAME" as "PI_VORNAME",
    from     "TB_PERSON_INSTITUTION" "TB_PERSON_INSTITUTION"
    where      upper("TB_PERSON_INSTITUTION"."PI_NAME") like upper(:ENTERNAME||'%'))
    loop
    DBMS_OUTPUT.PUT_LINE('First name = ' || item.PI_NAME ||
    ', Last name = ' || item.PI_VORNAME);
    end loop;
    end if;
    end;
    Regards
    Mark

    Hi,
    ok thanks. I tried to use the SQL-Report with type "SQL Query (PL/SQL function body returning SQL-Query)" and made a few changes in the SQL-Statement so that a second table is also included:
    declare My_select varchar2(500);
    begin
    if :TEXTEINGABENAME IS NOT NULL then
    My_select:='SELECT
    "TB_ADRESSE"."A_PLZ" "A_PLZ",
    "TB_ADRESSE"."A_ORT" "A_ORT",
    "TB_ADRESSE"."A_ID" "A_ID",
    "TB_PERSON_INSTITUTION"."PI_MITGLIEDSNUMMER" "PI_MITGLIEDSNUMMER",
    "TB_PERSON_INSTITUTION"."PI_NAME" "PI_NAME",
    "TB_PERSON_INSTITUTION"."PI_VORNAME" "PI_VORNAME",
    "TB_PERSON_INSTITUTION"."PI_ERGAENZUNG" "PI_ERGAENZUNG",
    "TB_PERSON_INSTITUTION"."PI_ERGAENZUNG1" "PI_ERGAENZUNG1",
    "TB_PERSON_INSTITUTION"."PI_ID" "PI_ID"
    FROM
    "TB_ADRESSE" "TB_ADRESSE",
    "TB_PERSON_INSTITUTION" "TB_PERSON_INSTITUTION"
    WHERE "TB_PERSON_INSTITUTION"."PI_ID" = "TB_ADRESSE"."A_F_PERSON_INSTITUTION"
    AND upper("TB_PERSON_INSTITUTION"."PI_NAME") like upper(:TEXTEINGABENAME||"%")';
    else
    if :TEXTMITGLIEDSNUMMER is not null then
    My_select:='SELECT
    "TB_ADRESSE"."A_PLZ" "A_PLZ",
    "TB_ADRESSE"."A_ORT" "A_ORT",
    "TB_ADRESSE"."A_ID" "A_ID",
    "TB_PERSON_INSTITUTION"."PI_MITGLIEDSNUMMER" "PI_MITGLIEDSNUMMER",
    "TB_PERSON_INSTITUTION"."PI_NAME" "PI_NAME",
    "TB_PERSON_INSTITUTION"."PI_VORNAME" "PI_VORNAME",
    "TB_PERSON_INSTITUTION"."PI_ERGAENZUNG" "PI_ERGAENZUNG",
    "TB_PERSON_INSTITUTION"."PI_ERGAENZUNG1" "PI_ERGAENZUNG1",
    "TB_PERSON_INSTITUTION"."PI_ID" "PI_ID"
    FROM
    "TB_ADRESSE" "TB_ADRESSE",
    "TB_PERSON_INSTITUTION" "TB_PERSON_INSTITUTION"
    WHERE "TB_PERSON_INSTITUTION"."PI_ID" = "TB_ADRESSE"."A_F_PERSON_INSTITUTION"
    AND upper("TB_PERSON_INSTITUTION"."PI_MITGLIEDSNUMMER") like upper(:TEXTMITGLIEDSNUMMER||"%")';
    end if;
    end if;
    return My_select;
    end;
    When I try to apply changes an error message occurs:
    "Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. The query can not be parsed, the cursor is not yet open or a function returning a SQL query returned without a value."
    Regards,
    Mark

  • Aggregrate function in report with group by

    I have SQL report with all the records and Total of some of the fields in end.
    I wanted to group them by item1 and than show the Total for the fields for each Item

    In your report have a break formatting section, select the column you wish to break (sub-total on).. make sur eto set the sum checkbox on the column you ar edoing the break on too! It will then build the sub-total line for you..
    Thank you,
    Tony Miller
    Webster, TX
    Never argue with an idiot. They drag you down to their level, then beat you with experience.
    If this question is answered, please mark the thread as closed and assign points where earned..

  • SQL report link to another report

    Hello,
    I am using Apex 4 and trying to link an sql report with another report. If I were able to use an interactive report I could easily link that to another page, but that would require me to have a primary key. The problem is that I need to link a few tables. So two questions:
    1.) Can I link these via an HTML link to my other page? I would have a HTML link in my report that would link via URL parameter passing. So can I use HTML in a report?
    2.) What is the syntax for a parameter passing via URL? Here is my link that would be:
    a href= f?p=107:40:&APP_SESSION::::P40_NAME:MARK: Are there any other ways to accomplish this?
    Thanks,
    Mark
    Edited by: LondonMark on 23-May-2011 04:18
    Edited by: LondonMark on 23-May-2011 04:20

    I am using Apex 4 and trying to link an sql report with another report. If I were able to use an interactive report I could easily link that to another page
    It's easy in standard reports< /a>. (Ignore the "Interactive Report" typo in step 1.)
    1.) Can I link these via an HTML link to my other page? I would have a HTML link in my report that would link via URL parameter passing. So can I use HTML in a report?You can, but it's better practice to keep data retrieval and HTML structure separate when possible&mdash;in this case by using declarative Column Links.
    2.) What is the syntax for a parameter passing via URL?This is also covered in the documentation.
    Here is my link that would be: a href= f?p=107:40:&APP_SESSION::::P40_NAME:MARK:
    {quote}
    That looks to have the order of the parameters correct, but it's missing some syntax:<a href="f?p=107:40:&APP_SESSION.::::P40_NAME:MARK">...</a>
    The static text exact substitution method of referencing the value of an APEX item requires a terminating dot ("."): <tt>&APP_SESSION.</tt>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Why is BT incompetent and unable to resolve a simp...

    This has been an on-going issue with BT for a number of months in which BT has made multiple failing and I am now beginning to lose patience. The issue began when I moved house and took my BT services with me. During the house move I requested that t

  • Invalid column type error while calling db function.

    We are getting an exception while calling the database function which returns a Varray of objects. We are using jpub to generate the wrapper method, ran sqlj to generate the JDBC code. The environment is weblogic 5.1 EJB container with ORacle 8.1.6.0

  • Can't combine a IRS fillable form pdf with Acrobat XI

    In past years I have combined an IRS fillable form pdf with attachments before printing and archiving. However, this year I contine to get an error message. Not sure if it is XI vs X or new type of pdf by IRS but I'm a Acrobat relative beginner and n

  • DB13 initiated backups fail -  BRTOOLS succeeds

    Dear All, I have configured init<SID>.sap for a online disk backup. When I start a online backup from BRTOOLS it completes. But when I schedule or immediately start a Online backup from DB13, it fails with this log: 01.09.2008     12:09:47     BR0282

  • Can I download the trial CS6 and not download it again with a Cloud Membership?

    I have preordered the Creative Cloud, but was wondering if I download the trials will I have to download again on Friday?