PL/SQL :: Column Wise Data Store

Feb 18, 2013

how to tune qurey for coulumn wise data saved.because we have to join same table n number of times.for reference go through the following scnarios.
     
Suppose one table T1 is there and it has two column KEY and VALUE.if we are writing qurey for retriving desire result in row manner we have to join samae table no of times.

KEY Value
     agreesWith true
id 1
     assessment False
     basisForDateOfProgression 1
     bestOverallResponse 2
     bestOverallUnknownComments data is ok

Qurey:

select * from (
select t.agreesWith from t1 t
)a

[Code]...

In this manner we can join upto bestOverallUnknownComments .so which method we follow to reduce the execution time and performance should be good.

View 1 Replies


ADVERTISEMENT

SQL & PL/SQL :: Data In Column-wise?

Jul 22, 2013

For one of our requirement, we are asked to provided data in below manner.

Deptno Deptname emp_name_1 hire_date_1 emp_name_2 hire_date_2
10 Sales Raghu 25-Jan-2007 Abbhilash 29-Mar-2009

If a particular department has 10 employees it should have data upto emp_name_10,if department has only 5 employess it should data upto emp_name_5 and so on.I came up with below approach, in this approach I need to create new table to store the data in row wise.

In my actual requirement 4 tables needs to be joined and 2 of the tables are very large.Is there any other approach without creating a new table, something within pl/sql.

drop table emp_dept;
create table emp_dept(deptno number,dept_name varchar2(100),emp_name varchar2(100),hire_date date,seq_cnt number,total_cnt number);
insert into emp_dept

[code]...

View 21 Replies View Related

SQL & PL/SQL :: Row Value Show In Column Wise

Mar 1, 2012

I have a table which have three column.

1) empid
2) date
3) status

I want to show the value empid intime outime.

select in1.empid,in1.atttime,out.atttime from (select empid ,atttime from attend
where status=1 and to_char(atttime,'mmyyyy')='022012' order by empid,atttime desc) in1,
(select empid,atttime from attend where status =0 and to_char(atttime,'mmyyyy')='022012'
order by empid,atttime desc) out
where in1.empid=out.empid and in1.empid='02256'
order by in1.atttime,out.atttime

But this query do .one value relation with all column.means first february in time with all out time.

View 1 Replies View Related

PL/SQL :: Display Top 3 Sales Column Wise

Dec 21, 2012

I have two tables as below

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

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

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

View 5 Replies View Related

SQL & PL/SQL :: How To Get Month Wise Data

Sep 11, 2012

I have data something like this.

Employee_id date_loggedin

123 09/10/2012
134 09/03/2012
111 09/02/2012
123 08/27/2012
134 08/01/2012
123 07/06/2012
111 05/11/2012
123 07/04/2012
123 07/03/2012
123 03/15/2012
123 01/11/2012

The desired output for input of employee_id=123 and dates between 01/01/2012 and 09/30/2012

Month login_count
JAN_2012 1
FEB_2012 0
MAR_2012 1
APR_2012 0
MAY_2012 0
JUN_2012 0
JUL_2012 3
AUG_2012 1
SEP_2012 1

View 2 Replies View Related

SQL & PL/SQL :: Get The Data On Order By Wise

Nov 15, 2011

i am getting the data like bellow i need the data with out null values

date col1col2col3col4
16-Nov-1123
17-Nov-1112
18-Nov-11321
19-Nov-1123
20-Nov-11132
16-Nov-112321
17-Nov-11112
18-Nov-11211
19-Nov-11132
20-Nov-1112
16-Nov-1145
17-Nov-11465
18-Nov-112123
19-Nov-11132
20-Nov-1165
16-Nov-11456
17-Nov-11546
18-Nov-114656
19-Nov-11566
20-Nov-11564

need out like below

date col1col2col3col4
16-Nov-1123232145456
17-Nov-1112112465546
18-Nov-1132121121234656
19-Nov-1123132132566
20-Nov-111321265564

View 3 Replies View Related

SQL & PL/SQL :: How To Store Images In Table Column

Dec 21, 2011

How to store images in table column. I have table called emp with datatype empno,name,photo_id(long raw)
.
i want to store image in table for each record.

View 3 Replies View Related

SQL & PL/SQL :: Page Wise Display Of Data?

Nov 11, 2010

Web page that retrives data from SQL database and display it to the user in well formatted manner. Data retrieved depend upon criterias selected by the user. But sometimes data retrieved is very large. I want to display records to the user page wise, i.e. 100 records on first page and next 100 records displayed when user clicks next button. This means only 100 records should be retrieved when user first select search criteria, next 100 records retrived when he clicks next button and so on, as to reduce data transferred from server to client. how to achieve this by using single sql query as soon as possible.

View 10 Replies View Related

PL/SQL :: How To Store PDF In BLOB Column Then Select / Search It Using SQL

Jul 19, 2012

(1.) We have an Oracle 10g DB.

(2.) We want to store PDFs/MS Word docs inside BLOB column in a table.

(3.) We need to show PDF/MS Word content to the user, without opening the PDFs/MS World like we normally do (i.e. Using PDV reader/ MS Word).

(4.) i.e. We need to use SQL statements and

(a.) Get all contents of the PDF/MS WORD doc.

(b.) Search for specific strings inside these docs in the BLOB columns.

View 6 Replies View Related

Forms :: Page Wise Displaying Data

Apr 24, 2010

i want displaying the query data page wise.

i want place 4 buttons

1 for 1st page, 2nd for next page, 3rd nxt page and 4th for last page.

how can i do this through programming in oracle forms 10g.

give me the entire process of doing this.

i am waiting for your response.

View 9 Replies View Related

Store Data In CLOD Data Type - How To Create A Unique Index

May 20, 2013

We have been recommended to store data in CLOD data type.

Sample data: 1:2:2000000:20000:4455:000099:444:099999:....etc it will grow to a large number.

We want to create a Unique index, for functional reason. Is it advised to create a unique index on a CLOB datatype?

View 2 Replies View Related

Forms :: How To Store Word / Excel Documents To BLOB Column

Mar 29, 2011

My client system is WinXP.I want to store a Word/Excel document to Oracle Blob column and choosed the command named "piecewise.exe",it seems a free tool on the web, to store the document to oracle,but occausionally failed.So I need alternative which is stable and available.

View 1 Replies View Related

XML DB :: Find Size Of Table With XML Type Column Store As Binary XML

Dec 21, 2012

I have a table with structure as:

