Selecting specific column while using CAST
Hi,
I have following.
CREATE OR REPLACE TYPE t_assoc_agents_address
AS OBJECT (varcharN_AGENCY_KEY ASSOC_AGENTS.AGY_KEY%TYPE,
N_AGENCY_ADDRESS_KEY PARTYXREF.REFKEY%TYPE,
N_AGENT_KEY ASSOC_AGENTS.AGT_KEY%TYPE);
CREATE OR REPLACE TYPE nt_assoc_agents_address AS TABLE OF t_assoc_agents_address;
OPEN AGENCY_CONTACT_DATA FOR
SELECT *
FROM
Table (cast (lv_assoc_agents_add_out AS nt_assoc_agents_address));
The above work fine but if I want to select a perticular column in place of * in the SELECT clause, it gives error.
Is there any way to do this? Pls. help...
Can you post a complete example of what works fine? SQL object types do not support the %type syntax which is PL/SQL only, but object types can only be created in SQL
From the PL/SQL Reference manual
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/10_objs.htm#4139
Currently, you cannot define object types in a PL/SQL block, subprogram, or package. However, you can define them interactively in SQL*Plus using the following syntax:
You example has syntax errors and won't compile.
Also can you please supply the error that you see when it does not work fine, which might give someone a clue how to answer your question.
SQL> declare
2 l_dummy emp.empno%type;
3 begin
4 null;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> create or replace type t_dummy as object (n emp.empno%type);
2 /
Warning: Type created with compilation errors.
SQL> sho err
Errors for TYPE T_DUMMY:
LINE/COL ERROR
0/0 PL/SQL: Compilation unit analysis terminated
1/27 PLS-00201: identifier 'EMP.EMPNO' must be declared
SQL> declare
2 create or replace type t_dummy as object (n emp.empno%type);
3 begin
4 null;
5 end;
6 /
create or replace type t_dummy as object (n emp.empno%type);
ERROR at line 2:
ORA-06550: line 2, column 3:
PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
begin function package pragma procedure subtype type use
<an identifier> <a double-quoted delimited-identifier> form
current cursor
Similar Messages
-
ORA-00902: invalid datatype comile error while using CAST function
Hi everyone,
I'm getting ORA-00902: invalid datatype compilation error while using CAST function.
open ref_cursor_list for select empName from TABLE(CAST(part_t AS partnumberlist));
The partnumberlist and ref_cursor_list is declared in the Package spec as given below.
TYPE ref_cursor_list IS REF CURSOR;
TYPE partnumberlist IS TABLE OF emp.empName%TYPE;
The error points the partnumberlist as invalid datatype in TOAD because of this i'm unable to compile the package.
Any suggestion
Thanks and regards
Sathish GopalHere is my code for
package Spec
CREATE OR REPLACE PACKAGE "HISTORICAL_COMMENTZ" AS
TYPE prior_part_data_record IS RECORD (
prior_part_row_id PGM_RPLCMNT_PART.PR_PART_ROW_S_ID%TYPE,
prior_pgm_chng_s_id PGM_RPLCMNT_PART.PR_PGM_CHNG_S_ID%TYPE
TYPE parts_list IS TABLE OF prior_part_data_record;
--TYPE parts_list IS TABLE OF NUMBER;
TYPE partnumberlist IS TABLE OF PGM_RPLCMNT_PART.PR_PART_ROW_S_ID%TYPE;
TYPE partnumber_cursor IS REF CURSOR;
TYPE comment_record IS RECORD (
pgm_s_id PGM_PART_CMNT.PGM_S_ID%TYPE,
part_row_s_id PGM_PART_CMNT.PART_ROW_S_ID%TYPE,
pgm_chng_s_id PGM_PART_CMNT.PGM_CHNG_S_ID%TYPE,
cmnt_txt PGM_PART_CMNT.CMNT_TXT%TYPE,
cmnt_dt PGM_PART_CMNT.CMNT_DT%TYPE,
updt_rsrc_id PGM_PART_CMNT.UPDT_RSRC_ID%TYPE
TYPE comment_list IS TABLE OF comment_record;
global_pgm_s_id INTEGER := 0;
global_part_row_s_id INTEGER := 0;
err_num NUMBER := 999999;
err_msg VARCHAR2 (250);
PROCEDURE getComments (
pgm_s_id IN NUMBER,
part_row_s_id IN NUMBER,
partnumber_cursorlist out partnumber_cursor);
END;
Package Body
CREATE OR REPLACE PACKAGE BODY HISTORICAL_COMMENTZ
AS
FUNCTION getPriorPart
(param_prior_pgm_chng_s_id IN PGM_RPLCMNT_PART.PR_PGM_CHNG_S_ID%TYPE,
return_prior_part_data_record IN OUT prior_part_data_record
RETURN INTEGER
IS
retVal INTEGER;
prior_part_row_id INTEGER;
prior_pgm_chng_s_id INTEGER;
local_prior_part_data_record prior_part_data_record;
BEGIN
SELECT PR_PART_ROW_S_ID AS prior_part_row_id, PR_PGM_CHNG_S_ID AS prior_pgm_chng_s_id
INTO local_prior_part_data_record
--SELECT PR_PART_ROW_S_ID INTO retVal
FROM PGM_RPLCMNT_PART
WHERE PGM_S_ID = global_pgm_s_id AND CUR_PGM_CHNG_S_ID = param_prior_pgm_chng_s_id;
return_prior_part_data_record := local_prior_part_data_record;
retVal := 0;
RETURN retVal;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
err_num := SQLCODE;
err_msg := 'SQL Error ' || SUBSTR (SQLERRM, 1, 250);
DBMS_OUTPUT.put_line ('SQLERROR = ' || err_msg);
retVal := -1;
RETURN retVal;
WHEN OTHERS
THEN
err_num := SQLCODE;
err_msg := 'SQL Error ' || SUBSTR (SQLERRM, 1, 250);
DBMS_OUTPUT.put_line ('SQLERROR = ' || err_msg);
retVal := -1;
RETURN retVal;
END getPriorPart;
FUNCTION getComment (found_parts_list IN parts_list, comments OUT comment_list)
RETURN INTEGER
IS
CURSOR init_cursor
IS
SELECT PGM_S_ID,PART_ROW_S_ID,PGM_CHNG_S_ID,CMNT_TXT,CMNT_DT,UPDT_RSRC_ID
FROM PGM_PART_CMNT WHERE 1 = 2;
retVal INTEGER;
indexNum PLS_INTEGER;
local_part_record prior_part_data_record;
local_comment_record comment_record;
local_part_row_s_id NUMBER;
i PLS_INTEGER;
BEGIN
OPEN init_cursor;
FETCH init_cursor
BULK COLLECT INTO comments;
i := 0;
indexNum := found_parts_list.FIRST;
WHILE indexNum IS NOT NULL
LOOP
local_part_record := found_parts_list(indexnum);
local_part_row_s_id := local_part_record.prior_part_row_id;
SELECT PGM_S_ID,PART_ROW_S_ID,PGM_CHNG_S_ID,CMNT_TXT,CMNT_DT,UPDT_RSRC_ID
INTO local_comment_record FROM PGM_PART_CMNT
WHERE PGM_S_ID = global_pgm_s_id
AND PART_ROW_S_ID = local_part_row_s_id;
comments(i) := local_comment_record;
i := i + 1;
END LOOP;
RETURN retval;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
err_num := SQLCODE;
err_msg := 'SQL Error ' || SUBSTR (SQLERRM, 1, 250);
DBMS_OUTPUT.put_line ('SQLERROR = ' || err_msg);
RETURN retval;
WHEN OTHERS
THEN
err_num := SQLCODE;
err_msg := 'SQL Error ' || SUBSTR (SQLERRM, 1, 250);
DBMS_OUTPUT.put_line ('SQLERROR = ' || err_msg);
RETURN retval;
END getComment;
PROCEDURE getComments
pgm_s_id IN NUMBER,
part_row_s_id IN NUMBER,
partnumber_cursorlist OUT partnumber_cursor)
IS
comment_recordlist comment_record;
retPartnumberlist partnumberlist;
found_parts_list parts_list;
local_part_record prior_part_data_record;
is_more_parts BOOLEAN;
driver_chng_s_id NUMBER;
num_parts NUMBER;
retVal NUMBER;
comments comment_list;
returnPartnumberlist partnumberlist;
iloopCounter PLS_INTEGER;
inx1 PLS_INTEGER;
part_t partnumberlist :=partnumberlist(100,200,300);
CURSOR part_list_init_cursor
IS
SELECT PR_PART_ROW_S_ID,PR_PGM_CHNG_S_ID FROM PGM_RPLCMNT_PART WHERE 1 = 2;
CURSOR inIt_cursor
IS
SELECT 0 FROM DUAL WHERE 1 = 2;
BEGIN
DBMS_OUTPUT.ENABLE (5000000);
global_pgm_s_id := pgm_s_id;
global_part_row_s_id := part_row_s_id;
SELECT PART_ROW_S_ID AS prior_part_row_id, PR_PGM_CHNG_S_ID AS prior_pgm_chng_s_id
INTO local_part_record
FROM PGM_RPLCMNT_PART
WHERE PGM_S_ID = global_pgm_s_id AND PART_ROW_S_ID = global_part_row_s_id AND
CUR_PGM_CHNG_S_ID IN (SELECT MAX(CUR_PGM_CHNG_S_ID) FROM PGM_RPLCMNT_PART WHERE
PGM_S_ID = global_pgm_s_id AND PART_ROW_S_ID = global_part_row_s_id
GROUP BY PART_ROW_S_ID);
OPEN part_list_init_cursor;
FETCH part_list_init_cursor
BULK COLLECT INTO found_parts_list;
-- Add the existing part to the found list
found_parts_list.EXTEND;
found_parts_list(1) := local_part_record;
driver_chng_s_id := local_part_record.prior_pgm_chng_s_id;
num_parts := 1;
is_more_parts := TRUE;
WHILE (is_more_parts) LOOP
retVal := getPriorPart(driver_chng_s_id,local_part_record);
IF (retVal != -1) THEN
found_parts_list.EXTEND;
num_parts := num_parts + 1;
found_parts_list(num_parts) := local_part_record;
driver_chng_s_id := local_part_record.prior_pgm_chng_s_id;
ELSE
is_more_parts := FALSE;
END IF;
END LOOP;
--num_parts := getComment(found_parts_list,comments);
OPEN init_cursor;
FETCH init_cursor
BULK COLLECT INTO returnPartnumberlist;
num_parts := found_parts_list.COUNT;
FOR iloopCounter IN 1 .. num_parts
LOOP
returnPartnumberlist.EXTEND;
returnPartnumberlist(iloopCounter) := found_parts_list(iloopCounter).prior_part_row_id;
END LOOP;
retPartnumberlist := returnPartnumberlist;
open
* partnumber_cursorlist for select PR_PART_ROW_S_ID from TABLE(CAST(retPartnumberlist AS historical_commentz.partnumberlist));*
DBMS_OUTPUT.put_line('Done....!');
EXCEPTION
some code..............................
END getComments;
END HISTORICAL_COMMENTZ;
/ -
Select specific folder while install DP for SCCM 2012 R2
Hi All,
I have two Question:
1- Is there any option to select specific folder like "C:\Windows\DP Packages\" to include all folders for Distribution Point (SCCMContentLib.....) -- Can we use Hidden folder?
2- Can we Limit Distribution point to Use only specific storage Like 50 GB from disk?
Thanks.1) Out of the box No. The contentlibrary will be created in the root of the drive by default
2) When creating the DP you can configure "Drive Space reserve" available before another drive is selected.
Kent Agerlund | My blogs: blog.coretech.dk and
SCUG.DK | Twitter: @Agerlund | Linkedin:
Kent Agerlund | Author:
Mastering System Center 2012 R2 The Fundamentals -
Want to sort the columns while using GROUP BY ROLLUP.
Want to order the below query using by "News' column in descending order and "Email address" column in Ascending order.
Note: Sorting should not bring Total value to top. It is happening now.
{code}
SELECT decode(grouping(NVL(Client, 'NA')),1, 'Totals', NVL(Client, 'NA')) "Email (Login ID)",
Location "Location",
SUM(News) "News",
SUM(Website) "Website",
FROM VW_FX_USERDATA
GROUP BY ROLLUP (((NVL(Client, 'NA')),Location,1, 'Totals', NVL(Client, 'NA')))
{code}
PLease let me know if you need any details.
Edited by: Nagaraja Akkivalli on Sep 23, 2011 4:04 PMThanks hm,
Let me explain bit clearly.
Say I am getting resultset as below.When I am executing above mentioned query.
Client* Location News Website Total
ABC YD 9 0 4
BCD HB 12 7 13
CDE SI 1 18 3
JNM BI 25 0 4
ZZZ TI 0 221 77
XYZ TT 0 1 1
Totals 47 247 435I want it to as below. Here records are sorted in the descending order of the News Count and then Client*
Client* Location News Website Total
JNM BI 25 0 4
BCD HB 12 7 13
ABC YD 9 0 4
CDE SI 1 18 3
XYZ TT 0 1 1
ZZZ TI 0 221 77
Totals 47 247 435If I order the column by News in the descending order, it is taking Totals value to the top. (Since I am using GROUP BY ROLLUP).
Note: Sorting should not be applied to Totals.
Hope this is clear to you. Let me know if you need any details.
Thanks and Regards
Nagaraja Akkivalli. -
Linq selecting multiple columns when using anonymous types using Sum multiple columns
I have a list with multiple columns where I need to sum a list of columns for each row into a new column (not 100% sure if there is another way to sum other than I have done it). Problem I'm having is being able to select more than just column I'm creating
used from summing the other column and the Key. Below will produce a row with the CustomerId and the total of all the months.
CustomerId
Total
12345
2500.00
12346
3000.00
But let's say I have a row called Name in "history"--how can display it in the query results as below. I'm unable to reference anything but the key.
CustomerId
Total
Name
12345
2500.00
John Smith
12346
3000.00
May Allen
var list = history
.GroupBy(g => g.CustomerId)
.Select(sg =>
new
Key = lg.Key,
SumTotal = sg.Sum(x => x.month_01)
+ sg.Sum(x => x.month_02)
+ sg.Sum(x => x.month_03)
+ sg.Sum(x => x.month_04)
+ sg.Sum(x => x.month_05)
+ sg.Sum(x => x.month_06)
+ sg.Sum(x => x.month_07)
+ sg.Sum(x => x.month_08)
+ sg.Sum(x => x.month_09)
+ sg.Sum(x => x.month_10)
+ sg.Sum(x => x.month_11)
+ sg.Sum(x => x.month_12)Hi
ajl7519,
I have tested on my side, please check my code.
InitializeComponent();
AuctionItems = new List<AuctionItem>() {
new AuctionItem() { Category = "Car", CurrentPrice = "100", Description = "100", SpecialFeatures = "100", StartDate = 1, StartPrice = 1 },
new AuctionItem() { Category = "Car", CurrentPrice = "100", Description = "100", SpecialFeatures = "100", StartDate = 2, StartPrice = 2 },
new AuctionItem() { Category = "Car", CurrentPrice = "100", Description = "100", SpecialFeatures = "100", StartDate = 3, StartPrice = 3 }
var resu = AuctionItems.GroupBy(a => new { a.Category, a.Description }).Select(sg => new { ID = sg.Key.Category, Total = sg.Sum(oc => oc.StartPrice + oc.StartDate), Name = sg.Key.Description });
You also can change your code to
• SumTotal = sg.Sum(x => x.month_01+x.month_02+ ......)
Have a nice day !
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
How to sort specific column when using GROUPING SETS in SQL Server?
If I remember correctly, in SQL Server, it is not recommended to use "ORDER BY" when there's already a GROUP BY GROUPING SETS.
I have two columns: [UPC#] & [Description] both are varchar.
My grouping sets is like this:
GROUP BY
GROUPING SETS
([UPC],[Description])
I don't have 'ORDER BY' but it's automatically sorting the Description column.
If I added a 3rd column, sum(Qty), then it doesn't sort by Description anymore. But if I added
ORDER BY [Description]
then the grand total of sum(Qty) will be at the first row instead of the last.
Is there a way to sort the Description column and still let the grand total of sum(Qty) be at the last row instead?
Thanks.Yes, it works.
Thank you.
Could you kindly explain the logic?
I don't quite understand the "= 3 THEN 1 ELSE 0" part.
Is the #3 mean the column index 3?
GROUPING_ID returns a bit mask value depending on number of columns grouped in the result
So when you do GROUPING_ID(([UPC]),([Description]))
it has two columns UPC and Description so bit mask will be as follows
0 ie 00 for rows grouped by both UPC and Description fields
1 ie 01 for rows grouped by UPC ie UPC subtotals
2 ie 10 for rows grouped by Description ie Description subtotals
3 ie 11 for rows not grouped by both columns ie Grand total
see
http://msdn.microsoft.com/en-IN/library/bb510624.aspx
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
REgarding view selection in mm02 while using bdc
hi,
i m using function module 'MATERIAL_BTCI_SELECTION_NEW'' for selecting the single view automatically in bdc,its working fine..but for another scenario i have to select the multiple views so for this what sud i do i how cud i pass multiple views in single parameter 'selection'.
plz help me.
thnx in advance.We had to make a BDC recently for multiple views. For most of them we used BAPI_MATERIAL_SAVEDATA, but there are some views which are not available (Accounting 2 for example).
For others there are some other BAPIs, as BAPI_MATINSPCTRL_SAVEREPLICA for Quality Management, or BAPI_OBJCL_CHANGE fo Classification.
Anyway, for those views that need to be filled using BDC, the better way we have seen is to select at the beginning of BDC the Basic Data 1 view (which is always at the top of the list and is not dependent of the views that are available for a particular material) and then navigate between views with the following OK_CODEs:
Basic data 1 = SP01
Basic data 2 = SP02
External Objects = SP03
Classification = SP04
Sales: Sales Org. Data 1 = SP05
Sales: Sales Org. Data 2 = SP06
Sales: General/Plant Data = SP07
Foreign Trade: Export Data = SP08
Sales and Distribution Text = SP09
Purchasing = SP10
Foreign Trade: Import Data = SP11
Purchase order text = SP12
MRP 1 = SP13
MRP 2 = SP14
MRP 3 = SP15
MRP 4 = SP16
Forecast = SP17
Work scheduling = SP18
Production resources and tools = SP19
General Plant Data / Storage 1 = SP20
General Plant Data / Storage 2 = SP21
Warehouse Management 1 = SP22
Warehouse Management 2 = SP23
Quality Management = SP24
Accounting 1 = SP25
Accounting 2 = SP26
Cost Estimate 1 = SP27
Costing 2 = SP28
Plant stock = SP29
Storage location stock = SP30 -
Selection Failure error while using SUM expression - 11g
Hi,
I am using following expression to calculate SUM of child node values. It works in 10G, but errors our in 11g.
Anyone has any workaround?
Expression:
<copy>
<from expression="sum(bpws:getVariableData('Invoke_ebs_get_order_data_ebs_get_order_dataSelect_OutputVariable','XwCoiwsOrderHeadersVCollection','/ns4:XwCoiwsOrderHeadersVCollection/ns4:XwCoiwsOrderHeadersV/ns4:xwCoiwsOrderLinesVCollection/ns4:XwCoiwsOrderLinesV/ns4:orderedQuantity'))"/>
<to variable="p_total_ordered_qty"/>
</copy>
Error Message:
com.oracle.bpel.client.BPELFault: faultName: {{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure}
Thanks,
Naveen
Edited by: Leon Z on Feb 9, 2010 2:21 AMGaurav,
It didn't work.
No Compilation error but failed while executing in EM.
Invalid XPath expression. an error occurs while parsing XPath expression sum('Invoke_ebs_get_order_data_ebs_get_order_dataSelect_OutputVariable','XwCoiwsOrderHeadersVCollection','/ns4:XwCoiwsOrderHeadersVCollection/ns4:XwCoiwsOrderHeadersV/ns4:xwCoiwsOrderLinesVCollection/ns4:XwCoiwsOrderLinesV/ns4:orderedQuantity'). The XPath expression was invalid; the reason was: Parse Error in sum function.. Check the detailed root cause described in the exception message text and verify that the XPath expression named in the error message is correct. The XPath expression is defined in the BPEL process. } -
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 -
What is the difference betwwen SELECT ALL Column and Select Speceific Colum
Hi All,
If the block size of the database is 8K and average row length is 2K and if we select all column of the table the I/O show that it had read more blocks then compare to
specific column of the same table. Why is this?
Secondly if Oracle brings a complete block is the db buffer cache, while reading block from disk, they why there is a difference of block count in two queries.
This difference reveals to me when I check the EXPLAIN PLAN for two different queries against the same table but one select all columns and the other one select specific column.
Kindly help me in clearing this confusion.
Regards,
Kamranuser1514587 wrote:
>
Usually, indexes are smaller (contain fewer blocks) than the table - ergo, select empno from emp could be satisfied by reading fewer blocks.
what if there is a composite Index on a table containing 3 to 4 columns and the size of table is in 100 of GB and Index size itself is vey large then I think Oracle will go for FTS and small Index scan will be expensive. Kindly Share your thoughts.
Regards,
KamranHandle: user1514587
Status Level: Newbie (5)
Registered: May 9, 2011
Total Posts: 21
Total Questions: 13 (12 unresolved)
I think you wastes everyone's time here since you rarely get answer to any posted question -
Select * v/s select specific in oracle
Dear Friends please proivde your valuable opinions:
how does oracle behaves internally in case when all records are selected (select * from X) and in case when few records ( select A, B from X) selected.
I had a discussion with my DBA DBA says even if you select specific column oracle internally selects the whole row (all columns) and then selects specific columns out of it.
Being an application developer I believe that specific column selection is fast and oracle should not be selecting all columns internally.
Arpit BansalAside from the fact that selecting a particular column list is a heck of a lot safer, since it doesn't break when new columns are added to a table, selecting a subset of the columns may be more efficient, particularly if it reduces the amount of data that needs to be sorted or hashed or if it allows all the data to be fetched from an index. If Oracle has to read data from the table itself, it will generally have to read the entire row into the buffer cache (overflow segments in an IOT being the biggest exception I can think of).
Justin
Added clarification about queries that can be satisfied exclusively via indexes.
Message was edited by:
Justin Cave -
How can i select other column values('-' separated) in group by function
CREATE TABLE EMP (
EMPNO NUMBER(4) NOT NULL,
ENAME VARCHAR2(10),
JOB VARCHAR2(9),
SAL NUMBER(7)
INSERT INTO EMP(EMPNO, ENAME, JOB, SAL) VALUES (7369, 'SMITH', 'CLERK', 800);
INSERT INTO EMP(EMPNO, ENAME, JOB, SAL) VALUES (7499, 'SMITH', 'SALESMAN', 1600);
INSERT INTO EMP(EMPNO, ENAME, JOB, SAL) VALUES (7521, 'ALLEN', 'SALESMAN', 2400);
In Output I want 3 columns : EMP,SUM(SAL),JOB(hyphenSeparated)
Means i want my output like
First row : SMITH,2400,CLERK-SALESMAN
Second row : ALLEN,2400,SALESMAN
I tried to write following sql : select ename,sum(sal) from emp group by ename
But i want other colummn value in '-' separated. but group by is only allowing agreegated function.
How can i select other column value using group by function.SQL> select ename,sum(sal), listagg(job, '-') within group (order by job) as job from emp group by ename;
ENAME SUM(SAL) JOB
ALLEN 2400 SALESMAN
SMITH 2400 CLERK-SALESMANnote: LISTAGG is a feature of 11.2 -
Layers while using mobile app?
If a pdf has layers is it possible to view and select/deselect them while using the mobile app?
Hi,
Currently, it is not possible to turn on or off each layer in the Adobe Reader mobile apps (for iOS, Android, Windows Phone). I am not aware of any other third-party mobile apps that support layers in PDF documents.
I'd recommend using the desktop version of Adobe Reader on a Mac or Windows computer to view PDF documents with layers. Sorry for the inconvenience. -
Is there a way to select a specific playback device while using itunes 11 on Windows 7?
Is there a way to select a specific playback device while using itunes 11 on Windows 7? I was trying to select a device, is there such an option in itunes as there is in VLC player and Windows Media Player. If not, any idea when this feature will becoem available? Thanks!
iTunes supports multiple Airplay devices that can be selected. If the device does not support Airplay then the manufacture of the device would need to support it for iTunes.
-
Using VPD/FGA to null specific columns for all but some users
I've been reading up on VPD and - though there a numerous examples - I'm having a tough time putting them together.
I have a table that - when most users select against - they should be getting NULL back in a specific column.
That column should only display for a select group of users as a value of other than null.
Can anyone help me out with an example of implementing this?
Any/all help is appreciated.An extract from http://www.oracle-base.com/articles/10g/DatabaseSecurityEnhancements10g.php
CONN sys/password@db10g AS SYSDBA
GRANT EXECUTE ON dbms_rls TO scott;
CONN scott/tiger@db10g
-- Create the policy function to restrict access to SAL and COMM columns
-- if the employee is not part of the department 20.
CREATE OR REPLACE FUNCTION pf_job (oowner IN VARCHAR2, ojname IN VARCHAR2)
RETURN VARCHAR2 AS
con VARCHAR2 (200);
BEGIN
con := 'deptno = 20';
RETURN (con);
END pf_job;
-- Using the same policy function as before.
BEGIN
DBMS_RLS.ADD_POLICY (object_schema => 'scott',
object_name => 'emp',
policy_name => 'sp_job',
function_schema => 'scott',
policy_function => 'pf_job',
sec_relevant_cols => 'sal,comm',
sec_relevant_cols_opt => DBMS_RLS.ALL_ROWS);
END;
-- All rows are returned but the SAL and COMM values are only
-- shown for employees in department 20.
SELECT empno, ename, job, sal, comm FROM emp;
EMPNO ENAME JOB SAL COMM
7369 SMITH CLERK 10000
7499 ALLEN SALESMAN
7521 WARD SALESMAN
7566 JONES MANAGER 2975
7654 MARTIN SALESMAN
7698 BLAKE MANAGER
7782 CLARK MANAGER
7788 SCOTT ANALYST 3000
7839 KING PRESIDENT
7844 TURNER SALESMAN
7876 ADAMS CLERK 1100
EMPNO ENAME JOB SAL COMM
7900 JAMES CLERK
7902 FORD ANALYST 3000
7934 MILLER CLERK
14 rows selected.
-- Remove the policy function from the table.
BEGIN
DBMS_RLS.DROP_POLICY (object_schema => 'scott',
object_name => 'emp',
policy_name => 'sp_job');
END;
/The function returns "deptno=20" so any row matching this condition will display the sal and comm value , rest will display null.
IN your case I guess you check for the user in the function who is executing the query (select user from dual), once you get the user see if this is a user who is suppose to see the columns values if yes return "1=1" otherwise return "0=1".
Maybe you are looking for
-
Sharing between two accounts on the same Windows Vista PC
Is it possible to home share between two different accounts on the same computer? On my son's account, iTunes for some reason won't connect to the iTunes Store. So I would like to enable him to purchase stuff on my account and then use home share to
-
i am traveling and do not have access to itunes. how can i get my ipad 'unstuck' on screen showing need to connect to itunes??
-
Can you move songs in iTunes?
Thanks.
-
<blockquote>Locking duplicate thread.<br> Please continue here: [[/questions/912921]]</blockquote> Helping a friend with older computer. Windows based. Used IE to find Firefox website. Hit download button. Chose to run. About two minutes later receiv
-
Cannot change time in clip adjustment
I am having a problem altering the length of clips. I have a set of photos and want each still to be 0.3s. I change the first clip to 0.3s and check "apply to all stills". Some are 0.3s, but others change to 1.3s, 1.1s or 0.1s. When I try to correct