SQL & PL/SQL :: Generating Dates In A Table

Mar 1, 2010

I have emp table

Empno from_date to_date ScaleBonus_pct Salary
101 31/01/2010 14/02/2010Grade120,10,10,15,25,205000

Reqd. o/p

Emp nofrom_dateScaleEach_WeeK_Sal
10131/01/2010Grade11000(from 20 %X5000
1017/2/2010Grade1500(from 10 %X5000
10114/02/2010Grade1500(from 10 % X5000
10121/02/2010Grade1750(from 15 % X5000
10128/10/2010Grade11250(from 25 % X5000
1017/2/2010Grade11000(from 20 % X5000

we have to split the date by 7 days,should be on Sunday...and if we split by 7 days we have upto 31/01,07/02 and 14/02...but we have to generate 6 days because 20,10,10,15,25,20 (since comma separated value is 6 ).

View 8 Replies


ADVERTISEMENT

XML DB :: Generating XML Data From A Table In XML Format

May 3, 2013

generating an xml file using the below data.Table name is T_Data having 4 columns as given below with some data.

Region Divison District Store
---------- ----------------------- ----------- -----------
Northwest Northern California San Jose SJStore1
Northwest Northern California San Jose SJStore2
Northwest Northern California North LA LAStore1
Northwest Northern California North LA LAStore2
Northwest Northern California North LA LAStore3

I want to generate an XML File using SQL/XML Functions and the XML File should look like as given below.

<Region>
<Region Name>Northwest</Region Name>
<Divison>
<Division Name> Northern California </Division Name>
<District>
[code]...

View 3 Replies View Related

Select Query With Four Table Its Generating Around 650 Rows?

Feb 20, 2013

i have a select query with four table its generating around 650 rows. and i need to update these 650 rows only.

for example

update ps_po_lining b
set y.recv_req = 'N'
where recv_req in

[Code]....

this query runs but its updating 6000 rows. which is not right. we need to update what ever the select query is retrieving.

View 5 Replies View Related

JDeveloper, Java & XML :: Generating Document That Include Fields Provided In Table

Nov 27, 2011

I need to generate a document that include fields provided in following.

CREATE TABLE t
(x_customer_po VARCHAR2(20 BYTE),
x_accessory_code VARCHAR2(3 BYTE),
x_install_loc HAR(3 BYTE));
INSERT INTO apps.T
VALUES('N45882','D0C','MFG');
INSERT INTO apps.T

[code]...

How can I get the output as formated XML?

--output:

<OrderAcknowledgments><Sender ID="999999999" Name="Cars"></Sender><DateTime>2011-11-27T22:00:14.3</DateTime><Acknowledgments><Acknowledgment><Vehicle><CustomerPONum>N45882 </CustomerPONum><Options><Option><Code>D0C</Code><InstallLocation>MFG</InstallLocation></Option><Option><Code>R0B</Code> <InstallLocation>MFG</InstallLocation></Option><Option><Code>LK2</Code><InstallLocation>MFG</InstallLocation></Option><Option ><Code>K0B</Code><InstallLocation>MFG</InstallLocation></Option></Options></Vehicle></Acknowledgment><Acknowledgment><Vehicle ><CustomerPONum>N45883</CustomerPONum>

[code]...

View 5 Replies View Related

Inserting Dates Into Table

Mar 10, 2012

My homework requires me to create a booking table for a hotel and I have created the table but I'm having trouble inserting the dates.

This is my table:

DROP TABLE BookingDM CASCADE CONSTRAINTS PURGE;
CREATE TABLE BookingDM (
hNo NUMBER(3),
gNo NUMBER(5),
dFrom DATE NOT NULL,
[code]......

This is the first set I'm attempting to insert
hNo = 148
gNo = 11169
dFrom = 09/03/2009
dTo = 09/10/2009
rNo = 202

This is my attempt to insert the set:

SQL> INSERT INTO BookingDM VALUES('148', '11169', '09/03/2009', '09/10/2009', '202');
INSERT INTO BookingDM VALUES('148', '11169', '09/03/2009', '09/10/2009', '202')
*
ERROR at line 1:
ORA-01843: not a valid month

I need my dates to be in the format "MM/DD/YYYY".

View 4 Replies View Related

SQL & PL/SQL :: Delete From A Table With Between Dates

Dec 7, 2011

I am trying to schedule a store procedure and wanted to remove some data from a table starting from a date and increase the delete by day until a specified date. I wrote the below function; but i can't get to work.

--Start
CREATE OR REPLACE FUNCTION remove_DateField return VARCHAR2 IS

i PLS_INTEGER;
startdate Date ;
endDate Date;
currentDate Date;
stopDate Date;
[code]....

View 8 Replies View Related

Finding Individual Dates Having Dates Plus 2 Days

Jan 26, 2011

I want to find the dates which have a date plus with in 2 days after this date. I mean group by 3 days each even the date i missing between two days. Actualy I want to find the start date where the employ was missing on job.

Basic concept is employes have allowed to use 10 personal leaves of a year. Each leave can be use for maximum 3 days.

If employ did not come on the job for one day or two days or three days, it shoul be count as ONE personal leave. And If employ is missing at job for four or five days, it should be count as 2 personal leaves.

seq date
------------------------------
101.01.10

205.01.10
306.01.10

410.01.10
512.01.10

613.01.10
714.01.10
815.01.10

916.01.10
1018.01.10

1119.01.10
1220.01.10
1321.01.10

1423.01.10

1526.01.10
1627.01.10

1729.01.10
1831.01.10

The result should be (Don't use Pl/Sql)

seq date
------------------------------
101.01.10
205.01.10
310.01.10
413.01.10
516.01.10
619.01.10
723.01.10
826.01.10
929.01.10

After finding these days I want to select the starting date of 5th personal leave. (which is 16.01.10).

I am not a expert of using SQL, but I think it could be possible with using partitioning a table on the givin reslult and further partition the reslut on rownum() as rn and the using case statement where rn = 5.

View 2 Replies View Related

SQL & PL/SQL :: Split A Date Into New Dates According To Black Out Dates?

Mar 10, 2011

Split a date into new dates according to black out dates!

Here is my tables:

CREATE TABLE travel
(
start_date,
end_date
)
AS
SELECT DATE '0000-01-01', DATE '9999-12-31' FROM DUAL;

[code]....

I have lets say a "travel date" and black out dates. I will split the travel date into pieces according to the black out dates.

Note: Travel Date can be between 0000-01-01 - 9999 12 31

Sample:

Travel Date:

Travel | START DATE | END DATE
T | 2011 01 04 | 2011 12 11

Black Out Dates:

BO | START DATE | END DATE
A | 2010 11 01 | 2011 02 11
B | 2011 01 20 | 2011 02 15
C | 2011 03 13 | 2011 04 10
D | 2011 03 20 | 2011 06 29

Excepted Result:

New Travel | START DATE | END DATE
X1 | 2011 02 16 | 2011 03 12
X2 | 2011 06 30 | 2011 12 11

Visually:

Travel Date : -----[--------------------------]--

A : --[------]-------------------------
B : ------[---]------------------------
C : --------------[---]----------------
D : ----------------[------]-----------

Result :

X1 : -----------[--]--------------------
X2 : -----------------------[--------]--

Sample 2:

Travel Date : -[--------------------------------]--

BO Date A : ----[------]-------------------------
BO Date B : -------------------------[---]-------
BO Date C : ----------------[---]----------------
BO Date D : ------------------[------]-----------

Result X1 : -[-]-------------------------------
Result X2 : -----------[--]--------------------
Result X3 : -----------------------------[--]--

How can I do it using PL SQL ?

View 5 Replies View Related

SQL & PL/SQL :: Select Date Values From A Table Between Two Dates?

Feb 16, 2010

Oracle 10g

In a table I have a column update_date and its type is DATE. Sample values from this column are as follows. I am using the following query to select all update_date lie between sysdate and sysdate-90.

select update_date from table1
where update_date between sysdate and sysdate-90

The above query retrun no data even data is there in the table for this range.

Update_date

11-FEB-10
08-FEB-10
08-FEB-10
08-FEB-10
08-FEB-10

[code]...

View 7 Replies View Related

SQL & PL/SQL :: Delete Last N Sets Of Rows Of A Table With Same Dates In Sort Field

Mar 15, 2013

I know how to select the last N sets of rows, using DENSE_RANK - where multiple rows have the same timestamp but I want to only select those rows which do NOT have the top 2 unique timestamps.

i.e.:

SELECT *
FROM ( SELECT DENSE_RANK() OVER (ORDER BY myTimestamp DESC) DENSE_RANK, HISTORYID, USER_ID, myTimestamp, STATUS, FROM TXN_HIST)
WHERE DENSE_RANK > 2 order by myTimestamp DESC, HISTORYID, USER_ID;

But how do I DELETE these same rows?

View 3 Replies View Related

Select All Dates Between Two Dates

Oct 22, 2003

How can I select all of the dates between two dates? For example, given the start date 12/2/2003 and the end date 12/5/2003 I want to return:

12/2/2003
12/3/2003
12/4/2003
12/5/2003

Is there a built in function for this? Is there a way for a function to return multiple rows? It has to be a function because I need to use it within other SQL statements.

View 14 Replies View Related

Generating XML Using SQL Query?

Oct 13, 2011

I am facing the following issue while generating xml using a sql query. I get the below given table using a query.

CODE ID MARK
==================================
1 4 2331 809
2 4 1772 802
3 4 2331 845
4 5 2331 804
5 5 2331 800
6 5 2210 801

I need to generate the below given xml using a query

<data>
<CODE>4</CODE>
<IDS>
<ID>2331</ID>
<ID>1772</ID>
</IDS>
<MARKS>

[code].....

NOTe: IDS which are distinct needs to be displayed. ALL MARKS should be displayed though there are duplicates.

View 1 Replies View Related

SQL & PL/SQL :: Generating A Key For Grouping?

Mar 27, 2013

In the below data, a container is moving from one city to another. 1,2 ,3 can be any number which i want to generate and use as keys to group the cities. Eg: AUH, JEB, CIW belong to the same key=2; SIN, IKT belong to a new group 4. The City where difference between the Seq# is greater than 1 (eg between S8W and AUH), a new group starts.

Conotainer #CitySeqI want this
-------------------------------------------
Container1S8W5251
Container1S8W5261
Container1AUH5362
Container1AUH5372
Container1JEB5382
Container1JEB5392

[code]....

View 4 Replies View Related

SQL & PL/SQL :: Generating XML From Procedure?

Mar 11, 2012

Below is the procedure I created to generate csv file from oracle procedure.

PROCEDURE proc_csv(p_path varchar2 , p_separator varchar2 default ',')
AS
CURSOR c_data
IS
select * FROM product ;
v_file UTL_FILE.file_type;
BEGIN

[code]...

I have two doubts about this procedures

1) In one schema this procedure is generating empty csv file with zero bytes, while in other schem It's working fine, It's showing data. I am unable to make what's the difference.

2) The csv file is not displaying column headings. I want column headings to be displayed on csv file.

View 4 Replies View Related

PL/SQL :: Generating XML In Query

Sep 11, 2012

Im generating some xml from a table which works fine. Here is an example of what I'm doing.

Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product

create table "VTEST"(
"PROJECT_NUMBER" VARCHAR2(50 BYTE),
"ORDER_NUMBER" VARCHAR2(50 BYTE),
"PART_NUMBER" VARCHAR2(50 BYTE),
[code]....

so each section would list its unique values.

View 3 Replies View Related

Generating Schema From XSD Files?

Jul 7, 2010

generating oracle table definitions from XML .xsd files?

View 5 Replies View Related

SQL & PL/SQL :: Generating Weekly Report

Apr 1, 2013

I know I am using a outdated Oracle what to do my company are not willing to upgrade because of the economic situtation.

I need generating weekly report.

I have a condition for monthly like this

invoice_date BETWEEN TO_DATE('01-JAN-13 00:00:00', 'dd-mon-yy hh24:mi:ss')
AND TO_DATE('31-JAN-13 23:59:59', 'dd-mon-yy hh24:mi:ss')

now if I want a weekly report Monday - Saturday, How to go about it?

View 2 Replies View Related

SQL & PL/SQL :: Generating Unique Code

Jun 27, 2011

I have data like this:

a1 a2 a3 a4
ABC ABC xx zz
ABC xx mm mm
fg ui ok pl

I want to give them unique codes like :

Code for column
a1 Code1
ABCC-1
ABCC-1
fg C-2

then column
a2 Code2
ABC C-1
xxC-3
uiC-4

then column
a3 Code3
xxC-3
mmC-5
okC-6

then column
a4 Code4
zzC-7
mmC-5
plC-8

I can add these `columns in the table Code1 , Code2 etc columns to update.

View 1 Replies View Related

ODI Invoke Is Not Generating XML Properly

Feb 5, 2013

In weblogic server Axis2 is deployed and it is showing Active.And we have uploaded ODI invoke service also in AXIS2 succesfully and it is showing Active status also...By using the soap its generating the XML with below mentioned error..

some info:- We rae using ODI 10g.
Weblogic 10.3.5.0

XML GENERATING:--_

<xs:element name="inPhasesUptoAndIncludingPostDispatch" nillable="true" type="xs:anyType" />
<xs:element name="key" nillable="true" type="xs:anyType" />
<xs:element name="localPolicyAssertions" nillable="true" type="xs:anyType" />

[code]...

The XML page cannot be displayed Cannot view XML input using XSL style sheet. correct the error and then click the Refresh button, or try again later.

The operation completed successfully. Error processing resource [URL]

</xs:schema></wsdl:types><wsdl:message name="invokeScenarioMessage"><wsdl:part name="part1" element="ns...

View 2 Replies View Related

Generating XSDs From Oracle Tables

Oct 2, 2012

Is there any API to generate XSDs from Oracle tables? DBMS_XMLSCHEMA.GENERATESCHEMA accepts only Types and not the Table names. I want to generate XSD from the tables including length, null and default validations.

View 6 Replies View Related

SQL & PL/SQL :: Oracle - Generating Combination Of Numbers?

Oct 25, 2010

I have to write a stored procedure/function which has to generate the combination of numbers
For eg: IF I/p is an array of numbers a(i) = [1,2,3]

I want to get various combinations of numbers with these three digits.

writing the stored procedure generating the output for this

View 18 Replies View Related

JDeveloper, Java & XML :: Generating XML From XSD At Runtime?

Aug 13, 2012

I Have got a requirement where we have to generate an xml conforming to a particular XSD.

What i will be having already in place is an XSD document.

We are thinking of making a procedure which will be recieving the set of inputs required for creating that xml.(Data content of that XML.)We would have to make the XML according to that XSD.

Everytime Parsing the XSD is not feasible.We are looking at a solution which would be easy to make the xml from xsd at runtime.These values (DATA) will be available at run time.

View 7 Replies View Related

SQL & PL/SQL :: How To Exclude Value From Random Generating Function

Jun 25, 2011

I am in urgent need of Generating Random numbers for one of the application .The number once generated is getting stored in table

For this purpose i am using Oracle In-Built function

Quote:Select round(dbms_random.value(1,30)) into a from dual;

Problem is :How to eliminate those numbers to generate which are already stored in Table.

View 6 Replies View Related

SQL & PL/SQL :: Generating (time Taken) Data At Row Level?

May 1, 2013

I have a requirement where i have data spread in rows which i have to pivot kind off operation to find the time taken using a Log table.

below is the existing data is present.

col0 col1 col2 col3 col4
30003695/1/2013 8:41Batch Startedproc_unalloc1345
30003705/1/2013 8:41blah proc_unalloc1345
30003715/1/2013 8:46blah proc_unalloc1345
30003725/1/2013 8:46blah proc_unalloc1345
30003735/1/2013 8:56blah proc_unalloc1345
30003745/1/2013 8:57Unalloc Endedproc_unalloc1345

[code].....

Below is what I am trying to find from the above data.

col1Unalloc Alloc Metric
13450.16 1.07 1.3

the result is Hours.Minutes.

I am trying to minus the two dates and find the time taken for a particular section( eg, unalloc ).

I tried using three union queries .

Select block,timestamp From (
Select 'Unalloc' As Block ,col1,col4 From table_1
Where col2 = 'Batch Started' And col3 = 'proc_unalloc' And
Parms Like '1345'
Union
Select 'Unalloc' As Block ,col1,col4 From table_1
Where col2 = 'Unalloc Ended' And col3 = 'proc_unalloc' And

[code].....

I will minus the start and end time for unalloc to get time taken for un alloc. Then i will minus end time of unalloc and end time for alloc to get time taken for alloc... like wise for metric.

View 6 Replies View Related

Generating MD5 If There Are Any Special Characters In The CLOB

Nov 30, 2012

We are using dbms_crypto.hash to generate the MD5 hash value for a CLOB that will be sent to other feeder systems. The feeder systems validate the file by generating the MD5 hash value on their end and compare with the MD5 generated in Oracle and accept the file only if the MD5 hash value matches.

The MD5 file matches between both the systems except in the case where there are special characters in the CLOB. Somehow, MD5 is prefixing  character before any special character and calculating the MD5 value. In our case, our special characters being ®, §, ™, ©....

This is a high priority issue for us and it is holding our UAT. We are using Oracle 11.2.0.2.0.

View 1 Replies View Related

Server Administration :: SQL For Generating Roles

Dec 18, 2012

I am looking for the below one.SQL for generating roles needs to be spooled by automated script.

View 4 Replies View Related

Generating Script For Roles For Schema Import?

May 19, 2011

I want to import schema1 from sourcedb to targetdb. For this I need to generate create sripts and grant scripts for roles related to schema. For example schema1 has role1; rol1 has rol2; rol2 has rol3 and some system privileges and object privileges. How can I generate this script from sourcedb?

View 1 Replies View Related

Server Administration :: Archive Log File Generating?

Jan 10, 2011

I want to know how many archive log generating in One hour at the peak time. We have 6 nodes RAC multiplex 2.

Is there are any query through which I can achieve the above purpose.

Note: As this is a prod instance client is not happy to implement Log Miner utility.

View 9 Replies View Related

Client Tools :: Generating Tkprof From SQL Developer

May 8, 2013

How do i get tkprof trace file in sqldeveloper tool ? I donot have access sql in command mode.

View 5 Replies View Related

Forms :: Generating Sequence - Get Serial Number?

Dec 21, 2011

i want to get serial numbers in oracle forms. i have one data block with 10 rows and a non database display item with corresponding length as that of the original data block .

when ever i am executing the form i want to see the serial number generated in the display item and when i inserted a new item or row it should show the corresponding rownum.

eg:

empno name serialno
5 tom 1
4 tinil 2
6 sofy 3
7 john 4
1 albert 5
2 michel 6

i want to get the above answer using forms.

View 7 Replies View Related







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