SQL & PL/SQL :: How To Parse Data And Add Columns In A View
Jan 11, 2012
I have a column which holds the data in the below format.
Source Data :
>SNO_SDSDQ-8192-BN>SNO_54-99-24120-8192
>SNO_SDSDQ-8192-BN>SNO_54-99-24120-8192>SNO_54-90-16489-008G
>SNO_SDPMDB-008G-11>SNO_54-90-18008-008G>SNO_54-62-08791-008G>SNO_20-81-00327
>SNO_SDPMDB-008G-12>SNO_54-90-17830-008G>SNO_54-62-08598-008G>SNO_20-81-00327
[code]..
Problem Statement :
Split the above data into individual components and create columns / aliases dynamically.If the column is present then place the data under the created column.
Example 1) :
>SNO_SDSDQ-8192-BN>SNO_54-99-24120-8192
Result
Column Name : SKUCol_54-99
Data :SNO_SDSDQ-8192-BNSNO_54-99-24120-8192
Example 2)
>SNO_SDSDAA-002G-101-J>SNO_54-90-16002-002G>SNO_54-62-05781-002G>SNO_20-81-00135-5
Column Name : SKU54-90Col_54_62Col_20_81
Data :SNO_SDSDAA-002G-101-JSNO_54-90-16002-002GSNO_54-62-05781-002GSNO_20-81-00135-5
Column Name can be derieved from the components like SNO_54-62-05781-002G
i.e. SNO_54-62-05781-002G ==> SNO_-05781-002G
"54-62" will give the Col_Name
The First Column will always have data starting with
SNO_SD%
This column is constant and will be named as SKU.
I need this data to be placed in the same record / row but under different columns as per the data set.Basically, Can the data be split into multiple parts based on delimeters and the columns are created based on the unique data in the parts that form the data in the column.
View 1 Replies
ADVERTISEMENT
Apr 29, 2011
I have a table that has rows like below in one column. I want to parse the rows in different columns.
Column12
abc|yed| qas ert | hub cap | jak
agh|
bef|rfd
som|gfr|lup
I need to parse the above in different columns by splitting at the pipe.
so it will show something like this
col1 col2 col3 col4 col5
abc yed qas ert hub cap jak
agh
bef rfd
som gfr lup
is it possible to do it in PL/sql.
View 3 Replies
View Related
Jul 22, 2013
I'd like to parse an XML file and get some data extracted as columns. Input file country.xml:
<?xml version="1.0" encoding="UTF-8"?>
<MAS Action="Insert">
<Country ObjectId="100000000000000009" VersionId="8"><Id>1</Id><NlTexts><Name Language="de">Land1</Name><Name Language="en">Country1</Name></NlTexts></Country>
[Code]....
View 2 Replies
View Related
Oct 21, 2011
I've created a stored procedure which creates itself a view (a MV to be honest); the instructions to create this m.view are dinamically built insinde my procedure, so each time i run it, based on the different input parameters, i've got a different result (my output m.view can have three colums the first time, or ten the next time) how can I read my output view to put the data into file? I've tried with "select * bulk collect into my_array from my_ output_ view"...after declaring "my_array" as a varying array with the max number of colums I could ever have...but nothing: if the array dimension doesn't match the number of columns that i've on my view, i.e. i receive "ora-00947 not enough values" error.
Is there a method to dimension dinamucally the array to store my data? Or should I change the code to fetch some other way the data i need to put to a file?
View 2 Replies
View Related
Dec 19, 2012
In my requirement, I have many calculated columns needs to be modeled for the fact table, I am thing using a Materialized view for all computed columns and expose this MV for reporting tools. Using Materialized view as a fact table to query is a good approach?
Actual table columns
ART_NO, ART_PRICE, PROFITTable along with actual columns
ART_NO, ART_PRICE, ART_PRICE_LAST_YEAR, ART_PRICE_TRIM, ART_PRICE_EURO, PROFIT, PROFIT_LAST_YEAR, PROFIT_TRIM, PROFIT_EURO.
View 10 Replies
View Related
Aug 16, 2013
I created a user and granted connect, resource to the user. but trying to select columns from the view USER_HISTORY$,it's showing no value, i tried to login the user several times, but it's displaying no value, any particular reason or any minor mistake?
View 1 Replies
View Related
Feb 14, 2013
i had an issue last week with enabling and disabling a column in a tabular view. and i have it working now.... when the page loads i disable the column in the 25 rows being displayed.
the problem i now have is when i use the pagination to move through the rows the columns are all now enabled.
so what i am trying to do is this:
i have a tabular view showing 25 rows at a time. there is one column with a code and one with a description. when the code is changed, via a popup LOV, the description is changed based on the valus in a lookup table in the database.
i need the description column disabled, so the user cannot simply just type in the column. but when the page is submitted, the column needs to be enabled so i have modified the sumbit button to respond to a dynamic action which runs some enabling code then submits the page.
SO....
this all seems to be working except for when you use the pagination, the description column is all enabled.
is there a way of running some javascript when the pagination is refreshed? some better way of doing it?
View 3 Replies
View Related
Jun 20, 2013
Instance Efficiency Percentages (Target 100%)
Buffer Nowait %: 100.00 Redo NoWait %: 100.00
Buffer Hit %: 99.19 In-memory Sort %: 100.00
Library Hit %: 83.82 Soft Parse %: 11.21
Execute to Parse %: 92.47 Latch Hit %: 99.77
Parse CPU to Parse Elapsd %: 82.07 % Non-Parse CPU: 71.64
I see my soft parse in instance efficiency is 11.21%. Is this something to worry about?
View 2 Replies
View Related
Sep 26, 2013
I have table with Blob column. In the blog column I have XML data (see below). I wanted to parse xml and get the value of note '<GetTest>'. How do I achieve that? Sample Table:
create table SAMPLE_XML_TABLE
(
ID NUMBER not null,
XMLSTRING BLOB,
);
<?xml version="1.0" standalone="no"?>
<FromResponse xmlns="http://www.somewebsite.com/FromResponse">
<Code>0000</Code>
[code].........
View 7 Replies
View Related
Apr 1, 2013
I have a field that contains many part numbers. There can be 2 or more part numbers in the field separated by a space. How can this be dynamically read so you can compare the contents in the where clause to what you are search for? Example Part Numbers in the field: 1X 2X 3X 4Y 5Y 7Y
I would like to read the field and make rows out of the data.
1X
2X
3X
4Y
5Y
7Y
View 3 Replies
View Related
Apr 11, 2011
I got the table where are logged every single events from web site. Sometimes (depends on events)is written xml code into the xml_params column of table H ow to make an automatically procedure (sql query, function, or something like that) which every value of xml code should be written separate into the column the table. The point is I dont know what parameters will be included in the xml code in future.
For instance xml looks like:
<parameters xmlns="http://datalan.sk/webreporting/params/v1_0">
<parameter name="loginReason">
<value>invalidUserNameOrPassword</value>
[code]....
View 17 Replies
View Related
Mar 22, 2010
how to parse paramlist type variable to get names of the fields and their values in the paramlist?
View 1 Replies
View Related
Mar 29, 2013
I'm working on trying to write a shell script to parse a parameter file, but at the same time I want to be able to overwrite the parameter file settings with other command line settings. For instance if my par file had export/import settings for the username, password, schema, etc;
I wanted to run the same export/import with those settings for a different schema. I want to be able to put the schema=<different_than_par_file> after the parfile=<parfile.par and have the parfile be read and applied for everything except the different schema.
Right now I'm storing the cmd line and parsing it again looking for other parameters besides the parfile.
View 4 Replies
View Related
Sep 25, 2013
DB Used : Oracle 10g.
A table X : NUM, INST are column names
NUM ----- INST
1234 ----- 23,22,21,78
2235 ----- 20,7,2,1
1298 ----- 23,22,21,65,98
9087 ----- 20,7,2,1
-- Based upon requirement :
1) Split values from "INST" Column : suppose 23
2) Find all values from "NUM" column for above splitted value i.e 23 ,
Eg:
For Inst : 23 ,
It's corresponding "NUM" values are : 1234,1298
3) Save these values into
A table Y : INST, NUM are column names.
INST NUM
23 1234,1298
1) I have a thousand records in Table X , and for all of those records i need to split and save data into Table Y.Hence, I need to do this task with best possible performance.
2) After this whenever a new data comes in Table X, above 'split & save' operation should automatically be called and append corresponding data wherever possible..
View 4 Replies
View Related
Jun 10, 2013
I do have a query which gives me two rows of data.(This might be more than two in other cases)
The data I get is formed as :
COUNTRY_DESCRIPTION COUNTRY_CODE EVENT_NUMBER EVENT_DATE APPLICANT
European Patent EP 101 Kiksu
European Patent EP 101 Mokilosu
What I want to get should be formed as :
COUNTRY_DESCRIPTION COUNTRY_CODE EVENT_NUMBER EVENT_DATE APPLICANT
European Patent EP 101 Kiksu
Mokilosu
As you can see, I removed the first four columns because the eventkey is the same. In this case, there is only the applicant which is different.So the rest should be blank.
The code I do use to get this data:
SELECT
TABLECOUNTRY.COUNTRYDESCRIPTION "COUNTRY_DESCRIPTION"
,TABLECOUNTRY.COUNTRYCODE "COUNTRY_CODE"
,OWNER.NAME "APPLICANT"
,CASEEVENT.EVENTNUMBER "EVENT_NUMBER"
,TO_CHAR(CASEEVENT.EVENTDATE,'DD.MM.YYYY') "EVENT_DATE"
[code]....
So what to modify in the query to get these columns of the second row blank?
View 17 Replies
View Related
Aug 9, 2011
I have a table like below-
create table test (cust_id number(3), m_no number(1), other_date varchar2(20));
Where there is a "cust_id" that can have maximum 3 "m_no" (Don't bother for that condition, we have it in actual table).
In this table records are as follows.
insert into test values (1,1,'ABC');
insert into test values (1,2,'DEF');
insert into test values (2,1,'DEG');
insert into test values (3,2,'DEG');
[Code]..
My objective is to get date like below--
cust_idf_m_nof_oth_datas_m_nos_oth_datat_m_not_oth_data
1 1 ABC 2 DEF
2 1 DEG
3 2 DEG 1 BCD 3 MNO
4 9 KLM
5 2 XYZ 5 XAZ
I want to say, that cust_id's that doesn't have second and third m_no should not have any data in those columns.
Can this be performed through single query, or I need to make temporary tables or functions for this.
View 7 Replies
View Related
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
May 10, 2013
when we have a primary key on 4 columns and we have, say 20 million rows and we want to add one extra row. How does oracle check whether the data on the primary key is unique to the record being added compared to the 20 million rows. Does it actually compare the record being added to all the rows present in the table?
View 2 Replies
View Related
Apr 30, 2010
writing SQL, where I need to invert the column data into columns. My data in DB is as below.
MONTHNAMEVALUE
Jan-10M1 5
Jan-10M2 8
Jan-10M3 9
Feb-10M1 4
Feb-10M2 6
Feb-10M3 2
Feb-10M4 10
Mar-10M1 21
Mar-10M2 6
Required output for reporting will be like:
MONTHM1M2M3M4
Jan-10589
Feb-1046210
Mar-10216
How can I achieve this using SQL.[ORACLE 10g] ?
I can make use of Oracle BI server also.
View 2 Replies
View Related
Nov 1, 2011
Question 1) I have read the following statement in a PL/SQL book.
Quote:To check whether an existing procedure is compiled for native execution or not, you can query the following data dictionary views:
[USER | ALL | DBA]_STORED_SETTINGS
[USER | ALL | DBA ]_PLSQL_OBJECTS
However, I when i query the view USER_PLSQL_OBJECTS I get the following error message:
Quote:ORA-00942: table or view does not exist
Question 2) I have read the PLSQL_WARNING can be set to DEFERRED at the system level. However, I am unable to defer it. tell me how to apply defer caluse to following statement:
Quote:ALTER SYSTEM SET PLSQL_WARNINGS ='DISABLE:ALL'
View 10 Replies
View Related
Mar 27, 2010
I have created a view in that the primary key column is not included,so that we cannot insert data into that view,but i want to insert data into that view without using Instead of Triggers.
CM: swapped version and title so they're the right way round.
View 12 Replies
View Related
Jul 16, 2013
I want know how the values in view DBA_FEATURE_USAGE_STATISTICS gets updated i have already checked the metadata of this view but unable to find how / when the values are being updated.
View 3 Replies
View Related
Jul 19, 2013
I'm new to Oracle Forms 10g.
When I create a data block based on a table using Data Block Wizard, the block's Query Data Source Columns property is automatically populated with column definition entries corresponding to the columns of the base table.
I tried making changes to these entries, for example by changing the data types to wrong data types or even deleting them, and I found that those changes had no effect on the block at all. The form was still working as I wanted.
What is exactly the role of the block's Query Data Source Columns property.
The F1 key help says "The Query Data Source Columns property is valid only when the Query Data Source Type property is set to Table, Sub-query, or Procedure". So, explain in each context of Query Data Source Type.
View 2 Replies
View Related
Oct 22, 2012
query to find out common data from 2 columns in two different tables??
View 6 Replies
View Related
Mar 11, 2013
I have a Employee table of the following format:
Emp_id | Emp_name | Salary
101 | James | 1000
102 | Julia | 200
I have to convert or transpose the table data as follows using a SQL statement/function -
Emp_id | 101 | 102
Emp_name | James | Julia
Salary | 1000 | 2000
How do I achieve this?
View 4 Replies
View Related
Dec 5, 2012
I have the situation like i want display the data from table which is storing in rows into a columns....
My table structure will be like this(Here i am taking only one part but have N no. of parts in my system)
Partno Purchase date Qty
111 02-DEC-2012 15
111 03-DEC-2012 25
111 04-DEC-2012 20
*** **** ****
111 31-DEC-2012 28
So i am expecting my query out put should be in column wise, that should make columns dynamically based on dates.
like example
__Partno 01-Dec-12 02-Dec-12 03-Dec-12 04-Dec-12 ---- ---- --- 31-Dec-12__
111 0 15 25 20 28
Here columns should be created based purchase dates dynamically with respect to quantity. Query out put will be like matrix format. So i feel that PIVOT & SYS_CONNECT_BY_PATH will not serve my requirement.
My system comparability is
oracle 10g database.
oracle 6i forms.
View 4 Replies
View Related
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
Feb 27, 2012
How can i load the data into a new table from view,when ever scheduler runs in the night, the data gets loaded in to a view and data coming from different tables and i should load that data every day and i dont want previous data again.The data should be loaded along with view .
View 6 Replies
View Related
Jul 25, 2012
My boss make a requirement in exist database as some user can view salary column at employment table by SQL and some user can view salary column at employment table by SQL.
The boss do not like to make changes front SQL. Ooracle 11g vault or Oracle Label Security is best for this requirement?
my oS is 2008 32 bit window and DB is 11.2.0.1
View 4 Replies
View Related
Jan 26, 2010
Is it possible to use Data grid view in Forms6i just as in Visual Basic?
View 7 Replies
View Related