SQL & PL/SQL :: Print WHEN 30 Then Sales After That It Prints WHEN 50 Then Sales As Invalid

Aug 23, 2013

The below Decode query is

SELECT CASE deptno
WHEN 10 THEN 'ACCOUNTING'
WHEN 20 THEN 'RESEARCH'
WHEN 50 THEN 'SALES'
WHEN 30 THEN 'SALES'
ELSE 'Invalid'
END
FROM dept;

But my question is that, it prints WHEN 30 THEN 'SALES' after that it prints WHEN 50 THEN 'SALES' as 'Invalid'.

View 5 Replies


ADVERTISEMENT

Database - Summary Of Sales By Quarter?

Nov 30, 2010

I brought in the Northwind database 2003 in to SQL Developer. I was looking at the view 'Summary of Sales by Quarter' But this report brings in everything. It doesent give me summary of sales for Qtr1, Qtr4 etc

These are the columns:

ShippedDate
OrderId
Subtotal
CREATE OR REPLACE FORCE VIEW "NORTHWIND"."SUMMARY_OF_SALES_BY_QUARTER" ("SHIPPEDDATE", "ORDERID", "SUBTOTAL")
AS

[code]....

How can i recreate this view to show me summary data for qtr1, qtr2, qtr3 and qtr 4 for the year 1997??

View 1 Replies View Related

SQL & PL/SQL :: Find Total Sales For The Whole Last Week

Mar 7, 2010

I have two columns in table

sales_date
sales_amount

I need to find total sales for the whole last week.

Today is current week i.e. 1 (March 1, 2010 and March 7, 2010)

I need to find total_sales for the last week (i.e. Feb 22, 2010 to Feb 28, 2010)

I am unable to create logic for the same.

View 4 Replies View Related

SQL & PL/SQL :: Compare The Sales With The Same Month Last Year

Jul 6, 2012

I wanted to compare the sales with the same month last year. But the issue is only one value on each customers.

File Attached Table as JPG file..
-----------------------------------------------------------------------
SELECT WORDERS.BP_ORDER,
(SELECT SUM (WINVITEMS.ITEM_VAL)
FROM WINVITEMS
INNER JOIN WORDERS ON WORDERS.ORD_NO = WINVITEMS.ORD_NO
WHERE WORDERS.DATE_ORDER >= TRUNC(ADD_MONTHS(SYSDATE, -3),'MM')

[Code]....

View 7 Replies View Related

PL/SQL :: Display Top 3 Sales Column Wise

Dec 21, 2012

I have two tables as below

AREA (area_code, area_name)
MONTHLY_SALES (area_code, isbn, book_name, qty, sales_amount)

I want to display the output of top 3 sales columnwise as below.

AREA_NAME  Top 1st (ISBN) Top 1st (BOOK_NAME)  Top 1st (QTY)     Top 2nd (ISBN)     Top 2nd (BOOK_NAME) Top 2nd (QTY)     Top 3rd (ISBN)  Top 3rd (BOOK_NAME)     Top 3rd (QTY)

View 5 Replies View Related

SQL & PL/SQL :: How To Join Tables To Get All Sales IDs That Have At Least Two Products

Nov 18, 2010

Trick is that I've got 4 tables

Sale , sale_details, sales_message, message_text

Table:Sales
Sales_id

Table: Sales_product
Sales_id, sales_product_id

Table: Sales_message
Sales_id, sales_message_id, message_text_id

Table:Message_text,
Message_text_id, message_text

Thing is how can I join those tables to get all the sales ID's that have at least two products one of which has got any number of messages and the other one hasn't got ANY any messages. So another words one sale entity that has both products with messages and at lease one with no message. Something like this

Sales 1 ID 123
Product1 ID 1234 for sale ID 123
Product2 ID 4321 for sale ID 123
Sales_message ID 098 for product ID 1234 'blabla'
Sales_message ID 876 for product ID 1234 'albalb'
AND NO MESSAGES FOR PRODUCT 4321

This is what I want to get from DB.

View 3 Replies View Related

SQL & PL/SQL :: Create A Query Which Will Show Sales Of Products By Month

Jul 12, 2004

I'm trying to create a query which will show sales of products by month, something like this: -

JanFebMarApr
Prod 11020511
Prod 200510
Prod 31921015

The data is held on 3 tables: -

TB_ARTICLES
ID
CODE
DESCRIPTION

TB_TRANSACTIONS
ID
BOOKKEEPING_DATE
TRANS_DATE

[code]....

Running a query for one month is no problem at all, I just don't know how to create a cross tab style one.

View 12 Replies View Related

SQL & PL/SQL :: Get Total Sales Dollar Amount From Two Tables Without Cursor?

Aug 28, 2013

I got this intertesting request from one of my client some time ago and is still trying to find an answer.

Getting total sales dollar amount from two tables.

T1
Item_no(number)Total_Sales_Number(number)
160
250
35
420

T2
Item_no(number)Sales_Date(date)Sales_Number(number)Sale_Price(number)
12012-01-012015
12012-02-153012
22012-01-104016
22012-03-053018
32012-02-011020

Required to generate report to total sale dollar amount by combining information from T1 and T2 (matching with item_no). Rules are
a)Formula is Sales_Number*Sale_price
b)Choose the earliest sale record to latest by Sales_Date with the sum of Sales_Number is less or equal the Total_Sales_Number from T1.
c)If the sum of Sales_Number is less than the Total_Sales_Number from T1, then the use a fixed price for all items, say $10
d)If a item is not in T2 then use $10 for the price

