Using a select or forumal column "urgent"
hi, i am working on a huge system and i have two tables
emp table , company table
and i am searching the employees whom meet the search criteria(salary), and i want to display for every employee his company name and his company address.
so what will be the best way to do so regarding the performance :
1. to add a formula colum that retrive the company name for each employee who meet the search critiria .
or
2. or to match the two tables.
please note that the emp table contain about 3 million record, and the company table about 250,000,000 record and the retrieved records that match the search critiria varies from ( 1 record to 50,000,000 record).
so what is the best way to perform this ( method 1 or 2) or is there another way to do so.
best regards
Hello,
Like Marilyn, I think that the option 2 is the best
http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b14048/pbr_tune.htm#sthref2219
20.4.3 Calculations
Within a report (either through summary or formula columns), ensure that most of the calculations are performed by the data source. In case of SQL queries, calculations are performed on the database rather than on the data retrieved by the report. User-defined functions and procedures stored by the database can also be included in the query select list of an Oracle Database or a JDBC query. This is more efficient than using a local function, since the calculated data is returned as part of the result set from the database.
Regards
Similar Messages
-
Hi...
I want to ask if I have a formula Column(REPORTS 6i),and I want in where condition using parameter to some condition as this example:
function CF_1Formula return Number is
S NUMBER(10);
begin
SELECT SUM(SAL) INTO S FROM EMP
WHERE DEPTNO IN (:DEPT);
RETURN(S);
end;
Where :DEPT is user parameter of char Datatype and it is value 10,20 and may be 10,30,40
and so on.
on runtime the sql will be:
SELECT SUM(SAL) INTO S FROM EMP
WHERE DEPTNO IN (10,20);
but this not work.So what is the correct way to deal with this sql stat.,
and :dept always have different values.
So PLS any ONE help me ASAPSomething like this will work (10g onwards)
SQL> ed
Wrote file afiedt.buf
1 with req as (select '&required_empnos' as empno from dual)
2 --
3 select *
4 from emp
5 where empno in
6 (select regexp_substr(empno, '[^,]+', 1, rownum)
7 from req
8* connect by rownum <= length(regexp_replace(empno, '[^,]'))+1)
SQL> /
Enter value for required_empnos: 7839,7499,7934
old 1: with req as (select '&required_empnos' as empno from dual)
new 1: with req as (select '7839,7499,7934' as empno from dual)
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
7839 KING PRESIDENT 17-NOV-81 5000 10
7934 MILLER CLERK 7782 23-JAN-82 1300 10
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
SQL> -
GROUP BY Problem When Using a SELECT for a column
I have a very complex query that has, as one column, a SELECT clause. Here is a very simplified example from EMP/DEPT to illustrate what I need.
This query works fine without the GROUP BY:
select empno,
(select dname
from dept
where e.deptno = dept.deptno)
from emp e;
How can a GROUP BY be applied to this? The following get a subquery error (not allowed in the GROUP BY).
select empno,
(select dname
from dept
where e.deptno = dept.deptno)
from emp e
group by empno,
(select dname
from dept
where e.deptno = dept.deptno)
And, of course, you can't use column numbers or aliases in the GROUP BY.
Thanks.Eric's solution is not needed in the simple join you posted
I believe he was well aware of that.Although I realize that Ben was aware of that, in the interest of completeness, I said that for the benefit of any others that may have jumped into the middle of the thread. I didn't mean for it to sound like anything other than that. Sorry for any possible mis-interpretation. -
I used to be able to select an arbitrary "column" in MS Word, but since upgrading to OS 10.9.4 and MS Word for Mac 2001 v. 14.4.3, it doesn't work anymore. Is there any way to get this handy functionality back?
http://www.microsoft.com/mac/support
http://answers.microsoft.com/en-us/mac/forum/macword?auth=1
http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macword/microsoft-wor d-for-mac-2011-will-not-open-error/ecc42616-6f49-40bb-b8f5-e21c711ea359 -
Using number datatype for date column
Hi
Is there a side effect for using "number" datatype for "date" column?
If so, what is the disadvantage?
Many thanksHi,
Ora_83 wrote:
Hi
Is there a side effect for using "number" datatype for "date" column?
If so, what is the disadvantage?Yes, there's a definite disadvantage.
Oracle provides date arithmetic and a number of functions for manipulating DATEs. None of them work with numbers.
For example,
SELECT TRUNC (order_date, 'MONTH') AS order_month
, AVG (ship_date - order_date) AS avg_delay
FROM orders
GROUP BY TRUNC (order_date, 'MONTH')
;order_month involves a DATE function; it's pretty easy to find the month that conatins order_date.
avg_delay involves date arithmetic. It's extrememly easy to find how much the time passed between order_date and ship_date.
Depending on how you code dates as numbers, doing either one of the above may be just as easy, but doing the other will be very difficult. You'll waste a lot of effort converting the NUMBERs to real DATEs whenever you need to manipulate them.
Validation can be very difficult for NUMBERs, also.
Watch this forum. It's a rare day when there's not some question about how to get around a problem caused by storing dates in a NUMBER (or VARCHAR2) column. Don't add to that. Always use DATE columns for dates. -
Tab Form LOV uses one of the other columns in that report.
Hi All.
i created a Tabular Form using the Wizard.
i want to change one of the columns in the report to be an LOV.
the LOV has a WHERE that uses one of the other columns in that report.
i tried to do something like that:
SELECT <display_value>, <return_value>
FROM <some_table>
WHERE <my_column> = #ANOTHER_COLUMN_FROM_REPORT#
it doesnt work...
anyone know how to do it?
thanks in advance
AlbertoSee
http://htmldb.oracle.com/pls/otn/f?p=18326:54:::::P54_ID:1282
Also see the discussion at
http://forums.oracle.com/forums/thread.jspa?messageID=1222153 -
How to select a specific column in a bean method?
Hey everyone,
I'm trying to select a specific column in my adf table so i can hightlight the ones i can after, with a method bean that does a match from another table. I'm using JDeveloper 12.1.2.0.0.
Here's my table at the moment (its a static list that Timo and Alejandro helped me create, thanks to them again!):
<af:table value="#{bindings.Anos1.collectionModel}" var="row"
rows="#{bindings.Anos1.rangeSize}"
emptyText="#{bindings.Anos1.viewable ? 'No data to display.' : 'Access Denied.'}"
rowBandingInterval="0" fetchSize="#{bindings.Anos1.rangeSize}"
filterModel="#{bindings.Anos1Query.queryDescriptor}"
queryListener="#{bindings.Anos1Query.processQuery}"
filterVisible="false" varStatus="vs" id="t5"
styleClass="AFStretchWidth" columnSelection="multiple"
inlineStyle="max-width:100%;" columnStretching="multiple"
columnSelectionListener="#{ControlBean.onAnoColumnSelect}"
disableColumnReordering="true"
binding="#{ControlBean.dimAnos}">
<af:column sortProperty="#{bindings.Anos1.hints.A2011.name}"
filterable="true" sortable="false"
headerText="2011"
id="c54" width="16%">
<af:outputText value="#{row.A2011}"
shortDesc="#{bindings.Anos1.hints.A2011.tooltip}"
id="ot54">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.Anos1.hints.A2011.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="#{bindings.Anos1.hints.A2012.name}"
filterable="true" sortable="false"
headerText="2012"
id="c55" width="16%">
<af:outputText value="#{row.A2012}"
shortDesc="#{bindings.Anos1.hints.A2012.tooltip}"
id="ot55">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.Anos1.hints.A2012.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="#{bindings.Anos1.hints.A2013.name}"
filterable="true" sortable="false"
headerText="2013"
id="c56" width="16%">
<af:outputText value="#{row.A2013}"
shortDesc="#{bindings.Anos1.hints.A2013.tooltip}"
id="ot56">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.Anos1.hints.A2013.format}"/>
</af:outputText>
</af:column>
</af:table>
I've deleted some of the columns because they are all equal and by doing so, you have less problems in reading it.
In my method i have a matchEm but i'm trying to select a column by using this line:
dimAnos.setColumnSelection("A2012");
dimAnos is the binding for my table Anos (Years in Portuguese). I even tried another values fro the columnSelection but i couldn't make it selected. Am i doing anything wrong?
Please help me or give me an idea of how can i do this.
Regards,
Frederico.Hi Frederico,
The method setColumnSelection is meant to set whether your table supports column selection or not. It doesn't select the column. In order to select the column, you need to set the column attribute Selected to true. So I don't know if its an option for you but you can create a binding to all the columns you have in you bean, and then call the method A2012.setSelected(true), and then add a partial target to the table to re render it and show the selected column.
Hope this helps -
How to delete the record in the table without using lead selection?
hi,
I have added the separate column "delete" to the table uielement and so for each record or row of the table the appropriate "delete" link to action will be there................the code below works when the particular row is selected through lead selection only.......
help me how to delete without using lead selection.....
DATA:
NODE_MODULE TYPE REF TO IF_WD_CONTEXT_NODE,
ELEM_MODULE TYPE REF TO IF_WD_CONTEXT_ELEMENT,
STRU_MODULE TYPE IF_V_MODULE=>ELEMENT_MODULE .
data itab TYPE TABLE OF zac_modules.
navigate from <CONTEXT> to <MODULE> via lead selection
NODE_MODULE = WD_CONTEXT->GET_CHILD_NODE( NAME = `MODULE` ).
get element via lead selection
ELEM_MODULE = NODE_MODULE->GET_ELEMENT( ).
get all declared attributes
ELEM_MODULE->GET_STATIC_ATTRIBUTES(
IMPORTING
STATIC_ATTRIBUTES = STRU_MODULE ).
NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
IMPORTING
TABLE = itab )
DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id.
CALL METHOD NODE_MODULE->BIND_TABLE
EXPORTING
NEW_ITEMS = itab
SET_INITIAL_ELEMENTS = ABAP_TRUE
INDEX =
ENDMETHOD.Hi ,
The onclick event provides you with a standard paramater "CONTEXT_ELEMENT" which has the element from which the event is triggered.
so you can declare this in the handler(if it is not there) and use it as follows.
CONTEXT_ELEMENT TYPE REF TO IF_WD_CONTEXT_ELEMENT an importing paramater.
DATA:
NODE_MODULE TYPE REF TO IF_WD_CONTEXT_NODE,
ELEM_MODULE TYPE REF TO IF_WD_CONTEXT_ELEMENT,
STRU_MODULE TYPE IF_V_MODULE=>ELEMENT_MODULE .
data itab TYPE TABLE OF zac_modules.
CONTEXT_ELEMENT->GET_STATIC_ATTRIBUTES(
IMPORTING
STATIC_ATTRIBUTES = STRU_MODULE ). "Using the context_element paramater to get the static attributes.
NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
IMPORTING
TABLE = itab ) "getting all the data.
DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id. "deleting the particular row from the table and binding it.
CALL METHOD NODE_MODULE->BIND_TABLE
EXPORTING
NEW_ITEMS = itab
* SET_INITIAL_ELEMENTS = ABAP_TRUE
* INDEX =
thanks,
Aditya. -
CS5 Advanced Query - using a variable for a column name
Hi
I have been using Dreamweaver for a few years now, mostly version 8, but have just moved to CS5 (I teach it - among lots of other thing - at what in the US would be a community college).
I have problem with a page in CS5 that worked fine in my old version 8 edition.
I am using PHP and MySQL as my server technologies
I have a CD database and have constructed a Search Page which has a Form with a Text Box (stext) for the search criteria, and 3 option buttons to select the DB column I want to search on. The option buttons are called sfield - and have values band, title, and/or year these will be passed to my display page (display.php) via GET array URL Parameters. They are passed fine.
I want to be able to enter "Pink" into the search text field, click the Band option button, and then my data displayed would inlude CDs by any band with Pink in their name i.e. Pink Floyd. If I put 1989 and click the year option button, I search for all CDs from 1989 and so on.
On my display page I created a recordset and selected my MySQL Server, DB Table, and using the simple dialogue selected band as the Filter and "contains" and the URL Parameter stext. This all works as expected. I put in a dynamic table and when I run it to test it, it will search on band only and works fine.
Its when I try to select the column to search I get a problem. I go to the advanced recordset dialogue. I have the SQL
Select * from newellcds where band like %colname%
I need to change this to add a new variable, lookfield, which will hold my column selection from the option buttons (URL parameter: sfield), so I create the TEXT variable, with band as the default and the value of $_GET['sfield'] and put it into my SQL
Select * from newellcds where lookfield like %colname% - and it doesn't work!!! I always get no return from the database.
After much experimentation, I echoed the Dreamweaver generated SQL on the screen and when I entered Pink and selected band on the search page, the Display SQL was displayed as:
Select * from newellcds where 'band' like '%Pink%'
Dreamweaver is putting single quotes round the value returned by my lookfield variable 'band' in this case. If I enter the SQL without the quotes round Band into MySQL it works, with the quotes I get no returns.
After this very long description - does anyone have an idea how to get rid of the quotes round my lookfield variable???
How do I create a search page with two values passed - the actual criteria to search for, and the field to search for it in?
Any help would be greatly appreciated.I don't have anything useful to contribute because I don't use DW to create queries, and you are not looking for help writing the query. You just want to get rid of the single quotes, which I can't help with.
But based on your description, shouldn't the query be
SELECT * FROM newellcds WHERE $sfield LIKE '%$stext%'
If not, then I am not following. -
Schedule Manager - Use of Selection Variable
Hi all,
My Question is "What is the use of Selection Variable settings in Schedule Manager screen?"
I am not asking about defining selection variable in the variants to pick up values from TVARV table. My question is how I can make use of the Selection Variable(Extras->Settings->Selection Variable) in the Schedule Manager screen.
The variable value column is ready for input in the Schedule Manager screen, is it possible to set the variant to pick up this value for the tasks in SCMA?
Any help would be greatly appreciated.
Thanks,
PrabhaHi Prabha,
After you have finished maintaining your variant, you would have to click on the "<b>Attributes</b>" button just below the title and maintain the description for your variant. Save this entry and press the back <b>green arrow</b>. Your save button would now be activated and you can save your settings now.
I hope this helps.
Do not forget to award the point please.
Regards,
Jacob -
How can i select the next column instead of next row when press enter key
I need to know how can i select the next column instead of next row when i press the enter key.By default ,when i press enter key the next row is selected and the column remain unchanged but I wants opposite that is the row should remain unchanged but column index will changed.
Thanks to all.Well, the right arrow key will already move you to the next column, so the easiest way to do this is to modify the InputMap to have the Enter key invoke the same Action as the right arrow key.
You can search the forum for my "Table Actions" (without the space) example that will show you how to do this. -
Selecting rows as columns in sql table
i have sql table like
currcode currdesc mth yr rate
SGD SINGAPORE DOLLAR 01 2013 .02
SGD SINGAPORE DOLLAR 09 2013 .02 (suppose have rates only for jan and sept )
RMB CHINESE RENMINBI 01 2013 .206
RMB CHINESE RENMINBI 02 2013 .207
For each currency rates for 12 months for every year
i want to show like (user will select the year)
currcode currdesc Jan Feb Mar Apr May Jun Jul Aug
Sept oct nov Dec
SGD SINGAPORE DOLLAR .02
.02
RMB CHINESE RENMINBI .206 .207
h2007you can use either of the below
1. Using PIVOT operator
SELECT currcode,
currdesc,
Yr,
[01] AS Jan,
[02] AS Feb,
[03] AS Mar,
[11] AS Nov,
[12] AS Dec
FROM Table t
PIVOT (MAX(rate) FOR mth IN ([01],[02],[03],[04],..,[11],[12]))p
2. using classical cross tab logic
SELECT currcode,
currdesc,
yr,
MAX(CASE WHEN mth = '01' THEN rate END) AS Jan,
MAX(CASE WHEN mth = '02' THEN rate END) AS Feb,
MAX(CASE WHEN mth = '03' THEN rate END) AS Mar,
MAX(CASE WHEN mth = '11' THEN rate END) AS Nov,
MAX(CASE WHEN mth = '12' THEN rate END) AS Dec
FROM table
GROUP BY currcode,currdesc,yr
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Thank u for helping. Your 2nd solution working great. But using Pivot table giving me 2 rows,
RMB CHINESE RENMINBI
2013 NULL
NULL NULL
0.206 NULL NULL
RMB CHINESE RENMINBI
2013 NULL
NULL NULL
NULL NULL
0.207
h2007
Do you've any additional columns you've not shown in the post above?
to change NULLs to 0 use this
SELECT currcode,
currdesc,
yr,
MAX(CASE WHEN mth = '01' THEN rate ELSE 0.00 END) AS Jan,
MAX(CASE WHEN mth = '02' THEN rate ELSE 0.00 END) AS Feb,
MAX(CASE WHEN mth = '03' THEN rate ELSE 0.00 END) AS Mar,
MAX(CASE WHEN mth = '11' THEN rate ELSE 0.00 END) AS Nov,
MAX(CASE WHEN mth = '12' THEN rate ELSE 0.00 END) AS Dec
FROM table
GROUP BY currcode,currdesc,yr
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Select row and column from header in jtable
hello i have a problem to select row and column from header in jtable..
can somebody give me an idea on how to write the program on it.Hi Vicky Liu,
Thank you for your reply. I'm sorry for not clear question.
Answer for your question:
1. First value of Open is item fiels in Dataset2 and this value only for first month (january). But for other month Open value get from Close in previous month.
* I have 2 Dataset , Dataset1 is all data for show in my report. Dataset2 is only first Open for first month
2. the picture for detail of my report
Detail for Red number:
1. tb_Open -> tb_Close in previous month but first month from item field in Dataset2
espression =FormatNumber(Code.GetOpening(Fields!month.Value,First(Fields!open.Value, "Dataset2")))
2. tb_TOTAL1 group on item_part = 1
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)))
3. tb_TOTAL2 group on item_part = 3 or item_part = 4
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) + ReportItems!tb_TOTAL1.Value )
4. tb_TOTAL3 group on item_part = 2
expression =FormatNumber(Sum(CDbl(Fields!budget.Value)) - ReportItems!tb_TOTAL2 .Value)
5. tb_Close -> calculate from tb_TOTAL3 - tb_Open
expression =FormatNumber(Code.GetClosing(ReportItems!tb_TOTAL3.Value,ReportItems!tb_Open.Value))
I want to calculate the value of tb_Open and tb_Close. I try to use custom code for calculate them. tb_close is correct but tb_Open is not correct that show value = 0 .
My custom code:
Dim Shared prev_close As Double
Dim Shared now_close As Double
Dim Shared now_open As Double
Public Function GetClosing(TOTAL3 as Double,NowOpening as Double)
now_close = TOTAL3 + NowOpening
prev_close = now_close
Return now_close
End Function
Public Function GetOpening(Month as String,NowOpen as Double)
If Month = "1" Then
now_open = NowOpen
Else
now_open = prev_close
End If
Return now_open
End Function
Thanks alot for your help!
Regards
Panda A -
Using SAP Tokens & showing extra columns to choose
I have a Crystal Report where I have a SAP token parameter to select a budget scenario to run the report based on.
My token is selecting the 3 columns I need to display inorder to select the correct scenario - AbsID, Name & FinancYear.
Budget@Select AbsID, Name,FinancYear from OBGS order by 3
When I preview in SAP my drop down box only gives me AbsID and name - which is of course a list diplaying "Main Budget" repeated for the number of financial year I have in the database.
As these Main Budgets can (and have) been created in any order, it is impossible toexpect the users to select the correct budget from the displayed data.
As there is no direct join from OBGS to OFPR on financial year, I can't work out how to either display the additional column in the choose from list, or filter my selection statement so it will only give scenarios that relate to the financial year for the period I have selected
Any sensible suggestions welomed!Hi Julie,
Remember that combo box controls in SAP can only display two values, a code and description, or in the case of report tokens the first two columns you specify in the token query. Seeing as you need the third column to distinguish between the first two sets of values a combo box is no use to you on it's own.
The following is off the top of my head and untested but what about either replacing the combo box with a CFL that shows as many columns as you need (and by nice coincidence the first column in that table is the value you want selected, AbsID), OR, created two report parameters the first displays the Financial Year and the second displays the AbsID and Name values for the selected FinYr?
Remember I'm writing this free hand so you'll need to test to make sure it's ok.
Replace Cbo with CFL
Budget@Select * From OBGS order by 3
This should display a CFL where you can add any extra columns needed from the form settings.
Two Cbo Parameters
FinYr@ SELECT F_RefDate FROM OFPR
Budget@Select AbsID, Name from OBGS WHERE FinancYear = ('FinYr@') order by 3
So you can reference one parameter name inside another to limit the results displayed by the second parameter.
One of the above or some variation should get you what you need.
Regards,
Andrew. -
Problem with 0FIGL_VC1 when use constant selection in the query
Please kindly help me. I have this problem for 2 weeks already.
When I create a query from virtual cube 0FIGL_VC1 (balance sheets / p&l statements), if I use constant selection in any of key figure, my report could not display financial statment correctly.
My report layout
Columns : key figures (including 0FIGL_VC1_CK001)
Rows: 0GLACCEXT (financial statement item) << as hierarchy
Initially, the query is processed correctly.
However, based on the requirement from my customer, I really have to use "constant selection" for some of my columns. Whenever I do so, the query display incorrectly. (Some nodes of financial statement item just disappear. (it seem like all contra item will disappear.)
Please help!If I dont use constant selection in the query, data are display correctly.
But If I use constant selection in the query, some financial statement item dont display any value
Example :
Financial statement item(Display in hier) Period1 Total Period1(Constant selection)
A 10 60
B 20 60
C 30 60
D 0 60
- Financial statement item "D" has some value.
- Financial statement item "D" is in the hierarchy,one gl account has been assigned to more than one group differentiated by debit/credit indicator.
Please help!!
Maybe you are looking for
-
I've been having this problem off and on now for awhile. My pc will just lock up and a message comes up "A program caused this to happen" Then the pc will auto restart page. The thing about it is it's doing it more and more. There's got to be somethi
-
Java script is not working while coming back to the page.
Hi Experts, I am working in jdev 11.1.1.3.0 with ADF BC. I am callling javascript in my jsff, while this javascrip is invoking file download method. this java script i am inovking from another button action, because in some case i need to invoke popu
-
Hi Guys, I am admin on this machine. I have tried regedit as suggested for the .cdda error (1402 1406 errors) with the .aif\OpenWithProgIds entry, but have had no luck 1. There is no key within this subdirectory (Get error - 'Cannot Open OpenWithProg
-
I created a hardcover book in iPhoto. Now, I want to make additional copies but wire bound instead of hardcover. Can't seem to make it happen.
-
From reading on this forum and elsewhere on line, it appears I am not alone in experiencing a FCPX crash when importing an iMovie project. I think I've tried all the suggestions I've read: repair permissions, delete preferences, ran the iMovie projec