Saving values of Multiple rows
hi Friends,
I am developing Timesheet Tracking System which enables an employee to enter his project details and submit the weekly timesheet to his Project Manager
I have eight columns and 3 Rows
Columns
1. Project Description
2. Mon
3. Tue
4. Wed
5. Thurs
6. Fri
7. Sat
8. Sun
Rows
Leave
Training
I have seven textboxes (time1-time7 for values entered in columns Mon-Sun) for all 3 Rows
i want to save the values entered in the textboxes in the table
The things is that i m able to save the first row only
Mon Tue Wed Thurs Fri Sat Sun
Timesheet Project 6 6 7 7 8 4 0
Leave 1
Training 2 1 1.5 1
how do i save all values all 3 rows
how do i save values of second row i.e.'Leave'
PreparedStatement pstmt=con.prepareStatement("insert into poojac_Week26 values(?,?,?,?,?,?,?,?)");
pstmt.setInt(1,time1);
pstmt.setInt(2,time2);
pstmt.setInt(3,time3);
pstmt.setInt(4,time4);
pstmt.setInt(5,time5);
pstmt.setInt(6,time6);
pstmt.setInt(7,time7);
pstmt.setInt(8,time1+time2+time3+time4+time5+time6+time7);
int cnt=pstmt.executeUpdate();
System.out.println("values inserted");
the above code is saving values of only first row
Do help me
Thanx & Regards,
Pooja
hi Friends,
I am developing Timesheet Tracking System which
enables an employee to enter his project details and
submit the weekly timesheet to his Project Manager
I have eight columns and 3 Rows
Columns
1. Project Description
2. Mon
3. Tue
4. Wed
5. Thurs
6. Fri
7. Sat
8. Sun
PreparedStatement pstmt=con.prepareStatement("insert
into poojac_Week26 values(?,?,?,?,?,?,?,?)");
pstmt.setInt(1,time1);The first Column is a String right? Why are you putting a time?????
pstmt.setInt(2,time2);
pstmt.setInt(3,time3);
pstmt.setInt(4,time4);
pstmt.setInt(5,time5);
pstmt.setInt(6,time6);
pstmt.setInt(7,time7);
pstmt.setInt(8,time1+time2+time3+time4+time5+time6+time
);I saw you had values like 1.5, and this is not an int......
You only made one insert why are you expecting to have two rows inserted????
You need to make two calls to execute update if you want two insertions.... and you should clear up you mind about the nature of the fields on your table....
Similar Messages
-
How To Concatenate Column Values from Multiple Rows into a Single Column?
How do I create a SQL query that will concatenate column values from multiple rows into a single column?
Last First Code
Lesand Danny 1
Lesand Danny 2
Lesand Danny 3
Benedi Eric 7
Benedi Eric 14
Result should look like:
Last First Codes
Lesand Danny 1,2,3
Benedi Eric 7,14
Thanks,
David JohnsonStarting with Oracle 9i
select last, first, substr(max(sys_connect_by_path(code,',')),2) codes
from
(select last, first, code, row_number() over(partition by last, first order by code) rn
from a)
connect by last = prior last and first = prior first and prior rn = rn -1
start with rn = 1
group by last, first
LAST FIRST CODES
Lesand Danny 1,2,3
Benedi Eric 7,14Regards
Dmytro -
Concatenate a column value across multiple rows - PDW
We are using PDW based on SQL2014. We require an efficient logic on how to concatenate a column value across multiple rows. We have the following table
T1
(CompanyID, StateCD)
Having following rows:
1 NY
1 NJ
1 CT
2 MA
2 NJ
2 VA
3 FL
3 CA
We need a code snippet which will return following result set:
1
CT,NJ,NY
2
MA,NJ,VA
3
CA,FL
We have tried built-in function STUFF with FOR XML PATH clause and it is not supported in PDW. So, we need a fast alternative.Hi Try this:
SELECT * INTO #ABC
FROM
SELECT 1 AS ID,'NY' AS NAME
UNION
SELECT 1 AS ID,'NJ' AS NAME
UNION
SELECT 1 AS ID,'CT' AS NAME
UNION
SELECT 2 AS ID,'MA' AS NAME
UNION
SELECT 2 AS ID,'NJ' AS NAME
UNION
SELECT 2 AS ID,'VA' AS NAME
UNION
SELECT 3 AS ID,'FL' AS NAME
UNION
SELECT 3 AS ID,'CA' AS NAME
)A
CREATE TABLE ##CDB (ID INT, NAME NVARCHAR(800))
DECLARE @TMP VARCHAR(MAX),
@V_MIN INT,
@V_MAX INT,
@V_COUNT INT
SELECT @V_MIN=MIN(ID),@V_MAX=MAX(ID) FROM #ABC
SET @V_COUNT=@V_MIN
WHILE @V_COUNT<=@V_MAX
BEGIN
SET @TMP = '' SELECT @TMP = @TMP + CONVERT(VARCHAR,NAME) + ', ' FROM #ABC
WHERE ID=@V_COUNT
INSERT INTO ##CDB (ID, NAME) SELECT @V_COUNT AS ID ,CAST(SUBSTRING(@TMP, 0, LEN(@TMP)) AS VARCHAR(8000)) AS NAME
SET @V_COUNT=@V_COUNT+1
END
SELECT * FROM ##CDB
OR
SELECT * INTO #ABC
FROM
SELECT 1 AS ID,'NY' AS NAME
UNION
SELECT 1 AS ID,'NJ' AS NAME
UNION
SELECT 1 AS ID,'CT' AS NAME
UNION
SELECT 2 AS ID,'MA' AS NAME
UNION
SELECT 2 AS ID,'NJ' AS NAME
UNION
SELECT 2 AS ID,'VA' AS NAME
UNION
SELECT 3 AS ID,'FL' AS NAME
UNION
SELECT 3 AS ID,'CA' AS NAME
UNION
SELECT 5 AS ID,'LG' AS NAME
UNION
SELECT 5 AS ID,'AP' AS NAME
)A
CREATE TABLE ##CDB (ID INT, NAME NVARCHAR(800))
DECLARE @TMP VARCHAR(MAX),
@V_MIN INT,
@V_MAX INT,
@V_COUNT INT
SELECT @V_MIN=MIN(ID),@V_MAX=MAX(ID) FROM #ABC
SET @V_COUNT=@V_MIN
WHILE @V_COUNT<=@V_MAX
BEGIN
SET @TMP = '' SELECT @TMP = @TMP + CONVERT(VARCHAR,NAME) + ', ' FROM #ABC
WHERE ID=@V_COUNT
SELECT @V_COUNT AS ID ,CAST(SUBSTRING(@TMP, 0, LEN(@TMP)) AS VARCHAR(8000)) AS NAME INTO #TEMP
INSERT INTO ##CDB (ID, NAME) SELECT ID, NAME FROM #TEMP WHERE NAME<>''
DROP TABLE #TEMP
SET @V_COUNT=@V_COUNT+1
END
SELECT * FROM ##CDB
Thanks Shiven:) If Answer is Helpful, Please Vote -
Reg : Concatenation of a column value with multiple rows... URGENT
Hello,
Could any of u help me in concatenating a column value with
multiple rows ???
For ex : I've the following data from emp table :
DEPTNO ENAME
10 KING'S
30 BLAKE
10 CLARK
10 TOM JONES
30 ALLEN
30 JAMES
20 SMITH
20 SCOTT
20 MILLER
10 MILLER
20 rajeev
I want the following output :
deptno Concat_value
10 KING'S,CLARK,TOM JONES,MILLER
20 Rajeev,MILLER,SMITH,SCOTT
30 BLAKE,ALLEN,JAMES
Thanks in Advance,
SriniHello Naveen,
Thanks for ur answer. But I need a single SQL query for getting
what I want. I know the solution in PL/SQL.
Please try it in a single SQL....
Thanks again,
Srini -
Please - immediate help needed parsing csv values into multiple rows
Hello, we have a very immediate need to be able to parse out a field of comma separated values into individual rows. The following is an example written in SQL Server syntax which does not work in Oracle.
The tricky part is that each ROUTES can be a different length, and each CSV can have a different number of routes in it.
Here is an example of the table ("Quotes") of CSV values I want to normalize:
TPNUMBER ROUTES
1001 1, 56W, 18
1002 2, 16, 186, 28
Here is an example of what I need it to look like:
TPNUMBER ROUTES
1001 1
1001 56W
1001 18
1002 2
1002 16
1002 186
1002 28
Here is the "Tally" table for the query below:
ID
1
2
3
4
5
6
7
And finally, here is the query which parses CSV values into multiple rows but which does not work in Oralce:
SELECT TPNUMBER,
NullIf(SubString(',' + ROUTES + ',' , ID , CharIndex(',' , ',' + ROUTES + ',' , ID) - ID) , '') AS ONEROUTE
FROM Tally, Quotes
WHERE ID <= Len(',' + ROUTES + ',') AND SubString(',' + Phrase + ',' , ID - 1, 1) = ','
AND CharIndex(',' , ',' + ROUTES + ',' , ID) - ID > 0
It may be necessary to use a cursor to loop through the CSV table and process each row (a loop within another loop...) but this is beyond my comprehesion of PL/SQL.
Many thanks in advance for your advice/help.
apkNot sure what you are trying to do with the last step, but this should work for the first part. I assume you would use sqlldr but I just did inserts instead. You might need more than 5 "routes" in the csv. You could put some reasonable max on that number of columns:
SQL>create table t_csv
2 (TPNUMBER varchar2(20),
3 ROUTE_1 VARCHAR2(5),
4 ROUTE_2 VARCHAR2(5),
5 ROUTE_3 VARCHAR2(5),
6 ROUTE_4 VARCHAR2(5),
7 ROUTE_5 VARCHAR2(5),
8 ROUTE_6 VARCHAR2(5) );
Table created.
SQL>INSERT INTO t_csv (TPNUMBER,ROUTE_1,ROUTE_2) values( '1001 1', '56W', '18' );
1 row created.
SQL>INSERT INTO t_csv (TPNUMBER,ROUTE_1,ROUTE_2,ROUTE_3) values( '1002 2', '16', '186', '28');
1 row created.
SQL>create table t_quotes(
2 tpnumber NUMBER,
3 routes VARCHAR2(5));
Table created.
SQL>DECLARE
2 L_tpnumber NUMBER;
3 L_route VARCHAR2(5);
4 begin
5 for rec in (select * from t_csv) loop
6 L_tpnumber := SUBSTR(rec.tpnumber,1,INSTR(rec.tpnumber,' ')-1);
7 L_route := SUBSTR(rec.tpnumber,INSTR(rec.tpnumber,' ')+1);
8 insert into t_quotes values( L_tpnumber, l_route );
9 if rec.route_1 is not null then
10 insert into t_quotes values( L_tpnumber, rec.route_1 );
11 end if;
12 if rec.route_2 is not null then
13 insert into t_quotes values( L_tpnumber, rec.route_2 );
14 end if;
15 if rec.route_3 is not null then
16 insert into t_quotes values( L_tpnumber, rec.route_3 );
17 end if;
18 if rec.route_4 is not null then
19 insert into t_quotes values( L_tpnumber, rec.route_4 );
20 end if;
21 if rec.route_5 is not null then
22 insert into t_quotes values( L_tpnumber, rec.route_5 );
23 end if;
24 end loop;
25 end;
26 /
PL/SQL procedure successfully completed.
SQL> select tpnumber, routes from t_quotes;
TPNUMBER ROUTE
1001 1
1001 56W
1001 18
1002 2
1002 16
1002 186
1002 28
7 rows selected. -
Populating Combo Box list value In Multiple Row
Hi,
i to have the same problem .
I have used add_list_element to populate the list value of the combo box in multiple row.
I am selecting the list value from the database where the combo box value will be different for each row. However, when i do this.
All the previous row combo box list value will follow the combo box value in the last row. How can i resolve this?
i tried with lov but hasnt had any sucesss.in case of LOV can we make the list to appear automatuically and select a value????i havent had much sucesss over it??
is thr any work around for this apart from lov?Hi,
which product or technology are you talking about ?
Frank -
Passing values of multiple rows to OracleCallableStatement
Hi,
I have a table with multiselection and a submit button. I want to select multiple rows and pass the values of selected rows one by one to a OracleCallableStatement in AM.
I have below code in CO. RowSelection is a transient attribute of type string in ItemsNotReturnedVO. 'Checked Value' is Y
When I run the page, select rows, click on Update button, I get this error. "*Attribute set for RowSelection in view object ItemsNotReturnedVO1 failed*"
if ("WaiveItemBtn".equals(pageContext.getParameter(EVENT_PARAM))) {
OAViewObject itemVO = (OAViewObject)am.findViewObject("ItemsNotReturnedVO1");
OARow row = (OARow)itemVO.first();
for(int i=0;i<itemVO.getRowCount();i++)
String appStatus=itemVO.getCurrentRow().getAttribute("RowSelection").toString();
if(appStatus.equalsIgnoreCase("Y"))
String vHeaderID = pageContext.getParameter("vTraHeaderId");
pageContext.putTransactionValue("vTraHeaderId", vHeaderID);
String vTempID = pageContext.getParameter("vTraTempId");
pageContext.putTransactionValue("vTraTempId", vTempID);
Serializable[] params = { vHeaderID,vTempID };
am.invokeMethod("waiveItemRequest", params);
row = (OARow)itemVO.next();
Below code in AM
public void waiveItemRequest(String vHeaderID, String vTempID){
try{
OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getDBTransaction();
OracleCallableStatement oraclecallablestatement =
(OracleCallableStatement)oadbtransactionimpl.createCallableStatement(" { call xxitemreturn_pkg.waive_item(:1,:2) } ",1);
oraclecallablestatement.setInt(1, Integer.parseInt(vHeaderID));
oraclecallablestatement.setInt(2, Integer.parseInt(vTempID));
oraclecallablestatement.execute();
catch(Exception e){
e.printStackTrace();
Using 10g database, Jdeveloper 10.1.3.3.0Hi Nadir,
The error is coming because you transient attribute is not updateable.
To make it updateable,
1) Open your VO
2) Go to Attributes
3) Select your transient attribute and make UPDATEABLE = Always.
Let me know, if this helps or you need further assistance.
Thanks
Saurabh -
Cell value spanning multiple rows in JTable
Hi,
I have a JTable where I want a single column value alone to span multiple rows.
Something like
Course No. | Location | Cost
| loc1 | 1000
1 ---------------------------------------------
| loc2 | 2000
How can I create a JTable like this?
Thanks for the help.I have a link for that,
http://www2.gol.com/users/tame/
go in swing examples, JTable #4.
Hope it helps :) -
Display CLOB value in multiple rows in ADF UIX
Hi,
I have an ADF UIX application that uses data that are stored in a CLOB column in an Oracle Database.
The table data is presented in a simple table in page1.uix, I use BC4J for accessing the Database and Oracle JDeveloper 9.0.5.2.
The problem is that the CLOB data appear properly (meaning the rows appear OK) only in a frame (messageTextInput element) of a predefined size and if I change the element into a styledText or a formattedText the frame will not appear, but all the CLOB characters appear in a single row.
Does anyone know how I can present the CLOB text data in a UIX page, without having a frame around the text, and at the same time keep the CLOB text in multiple rows?There's no completely trivial way. You'd have to do a bit of extra processing of your CLOB data. The most straightforward work to do is to convert "\n" into "<br>", and then pass that into a <formattedText>.
-
How to convert colon separated column values in multiple rows in report
Hi All,
I want to display colon separated values from a column, in a multi row in report.
For example i have a column1 in a table with value 'A:B:C' , column2 has value '1'.
i want to show in a report three rows using these two columns like
column1 column2
A 1
B 1
C 1Here's one way:
SQL> create table test (col1 varchar2(20), col2 number);
Table created.
SQL> insert all
2 into test values ('A:B:C', 1)
3 into test values ('Dg:Ezs', 2)
4 select * from dual;
2 rows created.
SQL> select
2 t.col2,
3 regexp_substr(t.col1, '\w+', 1, t2.column_value) c1
4 from test t,
5 table(cast(multiset(select level
6 from dual
7 connect by level <= length(t.col1) - length(replace(t.col1, ':', '')) + 1
8 ) as sys.odcinumberlist )) t2
9 order by 2, 1;
COL2 C1
1 A
1 B
1 C
2 Dg
2 Ezs
SQL>Edited by: Littlefoot on Jan 31, 2012 10:13 AM -
InputListOfValues behavoir when entered value returns multiple rows
Hi,
We're using ADF Faces & BC 11.1.1.2.0. Our app is being tested and our QA team has flagged the following behaviour as a bug:
Test:
Type the value 'S' into the list of values input box.
Expected behaviour:
System recognises entered value 'S' as matching row with primary key 'S'.
Actual behaviour:
LOV search box appears automatically, showing the values 'S' and 'SX'.
User is required to explicitly select row 'S'.The inputListOfValues is set to autosubmit, so it seems that as soon as the user enters a value that could be the prefix of a number of rows, the search box is shown (even if the value they've entered does actually have an exact match to one of the rows).
How can we stop this behaviour? Ideally, we don't ever want the search dialog to automatically popup (would rather have the LOV simply shown as in error if the user enters an invalid value).
Cheers!I don't think creating our own popup is an option. As you know, the inputListOfValues popup offers a huge range of search features that our users are attached to.
If there's no easy way to disable this then we'll just have to argue that this is the expected behaviour. I agree with our QA guys though, if I enter a valid (and exact) key, why does the search box pop up? It makes data entry much slower than it should be.
Thanks for the info Frank. -
Split Single Cell Value to Multiple Rows
Uses: Oracle 9i;
There is this restriction in our country, where an individual cheque value can not exceed Rs. 100,000,000. We organize our Payment list for a settlement date and the sample data table looks like this:
PaymentID | AccountID | PaymentMode | PaymentDate | PaymentValue
=============================================
p1,ac1,cheque,01-Dec-2009,99,000;
p2,ac2,cheque,01-Dec-2009,789,772,984;
p3,ac3,cheque,01-Dec-2009,433,941,200;
p4,ac4,cheque,02-Dec-2009,199,900;
( row values are separated by commas )
ii.e Row No. 3 has a payment value of 433,941,200, so splitting them into 100 million blocks will need to create the following separate payments:
100,000,000
100,000,000
100,000,000
100,000,000
33,941,200
and will be inserted into the same table having different paymentID's. Is there anyway of solving the via SQL?
Regards,
Edited by: _hifni on Dec 17, 2009 2:42 PMHi,
You can do that by joining your table to a Counter Table that counts from 1 to the greatest number of checks needed.
This should give you some ideas:
VARIABLE MaxPerCheck NUMBER
EXEC :MaxPerCheck := 1e8;
WITH cntr AS
SELECT LEVEL AS n
, (LEVEL - 1) * :MaxPerCheck AS LowAmount
FROM dual
CONNECT BY LEVEL <= CEIL ( ( SELECT MAX (PaymentValue)
FROM table_x
/ :MaxPerCheck
SELECT x.PaymentID
, x.PaymentValue
, c.n
, LEAST ( x.PaymentValue - c.LowAmount
, :MaxPerCheck
) AS CheckAmount
FROM table_x x
JOIN cntr c ON x.PaymentValue > c.LowAmount
ORDER BY x.PaymentID
, c.n
;if you'd like to post CREATE TABLE and INSERT statements for your sample data, then I could test this. -
Calculated value from multiple rows in selection set
Consider this query
SELECT WELL.UWI
FROM geo_formation A, WELL
WHERE ( (select min(top_depth)
from geo_formation B
where B.uwi = A.uwi
and form_id = 'WDBD' )
(select min(top_depth)
from geo_formation C
where C.uwi = A.uwi
and form_id = 'VKNS' )
) > 10
AND A.uwi = WELL.UWI
AND A.FORM_ID IN ('WDBD','VKNS')
ORDER BY WELL.UWI, A.FORM_ID
The question asked by the query is
Show me all the entities (entities are identified by WELL.UWI)
where the distance between the geological formations (identified by WDBD and VKNS)
is greater than 10
The distance in question of course is calculated in the
(select min(top_depth)
from geo_formation B
where B.uwi = A.uwi
and form_id = 'WDBD' )
(select min(top_depth)
from geo_formation C
where C.uwi = A.uwi
and form_id = 'VKNS' )
portion of the where clause.
** My question:
Is there any way to get this calculated value to be part of the selection list
ie.
SELECT WELL.UWI, 'the calculated value in question'
FROM geo_formation A, WELL ...Thanks Barbara; once again your solution to one of my problems works like a charm.
On top of that, I learned something important; I did not know that one can essentially achieve the same results as creating a temporary table by including the appropriate (select ...) in the from clause.
Thanks again.
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Barbara Boehmer ([email protected]):
SELECT a.uwi, (bmin - cmin) distance
FROM well a,
(SELECT uwi, MIN (top_depth) bmin
FROM geo_formation
WHERE form_id = 'WDBD'
GROUP BY uwi) b,
(SELECT uwi, MIN (top_depth) cmin
FROM geo_formation
WHERE form_id = 'VKNS'
GROUP BY uwi) c
WHERE b.uwi = a.uwi
AND c.uwi = a.uwi
AND bmin - cmin > 10
ORDER BY a.uwi
/<HR></BLOCKQUOTE>
null -
Finding the minimum value across multiple rows (not in a single column)
Hello,
I am running some ad-hoc SQL to test a website implementation of a spec. The ad-hoc sql gives me a set of date values for a specific widget (called a Task). I need to find the Minimum of either (Task.EndDate + 1 year) or the MAX date from the list
of other dates. I can easily get all of these dates, and compare them visually, but I'm not sure how to make SQL give me just the single value that I want. In the image below, you can see the results. The blue cell is the value I should get if I were to retrieve
a single value.
select
[EndDate+12Mo] = DATEADD(year,1,t.EndDate)
, [TaskEdit] = t.EditTS
, [ResearchEdit] = (select x.editts from Research x where t.researchid = x.researchid)
, [DeliverableEdit] = (select max(x.EditTS) from Deliverable x where t.taskid = x.taskid)
, [RTPEdit] = (select max(x.EditTS) from ResTaskParticipant x where (t.taskid = x.taskid and t.researchid = x.researchid) or (t.researchid = x.researchid and x.TaskID is null) )
, [RelatedTaskEdit] = (select max(x.EditTS) from Task_Related x where t.taskid = x.Task1ID or t.TaskID = x.Task2ID)
, [CrosscutEdit] = (select max(x.EditTS) from Task_Crosscut x where t.taskid = x.taskid)
, [TaskFundingEdit]= (select max(x.EditTS) from TaskFunding x where t.taskID = x.taskID)
, [ContractFundingEdit]= (select max(x.EditTS) from TaskFunding x inner join ContractFunding y on x.ContractFundingID = y.ContractFundingID where t.taskID = x.taskID)
from task t
where
t.tasknumber =
'2123.001'
Thanks!
JenniferSounds like this to me
select CASE WHEN [EndDate+12Mo] < MAX(dt) THEN [EndDate+12Mo] ELSE MAX(dt) END AS YourDateValue
from
SELECT [EndDate+12Mo],dt
from
select
[EndDate+12Mo] = DATEADD(year,1,t.EndDate)
, [TaskEdit] = t.EditTS
, [ResearchEdit] = (select x.editts from Research x where t.researchid = x.researchid)
, [DeliverableEdit] = (select max(x.EditTS) from Deliverable x where t.taskid = x.taskid)
, [RTPEdit] = (select max(x.EditTS) from ResTaskParticipant x where (t.taskid = x.taskid and t.researchid = x.researchid) or (t.researchid = x.researchid and x.TaskID is null) )
, [RelatedTaskEdit] = (select max(x.EditTS) from Task_Related x where t.taskid = x.Task1ID or t.TaskID = x.Task2ID)
, [CrosscutEdit] = (select max(x.EditTS) from Task_Crosscut x where t.taskid = x.taskid)
, [TaskFundingEdit]= (select max(x.EditTS) from TaskFunding x where t.taskID = x.taskID)
, [ContractFundingEdit]= (select max(x.EditTS) from TaskFunding x inner JOINContractFunding y on x.ContractFundingID = y.ContractFundingID where t.taskID = x.taskID)
from task t
where
t.tasknumber =
'2123.001'
)t1
UNPIVOT(dt FOR cat IN ([TaskEdit]
, [ResearchEdit]
, [DeliverableEdit]
, [RTPEdit]
, [RelatedTaskEdit]
, [CrosscutEdit]
, [TaskFundingEdit]
, [ContractFundingEdit]))u
)r
GROUP BY [EndDate+12Mo]
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Parsing csv values into multiple rows ( URGENT )
Hi All,
I am having source table with below listed data set.
EMPID ADD
101 Chennai,Tamilnadu,India
102 Delhi,India
103 6th Street,Downst,CY,USA
I need to create a View with below data format
EMPID ADD
101 Chennai
101 Tamilnadu
101 India
102 Delhi
102 India
103 6th Street
103 Downst
103 CY
103 USA
I need SQL query ....as I dont have previllages to create PL/SQL :-(
Please help me in this reagrd..
Thanks in advance...
Regards,
Shivauser11938787 wrote:
Hi...
above links deals with how to handle csv files using SQL SERVER...
I need to know about Oracle only...
I knew that the link is for SQL Server but i think you don't need to know about Oracle only, you need to know about how to do it only, I mean the logic.
Once you get the logic, it's quite simple to adapt it to Oracle.
WITH tally AS ( SELECT LEVEL AS ID
FROM dual
CONNECT BY LEVEL <= 4000
emp AS (
SELECT 101 AS EMPID, 'Chennai,Tamilnadu,India' AS AD FROM dual
UNION ALL
SELECT 102 AS EMPID, 'Delhi,India' AS AD FROM dual
UNION ALL
SELECT 103 AS EMPID, '6th Street,Downst,CY,USA' AS AD FROM dual
SELECT EMPID, AD
FROM (
SELECT EMPID
,NULLIF(substr(',' || AD || ',' , ID , instr(',' || AD || ',' , ',' , ID) - ID) , '') AS AD
,ID
FROM Tally
,emp
WHERE ID <= length(',' || AD || ',') AND substr(',' || AD || ',' , ID - 1, 1) = ','
AND instr(',' || AD || ',', ',' , ID) - ID > 0
ORDER BY EMPID, ID
)Regards...
Maybe you are looking for
-
While doing down payment request with PO (F-47)
Hi, While doing Downpayment Request (Capital Vendors) with reference PO the system is showing below error. Contact your system administrator (table error) Message no. AA866 Diagnosis No account has been entered for posting down payments in area 01 un
-
I have a late 2008 13 inch aluminum macbook and want to purchase an iMac computer or apple display to use as an external display for it while I'm at my desk. I can afford up to $700 for sure, maybe up to $1000 and would like one that has built in cam
-
Calling subtemplate in standalone BIP
Hi, I've created one main template and two subtemplate. All template have different dataset. I want to print that sub template in separate page based on condition. like Page1-Main template Page2-Subtemplate1(if condition=true) conditon is related to
-
Regarding description of Infoobjects in Reports
Hai I created the InfoObjects by giving the Length and its description . But when I create the Reports then I didnt get the description of InfoObjects Fully . Why it is like that and what I have to do ??? Is there any limit for textual description o
-
Unwanted contact request on Samsung note
Hello everyone, Can someone please help me with Skype on samsung note. I keep getting unwanted contact request. I don't see deny button or what to do with my skype on samsung. thanks. Florence