For example,
item_no 1:
Total sale dollar amount = 20*$15+30*$15+(60-20-30)*$10

item_no 2:
Total sale dollar amount = 40*$16+(50-40)*$18
item_no 3:
Total sale dollar amount = 5*$20
item_no 4:
Total sale dollar amount = 20*$10

The current logic is done by using cursor. Can this be done without cursor using such as analytical statements? The Oracle DB is 9i.

View 22 Replies View Related

SQL & PL/SQL :: Cursor Implement / Strings Of Data Concatenated Into One Sales Contact Record

Sep 23, 2013

how to write below query in pl/sql cursor. The help table has two associated tables, help_txt and help_id, which will have strings of data concatenated into one sales contact record. There are multiple lines of text per comment and multiple lines of resolution text at 40 characters per line. The key to the help_text table (id, date,seqno) is the main key to the help_txt table and help_id t table with a sequence added to each table

The formatted string will contain some text and variables with the comment lines (1-10 or more) concatenated first, followed by the resolution lines (1-10 or more). There will be multiple comment and multiple resolution lines. The Cust_Cmnt_Txt lines and the Resolved_Desc lines should be concatenated and formatted in the following string (% marks the variable string) :

'help taken ' %help.Taken_Dte 'received from the following source: ' %help.id. 'Remark Text: ' %help_text (where help_txt_Seq = 1) %help_text (where help_text_seq = 2-10 or more) 'Resolution: ' %help_id_Res_Txt.Resolved_Desc (where help_ID_Txt_Seq = 1) %help_ID_Res_Txt.Resolved_Desc (where help_id_Txt_Seq = 2-10 or more)

View 8 Replies View Related

Workflow :: External Sales Order Lines Remain In Internal Req Requested Status

Feb 13, 2013

Customer sales order lines are fulfilled by IR-ISO. When line progresses, it is set to have Internal Req Requested status. A scheduled program runs amd IR are created. However, sales order line status does not change to Internal Req Open. It remains in Internal Req Requested status.

As a work around, workflow is rewound to 'Check ATR Qty' which is customized activity and then status changes to Internal Req Open. What could be the reason that workflow is not setting the status to Internal Req Open?

View 1 Replies View Related

Forms :: Finger Prints Reader / Oracle

Oct 9, 2010

I have Microsoft finger print reader and installed. I would like this that this device will capture finger prints from form application.i have installed fingerprints software and then oracle. The device is active on sdk. when i use form the device shown nothing. How i can interact with oracle and device.

View 1 Replies View Related

Forms :: Finger Prints In 6i (plus Rant From User) And OCX Object

Apr 8, 2008

i have a thumb reader device and i want know how it works such as

A.How to read data from serial port or usb port
b.how to save data into a oracle table or in a text file
c.How to match finger prints

View 14 Replies View Related

SQL & PL/SQL :: Print No Results If More Than 10 Records Else Print The Output

Mar 24, 2011

I have this SQL statement:

