473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Procedure - Dates Between

I need to make a table (tabel B) using table A. THANKS!

My current table
MBR_SID MinD MaxD
A 1/1/2008 1/10/2008

I need a table like this

mbr day
A 1/1/2008
A 1/2/2008
A 1/3/2008


I have a start --

CREATE OR REPLACE PROCEDURE PNMI_DAY AS

-- Declare Local Variable

StartDate DATE;
EndDate DATE;
CurrentDate DATE;

AdDate DATE; ---this is the bumping date...



BEGIN

StartDate := '01-JAN-2007'; -- Format (MM/DD/YYYY)
EndDate := '31-DEC-2007';
CurrentDate := StartDate;

EXECUTE IMMEDIATE 'TRUNCATE TABLE PNMI_DAYS';

WHILE CurrentDate <= EndDate

LOOP

INSERT INTO PNMI_DAYS (MBR_SID, DAYS)
SELECT DISTINCT MBR_SID,
TO_CHAR(MIND,'MM/DD/YYYY')
FROM PNMI_MBR
WHERE MBR_SID = 31500
AND MIND <= CurrentDate
AND MAXD >= CurrentDate;


CurrentDate := CurrentDate+ 1;


END LOOP;
END Pnmi_Day ;

/
Sep 29 '08 #1
2 1566
r035198x
13,262 8TB
Why not use the create table as select ... statement instead?
Sep 30 '08 #2
debasisdas
8,127 Expert 4TB
just do as suggested in the previous reply. there is no use writing a procedure just to create a table.
Oct 2 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Milo Woodward | last post by:
I have some columns of data in SQL server that are of NVARCHAR(420) format but they are dates. The dates are in DD/MM/YY format. I want to be able to convert them to our accounting system format...
3
by: Jim Armstrong | last post by:
Hello all, I have a database with trade information. I have written a stored procedure (code at end of post) which pulls trades from a range of dates. There is a field called "Match ID" which is...
1
by: bradleyc | last post by:
How would you calculate the difference between two dates?
13
by: Marcin Wasilewski | last post by:
Hi, How to call procedure, which is on SQL Server from Access using visual basic? Thanks, mw
2
by: satish | last post by:
hi, i am a learner of ms -sql server 2000, i had a doubt in stored procedures suppose i have a data base having 20 tables, all the tables have a column named--DATE can we write a store...
1
by: brianlanning | last post by:
We have a stored procedure that we've tried with two slightly different designs. It needs to take a 30 day date range and return a result set. Design 1 takes one date as a parameter. The other...
0
by: stavo23 | last post by:
I am using SQL Server 2000, and I want to write a stored procedure that returns certain values either between 2 dates (start and end) or the user enters a particular string. Its grafts a bit , but...
1
by: hussain123 | last post by:
Hi All, I am invoking a procedure which takes 2 IN parameters and both are dates which are passed as string.In the procedure I am using those 2 IN parameters to query the db and fetch record between...
3
by: hussain123 | last post by:
Hi All, I am invoking a procedure which takes 2 IN parameters and both are dates which are passed as string.In the procedure I am using those 2 IN parameters to query the db and fetch record between...
3
by: Constantine AI | last post by:
Hi we have created a stored procedure to check the dates entered into a lease table does not overlap dates already stored for a lease. However when inserting overlapping lease dates, it allows us to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.