CREATE TABLE XML_TABLE_1
(
ID NUMBER NOT NULL,
SOURCE VARCHAR2(255 CHAR) NOT NULL,
XML_TEXT SYS.XMLTYPE,
CREATION_DATE TIMESTAMP(6) NOT NULL
[code].....

- So HOW do I find the total size occupied by this table. Does BINARY storage work as LOB storage. i.e. I need to consider USER_LOBS as well for this. OR foll. will work

select segment_name as tablename, sum(bytes/ (1024 * 1024 * 1024 )) as tablesize_in_GB
From dba_segments
where segment_name = 'XML_TABLE_1'
and OWNER = 'SCHEMANAME'
group by segment_name ;

- Also if I am copying it to another table of same structure as:

Insert /*+ append */ into XML_TABLE_2 Select * from XML_TABLE_1.

Then how much space in ROllbackSegment do I need. Is it equal to the size of the table XML_TABLE_1?

View 2 Replies View Related

SQL & PL/SQL :: Script Store Data?

Feb 10, 2013

My requirement is to get primary key column name and there values of a table and store in a stage table

create table easy(id integer, event_rowid integer,txn_rowid integer,txn_name varchar2(200));

begin
for i in 1..5 loop
insert into easy values(i,'777'||i,i||89,'Ris'||i||i);

[code]...

I was able to fetch primary keys and there values for a table and store them in stage table but only 1 record , I am stuck when there are more than 1 record Here is what i tried

SQL> SET serveroutput ON
SQL> DECLARE
2 V_prim_key VARCHAR2(2000);
3 l_tab DBMS_UTILITY.uncl_array;

[code]...

If you look at the above code in the execute immediate where condition i have used id=1, which is 1 records only but if i change id <3 then there will be 2 records and i will get below error ORA-01422: exact fetch returns more than requested number of rows

Other problem if there are 3 primary keys as in above case i am fetching there values 1 by 1 , is there any way if i can fetch those values once in for all data to be stored in stage table in below format

TAB_NAME V_PEIM_KEY V_PRIM_DATA DT
------- --------- ------- ------
EASY TXN_NAME,EVENT_ROWID,ID Ris11,7771,1 10-Feb-13
EASY TXN_NAME,EVENT_ROWID,ID Ris22,7772,2 10-Feb-13

View 5 Replies View Related

PL/SQL :: Store XML Data In Tables

Jul 21, 2012

I Have to write a procedure which takes XML data and inserts into some tables.

If the XML format is fixed then i can use extract function for parsing and can insert into the tables.

But the problem is there is not fixed format for the xml.

Are there any built in packages which takes the xml data for parsing..

View 3 Replies View Related

To Store Data In Materialized View

Apr 14, 2011

I have a PL/SQL procedure which gathers data from multiple places as well as calculates some data. I want to store all this in a materialized view.

So, I created an object type (I've shortened the definitions):

CREATE OR REPLACE TYPE mf_record_type AS OBJECT
(identifier VARCHAR2(6),
name VARCHAR2(100));

Then created the table type of the object:

CREATE OR REPLACE TYPE mf_table_type IS TABLE OF mf_record_type;

Then in the stored procedure defined a variable of the table type:

v_mf_record mf_table_type := mf_table_type();

Then I loop and populate the record type:

v_mf_record.EXTEND(1);
v_mf_record(x) := mf_record_type(v_rec.identifier, v_mf_detail.name);

When all that is done I try and create the materialized view:

EXECUTE IMMEDIATE ('CREATE MATERIALIZED VIEW mf_snapshot_mv AS
SELECT * FROM TABLE (CAST (v_mf_record AS mf_table_type))');

ORA-00904: "V_MF_RECORD": invalid identifier

Am I doing something wrong here? Can't I create the materialized view based on something other than a physical table?

View 4 Replies View Related

SQL & PL/SQL :: Store Large XML Data In Blob?

May 8, 2010

Since XML-files only contain character data, we could/should store it in a CLOB, rather than a BLOB.

But, One of my friend having a table where a column is defined as bloband came to know that XML data are being stored. I searched for some article with keyword 'How to insert large XML data in BLOB' But did not work.How to store the large xml content in a Blob and How to extract it?

View 2 Replies View Related

SQL & PL/SQL :: Splitting Data And Store Into Columns?

Feb 28, 2013

I have string like 'PRASAD,ALLEN,STEWART,SMITH'.

LIKE
COL1 COL2 COL3 COL4
-------------------------------
PRASAD ALLEN STEWART SMITH

I want to store the data into columns using SELECT statement only

View 7 Replies View Related

SQL & PL/SQL :: Store Procedure To Truncate And Copy Data

Jan 27, 2012

I am very new to oracle and SQL.I am trying to create a store proc that will copy 14 day of data into a table and then truncate the original table. When i compile following code....

CREATE OR REPLACE PROCEDURE STOPROC_TRUNCATE
( dateNum IN NUMBER )
IS
BEGIN
create table AUDIT_14Days as select * from AUDIT where TIMESTAMP >= (SYSDATE - dateNum);
truncate table AUDIT drop storage;
[code]....

View 8 Replies View Related

Forms :: Read Data From Excel And Store It In Blob?

Aug 10, 2010

I am getting the file using CLIENT_GET_FILE_NAME. I need to read the data from the .xsl file and convert it into blob. The file should not be stored in DB.

View 8 Replies View Related

SQL & PL/SQL :: Data Types To Store Large Integer Values?

Aug 15, 2012

what could be effective data type to store large integer values like, 50,000; 10,000,000 etc.?

View 3 Replies View Related

SQL & PL/SQL :: Store Data From Multiple Places In Materialized View?

Apr 14, 2011

I have a PL/SQL procedure which gathers data from multiple places as well as calculates some data. I want to store all this in a materialized view.So, I created an object type (I've shortened the definitions):

CREATE OR REPLACE TYPE mf_record_type AS OBJECT
(identifier VARCHAR2(6),
name VARCHAR2(100));

Then created the table type of the object:

CREATE OR REPLACE TYPE mf_table_type IS TABLE OF mf_record_type;

Then in the stored procedure defined a variable of the table type:

v_mf_record mf_table_type := mf_table_type();

Then I loop and populate the record type:

v_mf_record.EXTEND(1);
v_mf_record(x) := mf_record_type(v_rec.identifier, v_mf_detail.name);

When all that is done I try and create the materialized view:

EXECUTE IMMEDIATE ('CREATE MATERIALIZED VIEW mf_snapshot_mv AS
SELECT * FROM TABLE (CAST (v_mf_record AS mf_table_type))');

ORA-00904: "V_MF_RECORD": invalid identifier

Am I doing something wrong here? Can't I create the materialized view based on something other than a physical table?

View 1 Replies View Related

SQL & PL/SQL :: Cursors To Update Data And Store It Back To Same Table

Sep 4, 2010

I'm using few cursors to update my data and store it back to the same table. But for some reason the cursor seems to be picking obsolete data.

cursor c1
is
select distinct roles
from table1
where flag = '1';

cursor c2
is
select distinct roles
from table1
where flag = '1';
begin
for i in c1
loop

here im updating the roles im picking to to a suffix and role.

update table1
set role = suffix_role
where 'some condition';
end loop;
commit; -- committing so changes are visible for my next cursor.

for j in c2
loop

here im deleting all the roles that are not part of my comparing table.

delete from table1
where role = 'something';

But in my debugging table i see that its deleting roles present as input for first cursor, whereas it should actually pick data with suffix_roles.

View 12 Replies View Related

Forms :: Transaction Data Which Should Store Temporarily In Database?

Sep 17, 2013

I have a Data entry form which is a multirecord block;

Question: for example that form has 10 to 25 fields or columns more than that all the data has been entered, but before committing or saving that form i need to cross check the the data with a select query, whether the data entered is correct or not but before committing, that data it should be posted into that table if i find that one data is entered wrongly then i will modify that and again cross check and save the transaction permanently into the database table?

View 11 Replies View Related

SQL & PL/SQL :: How To List Data Dynamically Month Wise Picking Month From The Same Table

Jun 4, 2013

I have a requirement to list the data month wise dynamically where month data is also in the same table, hopefully the below posts should bring more clarity to my requirements.

1. Table creation:
Create table T1 (account_no varchar2(15), area_code varchar2(2), bill_month date, consumption number);

2. List table content:
select * from T1;

account_no area_code bill_month consumption

Q00001Q31-Jan-12125
Q00002Q31-Jan-1265
Q00003Q28-Feb-12219
Q00004Q28-Feb-12805
Q00005Q28-Feb-1254
Q00001Q31-Mar-12234
Q00002Q31-Mar-12454
Q00003Q31-Mar-12232
Q00004Q30-Apr-1221
Q00005Q30-Apr-12218
Q00001Q30-Apr-1254
Q00002Q31-May-1219
Q00003Q31-May-1287
Q00004Q30-Jun-12187
Q00005Q30-Jun-1278
so on......so on......so on......so on......

3. Expected output:
account_no area_code Jan-12 Feb-12 Mar-12 Apr-12 May-12Jun-12Jul-12Aug-12Sep-12Oct-12Nov-12Dec-12

Q00001 Q 125 548 2345487423154821518738721512
Q00002 Q 65 127 45487819357831585683152878
Q00003 Q 545 219 2328738735188745897313
Q00004 Q 78 805 1221218187885718387389787138
Q00005 Q 541 54 2621878778386538698182

With the conventional query I hope this is impossible,

View 2 Replies View Related

SQL & PL/SQL :: Row To Column / Column Data Can Be Varied From 1 To Any Number Of Words

Mar 21, 2013

I have a table where i have description column which free text column, the data in description column is seperated and i want to corvert 1 row data in multiple rows dependeing on the number of words.

eg

id description
78664 Pumps Alarm from CAMS RTU154

In the above example this column has 5 word so i want data in 5 rows like below

78664 Pumps
78664 Alarm
78664 from
78664 CAMS
78664 RTU154

This column data can be varied from 1 to any number of words.

View 11 Replies View Related

PL/SQL :: Derived Column Data As New Column In SELECT

Jul 31, 2013

I have a INSERT query which is happening with a SELECT query.

 ===================================================

INSERT INTO tbl_fact_effort_lvl_data (  ...............       )                       
SELECT ria.report_id,report_status:  :,
((SELECT lov_num_val                                   
FROM tbl_reference_data                                
WHERE lov_type = 'FREQUENCY'   ) * (SELECT SUM(pph_task)
FROM tbl_ri_process                                      
WHERE report_id = ria.report_id )) TOT_YEARLY_PROD_HOURS   ,TOT_YEARLY_PROD_HOURS * tf.fac_value TOT_FACT_DATA,location_id                                                                                                      
FROM tbl_fact tf  LEFT JOIN ......... ;

==================================================== 

So, here I want to use column alias TOT_YEARLY_PROD_HOURS as another column to derive another column value TOT_FACT_DATA.

View 8 Replies View Related

Day Wise Count For A Given Year

Jul 2, 2011

In oracle query can i want find out how many day wise count for a year days (for example how may sundays, mondays, tuesdays, wednesdays ,thursdays,fridays,saturdays) in a given year (we can give the start day of the year and the end day of a year).

example
----------
jan sun-5 mon-4 tue-5 wed-5 thu-5 fri-4 sat-5
feb ------------do---------------------------------
like this for all 12 months at a single query.

View 3 Replies View Related

SQL & PL/SQL :: Query On Range Wise

Jul 26, 2013

I want output like given below. Using EMp table . if sal is <1000 means count of Emp's who are having lessthan 1000 like that.

Deptno sal sal sal sal
<=1000 <=2000 <=3000 <= 5000

10 2 4
20 2.

View 2 Replies View Related

SQL & PL/SQL :: Day Wise Count In A Month

Jul 1, 2011

I want to get the current month day wise count. I dont want Procedure. I need SQL Query only.For example:

July 2011.
Sunday - 5
Monday - 4
Tuesday - 4
Wednesday- 4
Thursday - 4
Friday - 5
Saturday- 5

View 3 Replies View Related







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