WITH data
AS (SELECT user_id,
jc_name,

[Code]....

I wish to do something like

if results > 10 print an error message (and no results)
if results < 10 print the results/output

View 1 Replies View Related

How To Add And Print In Sql

Apr 23, 2012

here is my code it prints data for 1 perticular date.

instead of it printing
1
3
3
1
3
1
13
0
3
0
0
1
1
1
0
5

for whole day

I want it to add and print the total

here is code

SELECT O_ESBY_SUM.CALLS
,O_ESBY_SUM.ROWDATECREATED
FROM OB.O_ESBY_SUM O_ESBY_SUM
where To_Date(to_char(O_ESBY_SUM.CALLS.ROWDATECREATED, 'DD-MON-YYYY')) = To_Date('?DATE1::?','MM/DD/YYYY')

it prints this
for date 4/19/2012
here is screen shot

View 1 Replies View Related

SQL & PL/SQL :: How To Print Row Value In Column

Jul 20, 2010

I have table and data like

Name
-----------------
A,B,C,D,E

I would like to print the value like

Name
------------------
A
B
C
D
E

how to do this using SQL or PL/SQl.............

View 3 Replies View Related

PL/SQL :: Output Print More Than 255

Jan 2, 2013

I am getting an error while printing a sql query which is in a string inside a stored proc. I used

dbms_output.enable(1000000);

dbms_output.put_line(v_query);

and error "I get ORU-10028: line length overflow, limit of 255 bytes per line"

How do I print everything?

View 3 Replies View Related

SQL & PL/SQL :: How To Print Even Numbers Without Using MOD Function

Mar 1, 2012

How to print even numbers 1 to 10.without using the MOD Function

View 17 Replies View Related

SQL & PL/SQL :: Print Columns Of A Table

Jul 5, 2013

DECLARE
JOBSFILE UTL_FILE.FILE_TYPE;
CURSOR JOBSCUR IS
SELECT *
-- DDOCNAME,DDOCTITLE,DSECURITYGROUP,DDOCAUTHOR,DDOCTYPE,DINDATE,PRIMARYFILE,EXTRACTIONDATE,BATCH_ID
FROM TARGET_UCM ;
BEGIN
JOBSFILE := UTL_FILE.FOPEN('FILES','JOBS.TXT','W');
UTL_FILE.PUT_LINE(JOBSFILE,'Action = insert');
FOR REC IN JOBSCUR
[code]....

is there anyway to print the values of full table .i have used all column names to print .

View 6 Replies View Related

SQL & PL/SQL :: How To Print Data Between Two Dates

Oct 8, 2012

How to print data between two dates... startdate and enddate inclusive

View 2 Replies View Related

SQL & PL/SQL :: Print Update Confirmation?

Apr 13, 2013

I'm trying to create an output statement that will show that the update was successful, but everything that I'm trying doesn't seem to be working.

I have a procedure and an anonymous block that calls on the procedure.

So far after the begin in my anonymous block I have.

BEGIN
procedure_name(variable1, variable2);
dbms_output.put_line('Successfully Updated');
END;

Now I know that the procedure and the anonymous block without the dbms output works as the update takes place in the table, but I can't get any text string output to confirm this.

View 4 Replies View Related

Forms :: Print A Cheque?

Feb 10, 2011

want to print a cheque from my form

View 1 Replies View Related

SQL & PL/SQL :: Print Fibonacci Series

Nov 8, 2006

I want to print Fibonacci Series like :-

0,1,1,2,3,5,8,13,21,34..........

How can i do it.Can i do it by procedure or function?

View 4 Replies View Related

Print Mismatch Values From Two Tables?

Nov 6, 2012

I've 2 identical tables of 300+ columns each,and each of table is having pk as combination of 2 fields.There are some fields where data is not matching. need a query which will use these two tables and return the following-

1. primary key columns

2. null value for fields where data is matching

3. data for columns where there is data mismatch.

View 4 Replies View Related

How To Print Sql Query With Serial Number

Mar 27, 2007

How can i print serial no of records in sql query? I know I can achieve this with selecting rownum but it gives wrong data if used with group by like below

select rownum,deptid from emp group by rownum,deptid order by rwnum

View 2 Replies View Related

Forms :: How To Print Next Record Value In Oracle 10g

Jun 28, 2010

I am using oracle forms10g here i have next button. So when i click the next button it will show the total volumn of record count and each record value for example 1/10 like that.

View 9 Replies View Related

Reports & Discoverer :: How To Print Into Two Pages

Jul 6, 2010

I am creating report a using emp table .There are 14 rows in emp table , i want to print output into two pages . If i set FILTER TYPE Property to 5 ,it only shows 5 records .

View 2 Replies View Related

SQL & PL/SQL :: Print Data From A Clob In XML Format?

Sep 11, 2013

I want to print data from a clob in XML format and use the following

PROCEDURE printClobOut(result IN OUT NOCOPY CLOB) is
xmlstr varchar2(32767);
line varchar2(32767);
cnt NUMBER;

[Code]...

However the length of the clob is 13832630 which is too large for a VARCHAR2. Thus my output of line is cut off at 4000 characters. How can i increase this... Do i overlook something here in my code?

View 13 Replies View Related

SQL & PL/SQL :: How To Print All Prime Factors Of Given Number

Sep 3, 2012

print the list of prime factors of a given number create or replace FUNCTION prime (num in number)

return sys_refcursor
as
i number := 2;
temp number := num;
temp_cur sys_refcursor;
BEGIN
open temp_cur;

[code]....

Quote:gives error -->>expression is of wrong type @ open temp_curur;

how to print all the prime factors of a given number??

View 9 Replies View Related

Forms :: USB Finger Print Reader

Jun 17, 2013

I have my own design employee time attendance application which i design in oracle forms 6i and oracle database 9i. Now I bought one USB fingerprint reader so I can attached this device to my application. I want every employee to scan there finger in my reader and I will record there attendance. How I can configure this device in my form.

View 1 Replies View Related

SQL & PL/SQL :: How To Print Rows Into Column Data

Sep 24, 2010

I have a table emp having data as

empno ename sal deptno
1001 manoj 1000 10
1001 sachin 2000 20
1003 manoj 30000 30

Now I wanted to write a query which will display the results like below. Row data need to be display in the columns

empno ename sal deptno 1001 manoj 10 20 1003 30
1001 manoj 1000 10 1001 manoj 10
1001 sachin 2000 20 1001 sachin 20
1003 manoj 30000 30 1003 manoj 1003 30

How to print the rows into column data?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved