Help Reqd - on simple sql query
Hi,
I have two tables back_temp_ord_hist, temp_ord_hist of similar structures
create table <table_name>
order_number varchar2(10),
item_number integer,
sched_line_number integer,
dlv_doc_id varchar2(10),
mtrl_mstr_key integer,
cust_key integer,
wrhse_key integer,
sls_ord_type varchar2(4)
Now I have inserted same data set in the two tables. (same following three rows in both the tables)
0009032022 160 2 0091383073 27219 1694 20 ZISO
0009032022 160 3 0091383073 27219 1694 20 ZISO
0009032022 160 4 0091383073 27219 1694 20 ZISO
Then I am trying to use a query like below :
select
fact.order_number
, fact.item_number
, fact.sched_line_number
, bk_fact.sched_line_number as old_sched_line_number
, fact.dlv_doc_id
,dbms_utility.get_hash_value(fact.order_number||fact.item_number||fact.sched_line_number||fact.dlv_doc_id,1,100) ord_hist_hash
,dbms_utility.get_hash_value(bk_fact.order_number||bk_fact.item_number||bk_fact.sched_line_number||bk_fact.dlv_doc_id,1,100) back_ord_hist_hash
, fact.mtrl_mstr_key
, bk_fact.mtrl_mstr_key as old_mtrl_mstr_key
, fact.cust_key
, bk_fact.cust_key as old_cust_key
, fact.wrhse_key
, bk_fact.wrhse_key as old_wrhse_key
, fact.sls_ord_type
, bk_fact.sls_ord_type as old_sls_ord_type
from
temp_ord_hist fact
join
back_temp_ord_hist bk_fact
on fact.order_number = bk_fact.order_number
and fact.item_number = bk_fact.item_number
and fact.sched_line_number <> bk_fact.sched_line_number
and fact.dlv_doc_id = bk_fact.dlv_doc_id
order by ord_hist_hash, back_ord_hist_hash
But it is actually it is showing 6 rows. But ideally I want no rows as temp_ord_hist.sched_line_number = back_temp_ord_hist.sched_line_number in all the cases over here.
Practically it can be different then I want those rows but when it is same why the output is showing 6 rows.
What I am doing wrong over here?
Regards,
Koushik
Not sure how you are getting 6 rows as the output. I did exactly the same thing that you did and I am getting the only 3 rows as the output:
see below:
SQL> create table temp_ord_hist
2 (
3 order_number varchar2(10),
4 item_number integer,
5 sched_line_number integer,
6 dlv_doc_id varchar2(10),
7 mtrl_mstr_key integer,
8 cust_key integer,
9 wrhse_key integer,
10 sls_ord_type varchar2(4)
11 );
Table created.
SQL> create table back_temp_ord_hist
2 (
3 order_number varchar2(10),
4 item_number integer,
5 sched_line_number integer,
6 dlv_doc_id varchar2(10),
7 mtrl_mstr_key integer,
8 cust_key integer,
9 wrhse_key integer,
10 sls_ord_type varchar2(4)
11 );
Table created.
SQL> insert into temp_ord_hist values ('0009032022',160,2,'0091383073',27219,1694,20,'ZISO');
1 row created.
SQL> insert into temp_ord_hist values ('0009032022',160,3,'0091383073',27219,1694,20,'ZISO');
1 row created.
SQL>
SQL> insert into temp_ord_hist values ('0009032022',160,4,'0091383073',27219,1694,20,'ZISO');
1 row created.
SQL> insert into back_temp_ord_hist values ('0009032022',160,2,'0091383073',27219,1694,20,'ZISO');
1 row created.
SQL> insert into back_temp_ord_hist values ('0009032022',160,3,'0091383073',27219,1694,20,'ZISO');
1 row created.
SQL> insert into back_temp_ord_hist values ('0009032022',160,4,'0091383073',27219,1694,20,'ZISO');
1 row created.
SQL> select
2 fact.order_number
3 , fact.item_number
4 , fact.sched_line_number
5 , bk_fact.sched_line_number as old_sched_line_number
6 , fact.dlv_doc_id
7 ,dbms_utility.get_hash_value(fact.order_number||fact.item_number||fact.sched_line_number||fact.dlv_doc_id,1,100) ord_hist_hash
8 ,dbms_utility.get_hash_value(bk_fact.order_number||bk_fact.item_number||bk_fact.sched_line_number||bk_fact.dlv_doc_id,1,100) back_ord_hist_hash
9 , fact.mtrl_mstr_key
10 , bk_fact.mtrl_mstr_key as old_mtrl_mstr_key
11 , fact.cust_key
12 , bk_fact.cust_key as old_cust_key
13 , fact.wrhse_key
14 , bk_fact.wrhse_key as old_wrhse_key
15 , fact.sls_ord_type
16 , bk_fact.sls_ord_type as old_sls_ord_type
17 from
18 temp_ord_hist fact
19 join
20 back_temp_ord_hist bk_fact
21 on fact.order_number = bk_fact.order_number
22 and fact.item_number = bk_fact.item_number
23 and fact.sched_line_number = bk_fact.sched_line_number
24 and fact.dlv_doc_id = bk_fact.dlv_doc_id
25 order by ord_hist_hash, back_ord_hist_hash
26
SQL> /
0009032022 160 3 3 0091383073 4 4 27219 27219 1694 1694 20 20 ZISO ZISO
0009032022 160 4 4 0091383073 55 55 27219 27219 1694 1694 20 20 ZISO ZISO
0009032022 160 2 2 0091383073 100 100 27219 27219 1694 1694 20 20 ZISO ZISO
SQL>
Similar Messages
-
Simple SQL query statement is needed
I need a simple SQL query to fetch records which is existed in all the departments.
for example: i want to list the employees which are existed in each and every department.. not sure how should i get those.. will anyone help me please.. thanks in advanceI think it would be wise to go to the following training:
Oracle Database <version> : Introduction to SQL
You will get the information you are looking for in five days. You can go find a tutorial on ANSI SQL, as advised by this board for free, to fix your immediate problem with a simple query. But, I personally recommend a more formal class specific to Oracle, as you will also get information about PL/SQL, and you get the benefit with working with other DBA/programmers when you are learning. This will solve your immediate issue, and any future issues with the language.
You can find it in the Education section of the Oracle website. -
Help needed in framing SQL query.
Hi,
I have table having following schema:
PRODUCT_ID INT
DATE DATETIME
ITEMS_SOLD INT
This table contains data for a week (sunday to saturday). I want to write an SQL query to get (filter out) PRODUCT_ID of products which has same no. of ITEMS_SOLD for all 7 days. Also for given PRODUCT_ID I need to find the longest period of successive days where the no. of ITEMS_SOLD is same for all days in this period. Eg.(PRODUCT_ID 23 was sold as following along the week in no. of units sold: 4,6,6,6,6,7,4 .So the longest period is *4 days* from Monday to Thursday.) The first condition is special case of second condition where no. of days is 7.
Any help to get the SQL query will be appreciated.
Thanks,
Akshay.PRODUCT_ID DATE ITEMS_SOLD
1 10/10/2011 3
1 11/10/2011 3
1 12/10/2011 3
1 13/10/2011 3
1 16/10/2011 5
2 10/10/2011 4
2 11/10/2011 4
2 12/10/2011 4
2 13/10/2011 4
2 14/10/2011 4
2 15/10/2011 4
2 16/10/2011 4
Output:
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
1 3 4
2 4 7
Explanation of results:
The table to be queried contains data for 1 week: from 10/10/2011(Sunday) to 16/10/2011(Saturday). Now, product with PRODUCT_ID '1' was sold on dates 10,11,12,13,16. Out of these 5 days 3 units were sold on 4 successive days (from 10-13). So output should be like :
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
1 3 4
as longest period of successive days is 4 where same no. of units were sold i.e 3 units (other period is of 1 day on 16th ).
For PRODUCT_ID 2 we have only one period of 7 days where 4 units were sold each day. So we output :
PRODUCT_ID ITEMS_SOLD NO_OF_DAYS
2 4 7
Other case where same PRODUCT_ID have different units sold on each day should be ignored.
I hope that clarifies the problem more. Let me know in case I have missed out anything which should have been mentioned.
-Akshay. -
Simple SQL Query and Parameters and LOV
Newbie and trying to work thru building a simple sql query with a single table query and use a parameter and lov.
Can anyone point me to an example.
simple query:
select cust_id, name_desc, name_add1, name_add2, name_city
from customer_table
where cust_id = :cust_parm
This works in straight sql and in the query builder by prompting for the customer ID. When building a parameter using LOV or search, it doesn't seem to detect the variable.
Thanks..
DDIf you are using version 11g, then as soon as you save the query in the data model, it should notice the parameter and ask if you want to add the parameter to the data model. What version of BIP are you using?
What happens if you exclude the parameter from the query and simply hard-code the criteria? Can you generate XML data?
From your wording, it sounds like you're trying to create a parameter from the LOV dialog. LOVs and parameters are totally distinct. After each are created separately, then you configure the parameter to use the LOV. -
Help me write a SQL query; urgent
Hi, can somebody please help me write a SQL query.
I have 3 tables each with the same column names (Col1, Col2, Col3). Col1 is PK with Unique Constraint.
I wanted to add values of Col2 and Col3 (from all 3 tables) and put it in a separate table (i.e aggregated) of all values found in Col1.
Does anybody help me please ?
thanks alot.Please don't mark your question as urgent. You've been around here long enough that you should know that it will not get your question anwered any faster, and may just irritate people into not answering at all.
I'm not sure exactly what you want.
Are you saying you want t1.c2 + t1.c3 + t2.c2 + t2.c3+ t3.c2 + t3.c3 for the rows that have the same c1 in all three tables?
If so, it would be like this, I think: insert into t4
select t1.c1
, t1.c2 + t1.c3 + t2.c2 + t2.c3+ t3.c2 + t3.c3
from t1, t2, t3
where t2.c1 = t1.c1
and t3.c1 = t1.c1If that's not what you want, please clarify.
And next time maybe you should post your SQL question in a SQL forum. -
Help needed in executing SQL query...
Hi,
I am very new to JDeveloper. Curently i am tryin to execute an SQL query from the BPEL process, the output of the query is to be mapped to a variable field from a target xsd file. the query is fairly simple, like
SELECT emp
FROM emp_table
WHERE emp_id=123
The target field, namely "employee", is an element from the xsd file. I tried using Java embedding activity to connect to the db and execute the query through a piece of Java code, but couldn't find a way to assign the output of the query to the field. however lately i also discovered the Database Adapter services which helps me create a database connection, but still i am not sure as of how to handle and map the output of the query to the variable field.
Can somebody please help me in resolving the issue either through Java Embed activity or Database Adapter services??
Thanks in advance
AnjanAnjan,
I suggest you try the [url http://forums.oracle.com/forums/forum.jspa?forumID=212]BPEL Forum
John -
Need help in rewriting a sql query
Can any one please tell me if there is any utility that can help me correcting the sql I have I need to tune the query as its taking lot of time. I want to use some tool that will help me re-formating the query.
Any help in this regard will be highly appreciated.If you think that Oracle SQL Tuning Tools like SQL Tuning Advisor and SQL Access Advisor are not helping.
You might look into thrid party tools like Quest- SQL Navigator and TOAD.
But I don't advise this based on the following:
Re: Oracle Third Party Tools and Oracle Database
Oracle have enough tools of its own to satisfy the various needs.
Adith -
Need help in Report From SQL Query
Hi All,
I am facing a problem with a report. I need your help.
I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
I tried also increase the page time out in httpd.conf, but no use.
The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
Please help me to find appropriate reasone for the failure?user602513 wrote:
Hi All,
I am facing a problem with a report. I need your help.
I am creating a Report From SQL Query (Portal) with some arguments passed at runtime. I am able to view the output, if the query returns few rows ( arount 1000 rows). But for some inputs it needs to generate >15000 records, at this point the page is getting time out (i think!) and showing error page. I am able to execute query from the SQL Plus console ot using TOAD editor. Here the query is not taking more that 2 mins time to show the result.
If i am executing from Portal i observed that, once i give the appropriate input and hit submit button a new oracle process is getting created for the query on UNIX (I am usign "TOP" command to check processes). The browser page will be shown error page after 5 minutes (i am assuming session time out!) , but on the backend the process will be executed for more than 30 mins.
I tried also increase the page time out in httpd.conf, but no use.
The data returned as a result of the query is sized more than 10 MB. Is caching this much data is possible by the browser page? is the returned data is creating any problem here.
Please help me to find appropriate reasone for the failure?Do you get any errors or warnings or it is just the slow speed which is the issue?
There could be a variety of reasons for the delayed processing of this report. That includes parameter settings for that page, cache settings, network configurations, etc.
- explore best optimization for your query;
- evaluate portal for best performance configuration; you may follow this note (Doc ID: *438794.1* ) for ideas;
- third: for that particular page carrying that report, you can use caching wisely. browser cache is neither decent for large files, nor practical. instead, explore the page cache settings that portal provides.
- also look for various log files (application.log and apache logs) if you are getting any warnings reflecting on some kind of processing halt.
- and last but not the least: if you happen to bring up a portal report with more than 10000 rows for display then think about the usage of the report. Evaluate whether that report is good/useful for anything?
HTH
AMN -
Need Help with Creating the SQl query
Hi,
SQL query gurus...
INFORMATION:
I have two table, CURRENT and PREVIOUS.(Table Defs below).
CURRENT:
Column1 - CURR_PARENT
Column2 - CURR_CHILD
Column3 - CURR_CHILD_ATTRIBUTE 1
Column4 - CURR_CHILD_ATTRIBUTE 2
Column5 - CURR_CHILD_ATTRIBUTE 3
PREVIOUS:
Column1 - PREV_PARENT
Column2 - PREV_CHILD
Column3 - PREV_CHILD_ATTRIBUTE 1
Column4 - PREV_CHILD_ATTRIBUTE 2
Column5 - PREV_CHILD_ATTRIBUTE 3
PROBLEM STATEMENT
Here the columns 3 to 5 are the attributes of the Child. Lets assume that I have two loads, One Today which goes to the CURRENT table and one yesterday which goes to the PREVIOUS table. Between these two loads there is a CHANGE in the value for Columns either 3/4/5 or all of them(doesnt matter if one or all).
I want to determine what properties for the child have changed with the help of a MOST efficient SQL query.(PARENT+CHILD is unique key). The Database is ofcourse ORACLE.
Please help.
Regards,
ParagHi,
The last message was not posted by the same user_name that started the thread.
Please don't do that: it's confusing.
Earlier replies give you the information you want, with one row of output (maximum) per row in current_tbl. There may be 1, 2 or 3 changes on a row.
You just have to unpivot that data to get one row for every change, like this:
WITH single_row AS
SELECT c.curr_parent
, c.curr_child
, c.curr_child_attribute1
, c.curr_child_attribute2
, c.curr_child_attribute3
, DECODE (c.curr_child_attribute1, p.prev_child_attribute1, 0, 1) AS diff1
, DECODE (c.curr_child_attribute2, p.prev_child_attribute2, 0, 2) AS diff2
, DECODE (c.curr_child_attribute3, p.prev_child_attribute3, 0, 3) AS diff3
FROM current_tbl c
JOIN previous_tbl p ON c.curr_parent = p.prev_parent
AND c.curr_child = p.prev_child
WHERE c.curr_child_attribute1 != p.prev_child_attribute1
OR c.curr_child_attribute2 != p.prev_child_attribute2
OR c.curr_child_attribute3 != p.prev_child_attribute3
, cntr AS
SELECT LEVEL AS n
FROM dual
CONNECT BY LEVEL <= 3
SELECT s.curr_parent AS parent
, s.curr_child AS child
, CASE c.n
WHEN 1 THEN s.curr_child_attribute1
WHEN 2 THEN s.curr_child_attribute2
WHEN 3 THEN s.curr_child_attribute3
END AS attribute
, c.n AS attribute_value
FROM single_row s
JOIN cntr c ON c.n IN ( s.diff1
, s.diff2
, s.diff3
ORDER BY attribute_value
, parent
, child
; -
Hi everyone!
I need some help in composing a query that would calculate the number of occurrences of '29-Feb' between 2 given dates (i.e. substitution variables).
What I figured so far is a way too complex and don't work all the time. Also I do know, that calculating a leap year is a bit different than just year mod 4 = 0.
I would appreciate very much if you help me to write this query or just give me a guess.
SELECT TO_NUMBER(TO_CHAR(date2, 'YYYY')-TO_CHAR(date1, 'YYYY'))/4
FROM
(SELECT CASE
WHEN MOD(TO_NUMBER(TO_CHAR(TO_DATE('&&date1', 'DD-Mon-RR'), 'RR')), 4) = 0
THEN TO_DATE('&date1', 'DD-Mon-RR')
ELSE(CASE
WHEN MOD(TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&date1', 'DD-Mon-RR'), 12), 'RR')), 4) = 0
THEN ADD_MONTHS(TO_DATE('&date1', 'DD-Mon-RR'), 12)
ELSE(CASE
WHEN MOD(TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&date1', 'DD-Mon-RR'), 24), 'RR')), 4) = 0
THEN ADD_MONTHS(TO_DATE('&date1', 'DD-Mon-RR'), 24)
ELSE(CASE
WHEN MOD(TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&date1', 'DD-Mon-RR'), 12), 'RR')), 4) = 0
THEN ADD_MONTHS(TO_DATE('&date1', 'DD-Mon-RR'), 36)
END)
END)
END)
END date1,
CASE
WHEN MOD(TO_NUMBER(TO_CHAR(TO_DATE('&&date2', 'DD-Mon-RR'), 'RR')), 4) = 0
THEN TO_DATE('&date2', 'DD-Mon-RR')
ELSE(CASE
WHEN MOD(TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&date2', 'DD-Mon-RR'), 12), 'RR')), 4) = 0
THEN ADD_MONTHS(TO_DATE('&date2', 'DD-Mon-RR'), 12)
ELSE(CASE
WHEN MOD(TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&date2', 'DD-Mon-RR'), 24), 'RR')), 4) = 0
THEN ADD_MONTHS(TO_DATE('&date2', 'DD-Mon-RR'), 24)
ELSE(CASE
WHEN MOD(TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&date2', 'DD-Mon-RR'), 12), 'RR')), 4) = 0
THEN ADD_MONTHS(TO_DATE('&date2', 'DD-Mon-RR'), 36)
END)
END)
END)
END date2
FROM DUAL);
UNDEFINE date1;
UNDEFINE date2;Hi,
Interesting problem!
The query below looks at the 59th day after January 1 in each year.
If that date was in February, then it was a leap year.
If that date was not in February, then it was a common year.
DEFINE date1 = "TO_DATE ('07-11-1609', 'DD-MM-YYYY')"
DEFINE date2 = "TO_DATE ('06-11-2009', 'DD-MM-YYYY')"
WITH all_years AS
SELECT ADD_MONTHS ( TRUNC (&date1, 'YYYY')
, 12 * (LEVEL - 1)
) + 59 AS dt
FROM dual
CONNECT BY LEVEL <= 1 + CEIL ( MONTHS_BETWEEN ( &date2
, &date1
/ 12
SELECT COUNT ( CASE
WHEN TO_CHAR (dt, 'MM') = '02'
THEN 1
END
) AS leap_year_cnt
FROM all_years
WHERE dt BETWEEN &date1
AND &date2
;A less efficient (for what that's worth) way is to generate all dates between &date1 and &date2, and test each one to see if it is '02-29'.
I'll leave that as an exercise to the reader.
HINT: the coding is simpler than the query above. (In my prolix style, it took 10 lines. No sub-query is needed.) -
Simple SQL query SQL developer takes it, The wizzard of XE does not
Hello everybody
I wrote this simple query which SQL developer runs fine, but when I try to launch a Report based on this sql query it tells me invalid sql statement. That is true, it may be invalid because this IF clause in there..but SQL developer seems to be very tolerant or understands more...
the reason I wrote that is because obviously if there are no bosses, ie = 0 then i would get an error when dividing it by 0, so I put that 0 just to select the good ones
if count (bosses) >0
select company, postcode,
sum( bosses/staff)
from evaluation
group by company, postcode
Thank you very much
Alvarooh yes (blushed in shame as how dumb i looked like) i knew about the denominator 0 and infinite as as result i just didnt notice my zero was on the numerator :(
however, i run the query and i got this message in sql developer
Error starting at line 1 in command:
select company, postcode,
case when staff != 0 then sum( bosses/staff) end
from evaluation
group by company, postcode
Error at Command Line:2 Column:10
Error report:
SQL Error: ORA-00979: not a GROUP BY expression
00979. 00000 - "not a GROUP BY expression"
*Cause:
*Action: -
Please help me with this SQL query
I am practicing SQL queries and have come across one involving fetching data from 3 different tables.
The three tables are as below
<pre>
Country
location_id country
loc1 Spain
loc2 England
loc3 Spain
loc4 USA
loc5 Italy
loc6 USA
loc7 USA
</pre>
<pre>
User
user_id location_id
u1 loc1
u2 loc1
u3 loc2
u4 loc2
u5 loc1
u6 loc3
</pre>
<pre>
Post
post_id user_id
p1 u1
p2 u1
p3 u2
p4 u3
p5 u1
p6 u2
</pre>
I am trying to write an SQL query - for each country of users, display the average number of posts
I understand the logic behind this that we first need to group together all the locations and then the users belonging to one country and then find the average of their posts.
But, i'm having a difficulty in putting this in SQL form. Could someone please help me with this query.
Thanks.select
country.country,
count(*) Totalpostspercountry,
count(distinct post.user_id) Totaldistincuserspercountry,
count(*)/count(distinct post.user_id) Avgpostsperuserbycountry
from
country, muser, post
where country.location_id = muser.location_id
and muser.user_id = post.user_id
group by country.country
The output is like this for your sample data - hope this is what you were looking for :)
COUNTRY,TOTALPOSTSPERCOUNTRY,TOTALDISTINCUSERSPERCOUNTRY,AVGPOSTSPERUSERBYCOUNTRY
England,1,1,1,
Spain,5,2,2.5, -
Help to write following SQL query?
Hey, beginner hopes to get some help from pro's.
Please write SQL query to select only green and yellow fruits that are in stock and output results sorted by fruit name in ascending order.
Database name: warehouse
Table name: Inventory
id | Fruit | Color | stock
1 | apple | green | 5
2 | banana | yellow | 3
3 | orange | orange | 1
4 | lemon | yellow | 7
5 | pear | green
| 0
Thanks in advance!If your database and SQL server use default SQL Server collation which is case insensitive, then drop lower function from the suggested script and use
color in ('green', 'yellow')
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles -
Help with APP_USER in SQL query
Hi,
I would like to extract a user details in one Item of DML form based on the Logged user and standard authentication schema.
I have this query in the Item:
select ANALYST_FIRST_NAME ||' '|| ANALYST_LAST_NAME d, ANALYST_ID r from QTMT_ANALYST where EMAIL = :APP_USER The User in the session is equal to the EMAIL value. In fact, the value in the session is upper case and the other in the database is lower case. I believe that that is not relevant anyway.
The query do not bring any value. Could you please let me know what I have got wrong?
APEX: 4.2
Item Source Type: SQL Query (return single value)
Thank you and best regards,
VladimirTo be on the safe side you should uppercase both sides of the equation. It could be that the username is entered in lower case.
But if you think that your query is correct, test it by using a literal instead of the user name.
select ANALYST_FIRST_NAME ||' '|| ANALYST_LAST_NAME d
from QTMT_ANALYST
where upper(EMAIL) = upper(:APP_USER);for testing purposes use something like this:
select ANALYST_FIRST_NAME ||' '|| ANALYST_LAST_NAME d
from QTMT_ANALYST
where upper(EMAIL) = upper('[email protected]');Edited by: Sven W. on Oct 23, 2012 1:30 PM
APEX: 4.2
Item Source Type: SQL Query ( return single value )I just noticed that you use an item which has this as the SQL source. This works only if the sql returns one row and one column only. Therefore I removed the second column from your query.
Edited by: Sven W. on Oct 23, 2012 1:33 PM -
I have an interesting problem and wondering how I can get this result in a single SQL query:
Here is table emp has data with a row for every year since the employee joined with the salary paid that particular year with following columns:
emp (
id varchar2(10),
name varchar2(25),
interested_year date,
salarypaid number(10)
I would like to print the results as follows:
id name previousyear_salarypaid currentyear_salarypaid
x xxxxx xxxxxx xxxxx
Is this possible to do? I have tried to simplify my actual problem so I hope I have included all necessary details.Just to clarify, the columns mentioned in the results are
previousyear_salarypaid is nothing but
salarypaid where interested_year = '2007'
currentyear_salarypaid is nothing but
salarypaid where interested_year = '2006'
Maybe you are looking for
-
Creating a spread in Pages '09
Hi, I've a question that is bothering me for some time. You know when in Magazines (like National Geographic) they show an image, spread over 2 pages, next to each other? I would like to do this in Pages, but I've now idea how. Can anyone help me wit
-
Hi, is it possible to install Windows XP OEM without SP2, and after instalation upgrade it to SP2? I asking this because I have the 2002 version of XP. Thanks, Biga
-
URLs created in Click Boxes won't open in published file
Hi - I have a series of click boxes in several modules that point to URLs. The links don't work in the published module, but work fine in preview mode (both preview and preview in browser). What can cause the links to not open? I hear a click sound
-
Java Concurrent Programs classpath
We have created a number of Java concurrent programs that work fine using the AF_CLASSPATH. For one particular concurrent program, we would like to prepend the AF_CLASSPATH with a specific JAR. We can't do this prepend on a global level. Is this poss
-
NAC Guest server allow password change
hi, i see there is an option to "allow password change" or "force password change" for guest roles in the NGS. But when i created a guest account using this guest role, after webauthentication , there is no prompt to change password. Is this the in