Requirement of SQL query
Hi allI need to display the number 100000 under 1,00,000.00
Any help is appreciated...
API> SELECT TO_CHAR(100000,'FM999,999,999,990.90')
2 FROM DUAL;
TO_CHAR(100000,'FM9
-------------------
100,000.00
Tags: Database
Similar Questions
-
I have a table and passes as below:
START DATE TOTAL NUMBER OF DAYS
11/10/2011 15:00 1
15/10/2011-05:00 1
2011-12-22 10:00 1
22/12/2011 11:00 2
30/12/2011-10:00 1
01/01/2012 01:00 1
01/01/2012 10:00 1
01/01/2012 16:00 2
02/01/2012 14:00 1
03/01/2012-15:00 1
04/01/2012-15:00 2
04/01/2012 18:00 1
I need to ask where the values in the table above
must return values as below:
I tried many ways, but not able to find the solution.
Kindly help me in this regard.
START DATE TOTAL NUMBER OF DAYS
11/10/2011 15:00 1
15/10/2011-05:00 1
22/12/2011 11:00 2
30/12/2011-10:00 1
01/01/2012 16:00 2
02/01/2012 14:00 1
03/01/2012-15:00 1
04/01/2012-15:00 2
the ultimate goal is to summarize the TOTAL number of DAYS column all the numbers in the second table... All jobs must be treated in the same query. I can't use the coding of java to process what my requirement should be included in the query that already exists.
Published by: 915175 on February 16, 2012 23:02select trunc(start_date), max(start_date), max(total_days) from tablename group by trunc(start_date);
Please check below is on my local site with you Test data:
SQL> SQL> with tablename as 2 ( 3 select to_date('10/11/2011 15:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual union all 4 select to_date('10/15/2011 5:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual union all 5 select to_date('12/22/2011 10:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual union all 6 select to_date('12/22/2011 11:00' , 'mm/dd/yyyy hh24:mi') start_date, 2 total_days from dual union all 7 select to_date('12/30/2011 10:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual union all 8 select to_date('1/1/2012 1:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual union all 9 select to_date('1/1/2012 10:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual union all 10 select to_date('1/1/2012 16:00' , 'mm/dd/yyyy hh24:mi') start_date, 2 total_days from dual union all 11 select to_date('1/2/2012 14:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual union all 12 select to_date('1/3/2012 15:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual union all 13 select to_date('1/4/2012 15:00' , 'mm/dd/yyyy hh24:mi') start_date, 2 total_days from dual union all 14 select to_date('1/4/2012 18:00' , 'mm/dd/yyyy hh24:mi') start_date, 1 total_days from dual 15 ) 16 select TO_CHAR(max(start_date),'MM/DD/YYYY HH24:MI') start_date , max(total_days) total_days from tablename 17 group by trunc(start_date); START_DATE TOTAL_DAYS ---------------- ---------- 10/15/2011 05:00 1 01/03/2012 15:00 1 12/30/2011 10:00 1 01/01/2012 16:00 2 10/11/2011 15:00 1 12/22/2011 11:00 2 01/04/2012 18:00 2 01/02/2012 14:00 1 8 rows selected. SQL>
Kind regards
Lifexisxnotxsoxbeautiful...Update: added test done to my database...
Edited by: lifexisxnotxsoxbeautiful Vithalani, on February 16, 2012 23:18
-
I have three tables listed below
FORMAT - Columns are format_id, format_desc
VIDEO_FORMAT - areVIDEO_FORMAT_ID of columns, COST VIDEO_ID, FORMAT_ID,
RENTAL - Coulmns are RENTAL_ID, DATE_OUT, DATE_DUE, DATE_IN, DELIVERY_STATUS, LATE_FEE, CUSTOMER_ID, VIDEO_FORMAT_ID
I need to find the customer list id, format description and cost of the video format for customers who have rented a video.
I wrote the request
Select rental r format f, video_format, r.customer_id, f.format_desc, vf.cost vf where f.format_id in (select video_format format_id) and r.video_format_id = vf.video_format_id
This isn't to get accurate results. Help, please.Would know what kind of results you get, but I think that I can see.
Try:
Select r.customer_id, f.format_desc, vf.cost
rental r, f format, video_format vf
where vf.format_id = f.format_id
and r.video_format_id = vf.video_format_idCan't be sure without a little more information so that will set you. But I do not know why you went with trying to get a relationship using an IN with a subquery. It will be useful.
-
What can be the SQL query for this requirement?
Hello
I have a table with the fields like this:
ID DESC PARENT
01 02 ABC
02 01 ABC1
03 01 ABC2
04 02 ABC4
In the table above column PARENT refers to the column ID, but actually in the SQL query, I want to have ID DESC and PARENTDESC (i.e., desc ID value corresponding)
Output real I need is
SELECT ID, DESC? from table where ID = someValue. Now, if I provided ID = 01 then output should be like this:
ID DESC PARDESC
ABC1 ABC 01
Can anyone help on what may be the required sql query?
Published by: bootstrap on April 29, 2011 06:15SELECT T1.ID, T1. DESC, T2. / / DESC
FROM TABLEA T1, T2 TABLEA
WHERE T1.ID = '01'
AND T2.ID = T1. PARENT; -
Hello
Suppose I need to check the number of records of 30 tables in the oracle database in a particular schema, it may have hundreds of tables.
How to check with simple sql query.I know that under method,
Select count (*) from
Table1, table2, table3... table30;But I need in format below. If I use Group by we will get but we must specify all 30 tables to groupby, is any alternative group instead of keep all 30 tables
SELECT TABLENAME, COUNT (*)
OF table1, table2, table3... table30Group of table1, table2, table3... table30;
Try the following query if all tables are present in the same pattern in the case otherwise you must use dba_tables:
SELECT table_name, to_number( extractvalue( XMLTYPE( dbms_xmlgen.getxml('select count(*) c from '||table_name)) ,'/ROWSET/ROW/C')) count FROM user_tables WHERE table_name IN ('A','B','C') ORDER BY table_name;
-
SQL query to retrieve only numbers to a string variable
Dear all Experts,
I have a requirement in one of my projects where I need to extract only the numbers present in the variable.
for example:
BANK_ACCOUNT_NUMBER = 12345-67890';
BANK_ACCOUNT_NUMBER = 12345 67890';
BANK_ACCOUNT_NUMBER = "123.456.7890";
BANK_ACCOUNT_NUMBER = 123-A456BC7890D';
In all these cases, I need to retrieve only numbers such as BANK_ACCOUNT_NUMBER = 1234567890 and I am looking for SQL query only.
Please suggest me the query how to extract numeric values from varchar variable.
Thank you
Knockaert
select regexp_replace('123-A456BC7890D','[^0-9]') from dual;
See you soon,.
Manik.
-
How to do a validation based on the SQL query?
Hello
I have a requirement to perform a validation on a field (messageTextinput) in my page OAF.
When I click the button apply, the value in this field is validated based on a SQL query (for example, the value in the field NOT IN (value1 select from table1).)
Help, please.
Best regards
Joe
1. create a SQL query based VO, XXVO. For example:-SQL query is select xx_table;
2. Enter the "Apply" button click event in the controller and run the AM method passing the value entered by the user in the given field, for example:-value is VAL1
3. in the method of the AM, get a handle of the VO, the whereClause and run.
OAViewObjectImpl vo = findViewObject ("XXVO1"); XXVO1 is the name of the instance of the VO above, XXVO
vo.executeEmptyRowSet ();
vo.setWhereClause (null);
vo.setWhereClause ("value =" + VAL1 + "'");
vo.executeQuery ();
If (VO. GetRowCount() > 0)
A record is with the value of VAL1. Perform the required action
I hope this helps.
-
Feature of the parallel execution of SQL query
Hello guys,.
I installed a 11 GR 2 Oracle RAC (11.2.0.3) database, but I see the use of the feature of running parallel SQL queries, but I never used that.
I would like to know if this feature is enabled by default on CCR environments and if it does not require me to pay for Enterprise Edition.
NAME DETECTED_USAGES FIRST_USA LAST_USAG CURRE
---------------------------------------------------------------- --------------- ----- --------- ---------
Checking Options 1 TRUE 9 October 15 October 9, 15
BMG Auto setting 1 TRUE 9 October 15 October 9, 15
Memory of the execution of SQL auto 1 TRUE 9 October 15 October 9, 15
Automatic management of the space Segment (System) 1 TRUE 9 October 15 October 9, 15
Automatic Storage Management 1 TRUE 9 October 15 October 9, 15
Management of the Undo Automatic 1 TRUE 9 October 15 October 9, 15
Character set 1 TRUE 9 October 15 October 9, 15
Deferred Segment creation 1 TRUE 9 October 15 October 9, 15
Locally managed tablespaces (System) 1 TRUE 9 October 15 October 9, 15
Locally managed tablespaces (user) 1 TRUE 9 October 15 October 9, 15
Logfile multiplexing 1 TRUE 9 October 15 October 9, 15
Oracle Java Virtual Machine (System) 1 TRUE 9 October 15 October 9, 15
Oracle utility of metadata API 1 TRUE 9 October 15 October 9, 15
1 SQL query in parallel TRUE 9 October 15 October 9, 15
Partitioning (System) 1 TRUE 9 October 15 October 9, 15
Real Application Clusters (RAC) 1 TRUE 9 October 15 October 9, 15
Recovery zone 1 TRUE 9 October 15 October 9, 15
SECUREFICHIERS (System) 1 TRUE 9 October 15 October 9, 15
SECUREFICHIERS (user) 1 TRUE 9 October 15 October 9, 15
The parameter server file 1 TRUE 9 October 15 October 9, 15
Thanks in advance,
Franky
You are not, but Oracle is, since you are using RAC. Oracle relies on execution in parallel against the gv$ views so even if you can't use it in SE way common Oracle can when it comes to query against one of the points of view gv$. That's why DBA_FEATURE_USAGE_STATISTICS reports that you see.
David Fitzjarrell
-
SQL query for the region of the tree
Hello
I was wondering if someone is able to help me work on a SQL query, to format the data in the table required in a part of the tree... I've never used a tree and I'm fighting to get the right data (if possible).
The data in the table looks like this:
I want to put it in a tree, using level 1 level6 with a final layout that would look like this:
As you can see, the data are formatted in level6 down in the tree, but are filled in the table from level 1. Not all of the columns will be filled, so level2 for anyone 4 (France) is the equivalent of level in the tree like level6 to person 1 (Spain).
This is Apex 4.2.5
Oracle 11.2.0.3.0
Sample data:
CREATE TABLE employees ( employee VARCHAR2(100), level1 VARCHAR2(100), level2 VARCHAR2(100), level3 VARCHAR2(100), level4 VARCHAR2(100), level5 VARCHAR2(100), level6 VARCHAR2(100) ); INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person1','Team One','Recruitment','Human Resources','Fictituous Company','Murcia','Spain'); INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person2','Team Four','Testing','IT','Big Corporate','Hanover','Germany'); INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person3','Big Corporate','Hanover','Germany', null, null, null); INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person4','Brittany','France', null, null, null, null); INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person5','Team Three','Testing','IT','Big Corporate','Hanover','Germany'); INSERT INTO employees (employee, level1, level2, level3, level4, level5, level6) VALUES ('Person6','Public Relations','Government Agency','Brittany','France', null, null);
Added example given.
Hello
Apex-user wrote:
Thanks Frank, this is a good example, I can work with that! Your assumptions are correct.
A question I came, however, is that I have a data segment that comes across poorly formatted so to speak... where only the lower levels (1-2, etc.) have been filled from the bottom up.
An example of this data would be:
- INSERT INTO employees (employee, level 1, 2, level3, level4, level5, level6) VALUES ('Person7', 'One Team', 'Test', null, null, null, null);
As you can see that if you rerun the select, the test team is now duplicated, both at the level of the root in the tree as it should.
You are not sure if the sql can be adjusted to account for this, or if it's too hard?
It is obviously a question of data and I am trying to solve this separately (extracted data from another system out of my control).
Thank you!
Sorry, I'm confused.
You say that my assumptions were correct. What includes supported that "If test ' occurs under 'IT' in a row, then the extent of the 'Testing' occurs, it must be under"IT "? Right after you say that assumptions are correct, you give an example where 'Testing' occurs under 'IT' to a single line, but it is not less 'IT' to another line and where is 'One Team' under 'Testing' in a line, but is 'One Team' under 'Recruitment' in another row.
When a situation like this occurs, how you cope? Whenever you have a problem, please post the exact results you want from the given sample data, and an explanation of how you get these results. If you don't know about what would be the ideal results, or if you are flexible on the exact results, then at least give an example and explain your reasons.
Maybe you want to change the got_parent of subquery like this:
WITH unpivoted_data AS
(
SELECT *.
Employees
UNPIVOT (node_name
FOR lvl (level1 AS 1
level2 AS 2
level3 AS 3
level4 AS 4
level5 AS 5
level6 AS-6
)
)
)
got_parent AS
(
SELECT c.node_name
MIN (p.node_name) AS a parent
Of unpivoted_data c
LEFT OUTER JOIN unpivoted_data p ON p.employee = c.employee
AND p.lvl = c.lvl + 1
GROUP BY c.node_name
)
SELECT LPAD (' ' ')
2 * (LEVEL - 1)
) || Node_name AS entity
OF got_parent
START WITH parent IS NULL
Parent = node_name PRIOR CONNECTION
;
In this way, if 'Test' is current 'IT' in one line, but not under what in another line, whether under would consider the 'IT' request and not to be a root. If 'One Team' sudden 'Testing' in a line, but under "Recruitment" in another line, it will be (arbitrarily) consider it under "recruitment".
-
SQl query to find out time between the different lines of transactions
(See both images from an attachment to get the clear picture of the data and understand the question correctly.)
I have a set of data like this in one of my paintings. (This is a simple representation of the original data.)
Reference table1.jpg
Id | Type | Value | Start_date | End_date
----------------------------------------------------------------------------------------------------------------------
ZTR0098 | ALLOW | 0 | 1 JUN | 2 JUN |
ZTR0098 | ADTAX | 0 | 1 JUN | 2 JUN |
ZTR0098 | MXTAX | 0 | 1 JUN | 9 JUN |
ZTR0098 | ALLOW | 4. 3 JUN | 15 JUN |
ZTR0098 | ADTAX | 44.00 | 3 JUN | 17-JUNE |
ZTR0098 | MXTAX | 2. 10 JUN | 17-JUNE |
ZTR0098 | ALLOW | 5. 16-JUNE | 20 JUN |
ZTR0098 | ADTAX | 55,34 | 18 JUN | 22 JUN |
ZTR0098 | MXTAX | 1. 18 JUN | 25 JUN |
ZTR0098 | MXTAX | 6. 26 JUN | 31 AUG |
ZTR0098 | ADTAX | 20.09. 23 JUN | 23 JUL |
ZTR0098 | ALLOW | 8. 21 JUN | 31 AUG |
ZTR0098 | ADTAX | 45. 24 JUL | 31 AUG |
each line has a type and a rasthaus id to it. ID belongs to other parent tables. the value of each type is given, and the validity of each value is followed by a field start_date and end_date.
All values start from 1 - JUN and expires on 31 - AUG. Now my requirement is to obtain a report that gives three columns for three different types (ALLOW, ADTAX and MXTAX) with combination of unique values in the effective time interval. Let me put the result below.
Reference table2.jpg
Id | ALLOW | ADTAX | MXTAX | Start_date | End_date
--------------------------------------------------------------------------------------------------------------------------------------------------
ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |
ZTR0098 | 4. 44.00 | 0 | 3 JUN | 9 JUN |
ZTR0098 | 4. 44.00 | 2. 10 JUN | 15 JUN |
ZTR0098 | 5. 44.00 | 2. 16-JUNE | 17-JUNE |
ZTR0098 | 5. 55,34 | 1. 18 JUN | 20 JUN |
ZTR0098 | 8. 55,34 | 1. 21 JUN | 22 JUN |
ZTR0098 | 8. 20.09. 1. 23 JUN | 25 JUN |
ZTR0098 | 8. 20.09. 6. 26 JUN | 23 JUL |
ZTR0098 | 8. 45. 6. 23 JUL | 31 AUG |
As you can see there are no duplicate rows for a combination of (ALLOW, ADTAX and MXTAX) with their respective dates in force. resulting in the above table. the first step is to convert lines to the column which is pretty obvious to do that by grouping on start_date and end_date colum, but the real deal is the time interval during which the combination of the values (ALLOW, ADTAX, and MXTAX) has remained constant.
I wrote under query using Group by.
Select
ID,
NVL (max (decode (type, "ALLOW", value)), 0) as ALLOW
NVL (max (decode (type, 'ADTAX', value)), 0) as ADTAX
NVL (max (decode (type, 'MXTAX', value)), 0) as MXTAX
Start_date,
End_date
from my_table
Group of start_date, end_date, id
start_date, end_date
the results it gives are like this:
Reference table3.jpg
Id | ALLOW | ADTAX | MXTAX | Start_date | End_date
------------------------------------------------------------------------------------------------------------------------------------------------
ZTR0098 | 0 | 0 | 0 | 1 JUN | 2 JUN |
ZTR0098 | 0 | 0 | 2. 1 JUN | 9 JUN |
ZTR0098 | 4. 0 | 0 | 3 JUN | 15 JUN |
ZTR0098 | 0 | 44.00 | 0 | 3 JUN | 17-JUNE |
ZTR0098 | 0 | 0 | 2. 10 JUN | 17-JUNE |
ZTR0098 | 5. 0 | 0 | 16-JUNE | 20 JUN |
ZTR0098 | 0 | 55,34 | 0 | 18 JUN | 22 JUN |
. .
. .
like wise
but I'm not able to determine the time intervals by using the SQL query.
with
Table1 as
(select the id 'ZTR0098', 'ALLOW' type, 0 val, to_date('1-JUN','dd-MON') start_date, end_date Union to_date('2-JUN','dd-MON') double all the)
Select 'ZTR0098', 'ADTAX', 0, to_date('1-JUN','dd-MON'), to_date('2-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 0, to_date('1-JUN','dd-MON'), to_date('9-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 4, to_date('3-JUN','dd-MON'), to_date('15-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 44.00, to_date('3-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 2, to_date('10-JUN','dd-MON'), to_date('17-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 5, to_date('16-JUN','dd-MON'), to_date('20-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 55.34, to_date('18-JUN','dd-MON'), to_date('22-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 1, to_date('18-JUN','dd-MON'), to_date('25-JUN','dd-MON') of all the double union
Select 'ZTR0098', 'MXTAX', 6, to_date('26-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 20.09, to_date('23-JUN','dd-MON'), to_date('23-JUL','dd-MON') of all the double union
Select 'ZTR0098', 'ALLOW', 8, to_date('21-JUN','dd-MON'), to_date('31-AUG','dd-MON') of all the double union
Select 'ZTR0098', 'ADTAX', 45, to_date('24-JUL','dd-MON'), to_date('31-AUG','dd-MON') of the double
),
days like
(select level - 1 dte + to_date('1-JUN','dd-MON')
of the double
connect by level<= to_date('31-aug','dd-mon')="" -="" to_date('1-jun','dd-mon')="" +="">=>
)
Select id, allow, adtax, mxtax, min (dte) start_date, max (dte) end_date
(select ID, dte, max (allow) allow, max (adtax) adtax, max (mxtax) mxtax,
ROW_NUMBER() over (order by dte) row_number() - courses (partition by order max (allow), max (adtax), max (mxtax) by dte) gr
go (select id, dte,
-case when type = 'ALLOW' and dte between start_date and end_date then end val 0 otherwise allow.
-case when type = "ADTAX" and dte between start_date and end_date then val 0 otherwise end adtax.
-case when type = "MXTAX" and dte between start_date and end_date then val 0 otherwise end mxtax
Table 1 t,
days d
where d.dte between t.start_date and t.end_date
)
Group by id, dte
)
Group by id, gr, allow, adtax, mxtax
order by id, gr
ID ALLOW ADTAX MXTAX START_DATE END_DATE ZTR0098 0 0 0 01/06/2015 02/06/2015 ZTR0098 4 44 0 03/06/2015 09/06/2015 ZTR0098 4 44 2 10/06/2015 15/06/2015 ZTR0098 5 44 2 16/06/2015 17/06/2015 ZTR0098 5 55,34 1 18/06/2015 20/06/2015 ZTR0098 8 55,34 1 21/06/2015 22/06/2015 ZTR0098 8 20.09 1 23/06/2015 25/06/2015 ZTR0098 8 20.09 6 26/06/2015 23/07/2015 ZTR0098 8 45 6 24/07/2015 31/08/2015 Concerning
Etbin
-
SQL query to represent the data in the graph bar
Hello
JDev 11.1.1.5.0
We must create a dashboard to track the translation. We have created the ADF table with buttons 'Create', 'Update' and 'Delete' to manipulate the table.
Our DB table structure is
File_id (PK), File_Name, ToSpanish - ARE (YES/NO), beginning of the ToSpanish, ToChina(YES/No), ToChina-Date... etc.
Once the translated file required language then user must update the DB table using the button "Update".
So far, we have implemented the requirement above.
We need represent the status of the translation in the graph bar with the language as X access and file count get access Ex: Spanish-100 China - 200 files files
Please suggest the sql query to retrieve the necessary info from the DB table that can be represented in the graph bar. Also, it would be great, if you can provide a pointers to create a bar chart.
Thanks in advance,
MSR.
If you set your major increment and minor than 1, then you won't not show decimal points. You can try setting these 10 or 100 to reach your goal.
Subtype = "BAR_VERT_CLUST" >
-
Hi all
I'm using Oracle 11.2.0.3
CREATE TABLE PRODUCT (ID NUMBER, PRODUCT_CODE VARCHAR2 (30));
INSERT INTO THE PRODUCT VALUES (1, 'CAR1');
INSERT INTO THE PRODUCT VALUES (2, 'CAR2');
INSERT INTO THE PRODUCT VALUES (3, 'CAR3');
INSERT INTO THE PRODUCT VALUES (4, 'CAR4');
INSERT INTO THE PRODUCT VALUES (5, 'CAR5');
CREATE TABLE ITEM_STG (ITEM_CODE VARCHAR2 (30), ITEM_DESC VARCHAR2 (200));
INSERT INTO ITEM_STG VALUES ('CAR1', 'MARUTI');
INSERT INTO ITEM_STG VALUES ('CAR2', 'AUNTIE');
CREATE TABLE AN ELEMENT (ITEM_CODE VARCHAR2 (30), ITEM_DESC VARCHAR2 (200));
INSERT INTO ARTICLE VALUES ('CAR1', 'BMV');
INSERT INTO ARTICLE VALUES ('CAR2', 'BENZ');
INSERT INTO ARTICLE VALUES ('CAR2', 'LANDROVER');
INSERT INTO ARTICLE VALUES ('CAR2', 'JAGUAR');
My requirement is like I make a query
so that it checks the product code with the item code
and first he will get the values of the table ITEM_STG if the value of patcular is not found in the table ITEM_STG then it goes to the table ARTICLE
can it be possibel in simple sql query
SELECT A.PRODUCT_CODE, NVL (B.ITEM_DESC, C.ITEM_DESC)
THE PRODUCT,.
B ITEM_STG,
POINT C
WHERE A.PRODUCT_CODE = B.ITEM_CODE
AND A.PRODUCT_CODE = C.ITEM_CODE
I tried like the query above and with left join and other possibilities, but getting not the query.
Please help me
Thank you
You were close...
SQL> ed Wrote file afiedt.buf 1 select a.product_code, nvl(b.item_desc, c.item_desc) item_desc 2 from product a, item_stg b, item c 3 where a.product_code = b.item_code ( + ) 4* and a.product_code = c.item_code SQL> / PRODUCT_CODE ------------------------------ ITEM_DESC --------------------------------------------------------------------- CAR1 MARUTI CAR2 TATA CAR4 JAGUAR PRODUCT_CODE ------------------------------ ITEM_DESC --------------------------------------------------------------------- CAR3 LANDROVER
Note: remove space (+)
Grrr... stupid software
-
How to display time in 010403 format if the entry is transmitted as ' 1 hour, 4 minutes, 3 seconds"sql query @.
Hello
You can try:
Select lpad (regexp_substr ('1 hour, 4 minutes, 3 seconds ',' [[: digit:]] + ""), 2, '0')
|| LPAD (regexp_substr ('1 hour, 4 minutes, 3 seconds ',' [[: digit:]] +', 1, 2), 2, '0')
|| LPAD (regexp_substr ('1 hour, 4 minutes, 3 seconds ',' [[: digit:]] +' 1, 3), 2, '0')
Double;
but this requires maximum 99 hours/minutes/seconds ago in your entry.
-
Hello
I have a data in table (raj_table) with columns (char11) raj_id, raj_number (varchar2 (15)), raj_format (NUMBER), Primary_ID (identity with the values of the primary key column)
Primary_ID raj_id Raj_number Raj_format
1 raj rajvend 1
2 raj rajvend 1
3 raj rajvendor1 2
4 raj rajvendor1 2
5 raj rajvendor1 2
6 raj rajvendor2 3
I used under SQL to get query output as below, but has not achieved the required result:
Select client_id vendor_number, vendor_format, primary_id, row_number() on sl_no (client_id partition, primary_id, vendor_format order of client_id primary_id, vendor_format, vendor_number, vendor_number)
from raj_table by sl_no asc
SL_NO raj_id raj_number raj_format primary_id
1 1 raj rajvendor 1
1 2 raj rajvendor 1
2 3 raj rajvendor1 2
2 4 raj rajvendor1 2
2 5 raj rajvendor1 2
3 6 raj rajvendor2 3
I need help with a SQL query to get the result as above without using the group by clause. I want to bring together the combination of separate line of the three columns (raj_id, raj_number, raj_format) and add a unique serial number for each online game (SL_NO column below). So, above there are 3 unique set of (raj_id, raj_number, raj_format) I can get in a group by clause, but I can not add prmiary_id, SL_NO values if I group by clause. I used the analytical functions like row_number() but no luck. Need solution for this.
with t as)
Select 'raj' raj_id, 'rajvend' raj_number, 1 raj_format, 1 primary_id Union double all the
Select option 2, 'raj', 'rajvend', 1 double Union all
Select 3, 'raj', 'rajvendor1', 2 double Union all
Select 4, 'raj', 'rajvendor1', 2 double Union all
Select 5, 'raj', 'rajvendor1', 2 double Union all
Select 6, 'raj', 'rajvendor2', 3 double
)
Select dense_rank() over (order of raj_id, raj_number, raj_format) sl_no,
t.*
t
order by primary_id
/
PRIMARY_ID RAJ RAJ_NUMBER RAJ_FORMAT SL_NO
---------- ---------- --- ---------- ----------
1 1 raj rajvend 1
1 2 raj rajvend 1
2 3 raj rajvendor1 2
2 4 raj rajvendor1 2
2 5 raj rajvendor1 2
3 6 raj rajvendor2 36 selected lines.
SQL >
SY.
-
SQL QUERY THAT RETURNS THE PL/SQL
Hello
I'm putting in 4.2 below apex
DECLARE
date of frdate: =: P22_FROMDATE;
date date: =: P22_TODATE;
l_date1 varchar2 (11): = to_char(frdate,'dd-mon-yyyy');
l_date2 varchar2 (11): = to_char(todate,'dd-mon-yyyy');
v_sql varchar2 (32000);
v_Name varchar2 (4000): = months_name (frdate, todate);
char (1) of the v1: = q "[']";
number of lbr1 (6): =: P22_FROMBRANCH;
number of LBR2 (6): =: P22_TOBRANCH;
number of M1 (6): = 11;
Start
v_sql: ='SELECT * FROM (SELECT LBRCODE, PRDACCTID, MN, AVGX FROM (SELECT LBRCODE, PRDACCTID, MN, SUM (BALL) BALL, COUNT (MN) DAYS, ROUND (SUM (BAL) count (MN), 2) AVGX ';))
v_sql: = v_sql | "FROM (SELECT LBRCODE, PRDACCTID, TO_CHAR (BALDATE,'|)) CHR (39) | ' MM' | CHR (39) |') ' | ' ||'|| CHR (39) | » _'|| CHR (39) |' | ' || «TO_CHAR (BALDATE,'|)» CHR (39) | ' AAAA '. CHR (39) |') MN, BALL ';
V_SQL: = V_SQL | "(SELECT Q2. LBRCODE, Q2. PRDACCTID, T1. BALDATE, T_OST_NEW (Q2. LBRCODE, Q2. PRDACCTID, T1. BALDATE) BALL ';
V_SQL: = V_SQL | "FROM (select TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') baldate FROM DUAL Union all the ';
V_SQL: = V_SQL |' select (TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') + level) double baldate ';
V_SQL: = V_SQL |' connect by level < = (TO_DATE('||) Chr (39) | l_date2 | Chr (39) | «, » || CHR (39) | ' DD-MON-YYYY ' | CHR (39) |') -TO_DATE('||) Chr (39) | l_date1 | Chr (39) | «, » || CHR (39) | ' Dd-mon-yyyy ' | CHR (39) |')) ) Q1,';
V_SQL: = V_SQL | "(SELECT LBRCODE,'|) ' (rpad (prdcd, 8,'|)) V1 ||'' || v1 |') || LTRIM (rpad('|| v1 ||) » x'|| V1 | «, 25, » || v1 | » 0' || v1||'),'|| v1 | » x'|| v1 |')) prdacctid OF D009021 WHERE the LBRCODE between ' | : P22_FROMBRANCH |' and ' | : P22_TOBRANCH | "AND moduleinfo =' | TO_NUMBER(:P22_SELECTLIST);
V_SQL: = V_SQL |') ((Q2)) GROUP BY LBRCODE, PRDACCTID, MN))';
V_SQL: = V_SQL | "PIVOT (MAX (AVGX) (MN) IN (';))
V_SQL: = V_SQL | V_NAME;
V_SQL: = V_SQL |')) ORDER OF LBRCODE, PRDACCTID ';
RETURN V_SQL;
END;
I created all the elements of the required page
I get the error message like missing expression
to test, I created a function to return the query, it works very well know to return a query that gives me desired report
am I missing something?
Help, please
HEMU wrote:
Hello Sir
Sorry to bother you again
I tried to use «function that returns colon-delimited topics»
and I got following error
unable to determine query headings: ORA-06550: line 1, column 138: PLS-00103: Encountered the symbol ";" when expecting one of the following: . ( ) , * % & = - + < / > at in is mod remainder not rem => <> or != or ~= >= <= <> and or like like2 like4 likec between || multiset member submultiset The symbol ")" was substituted for ";" to continue.
failed to parse SQL query:
can take you a look at page901 once again please and a function named months_namex
is it feasible that I'm looking for?
The immediate cause of this error is simply incorrect report headings function call syntax:
return months_namex(to_date(:p901_fromdate,'dd-mon-yyyy'),to_date(:p901_todate,'dd-mon-yyyy')
This should be:
return months_namex(to_date(:p901_fromdate,'dd-mon-yyyy'),to_date(:p901_todate,'dd-mon-yyyy'));
However there is no
months_namex
function defined in the workspace.
Maybe you are looking for
-
Why does my computer keep with 30% remaining battery?
Whenever my MacBook Air gets to between 20 to 30% of its power, it stops. It is about 3 years old. Why is this happening? It is used to stop only when he was close to 0%. Thank you Ian
-
Windows Defender does not start.
Windows defender is disabled and cannot be started
-
A constant security update?
I get an update, I downloaded it, but it keeps re appearing. its this > kb2742595 security update no idea why? or how can I remove it
-
Hello I have a problem in my aspire 5630 Windows Vista. The HOST PROCESS for WINDOWS Services stopped working and was closed. A problem with the application to stop functioning properly. Windows will notify you if a solution is available. I tried to
-
NEED DRIVER LINK FOR WINDOWS 8 32/64 BIT INSPIRON 1545:
HELLO READING, I USE INSPIRON 1545 IN PAST TWO YEARS. WEEK, I BOUGHT 8 64-BIT WINDOWS IN THE MICROSOFT WEB SITE... AFTER INSTALLING THIS OPERATING SYSTEM... MORE THAN 4 DAYS I WAS LOOKING FOR WINDOWS 8 DELL.COM AND WEBSITE OF THE THIRD PARTY DRIVERS.