I try to get Minimum and Maximum Values for columns/tables with names are in a table. Table name is CAMPOS_DATE and TABLE_NAME, COLUMN_NAME have table and column names.
I try to get MIN and MAX values for columns and I have created next procesure -
CREATE OR REPLACE PROCEDURE "NA_PRC_MIN_MAX_DATES_CHM" IS
-
-
-- ------------------------------------------------------------------ --
-
-- Cursores --
-
-- ------------------------------------------------------------------ --
-
-
-
CURSOR cColumnas IS
-
SELECT
-
TABLE_NAME,
-
COLUMN_NAME
-
FROM CAMPOS_DATE;
-
-- ------------------------------------------------------------------ --
-
-- Variables --
-
-- ------------------------------------------------------------------ --
-
vdMinValue DATE;
-
vdMaxValue DATE;
-
-
BEGIN
-
-
FOR rcCol IN cColumnas LOOP
-
-
vdMinValue := NULL;
-
vdMaxValue := NULL;
-
SELECT MIN(rcCol.COLUMN_NAME), max(rcCol.COLUM_NAME)
-
INTO vdMinValue, vdMaxValue
-
FROM rcCol.TABLE_NAME;
-
-
UPDATE CAMPOS_DATE
-
SET MIN_VALUE = vdMinValue,
-
MAX_VALUE = vdMaxValue
-
WHERE TABLE_NAME = rcCol.TABLE_NAME
-
AND COLUMN_NAME = rcCol.COLUMN_NAME;
-
-
COMMIT;
-
-
END LOOP;
-
-
EXCEPTION
-
WHEN OTHERS THEN
-
ROLLBACK;
-
END;
-
/
-
It doesn´t work. What am I doing wrong?
Thanks in advance
0 2260 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: M Simpson |
last post by:
/* for the google index */
ALTER TABLE
DEFAULT COLUMN
DEFAULT VALUE
I've worked out several stored procedures for altering the default column
values in a table. They were compiled from books and code snippets found
here. It was a pain to work out so I've decided to share my work and
research here. This post is just my way of saying thanks to several others
here for posting with their wisdom and intelligence.
|
by: dixie |
last post by:
I have a table called "tblParticipants" with a field called "ID", which must
be indexed with No duplicates allowed. I am looking for a way of doing in
vba a small if ..then ..else .. routine that looks at that field in that
table and if it is not indexed, indexes it, and if it is indexed, jumps to a
label. I have a query called "qryAddIndex" that will index the field, what
I really need is the vba to test if the field is indexed or not.
...
|
by: rednexgfx_k |
last post by:
All,
Problem Summary: I've running about 30 make table queries via VBA in
Access 2000, and my database goes from 14,000k to over 2,000,000k. In
addition, the longer the procedure runs, the bigger the performance hit
VBA takes. I'm wondering how to prevent or reduce this.
Details: I have a database table of queries I want to run. This table
contains the query name, the SQL text of the query, the name of the
target table, and whether...
|
by: Chris Blue |
last post by:
When I am debugging this code and I step through it, after I run through to the cn.Close() statement, the table TABLENAME should be dropped...but it is not. Is there some other command I must run to "finalize" the SQL statement I just executed? Thank you
Chris
Dim cn As New ADODB.Connection
cn.Open("Driver={SQL Server};Server=SQLSERVER;Database=BIGDB;Trusted Connection=yes")
cn.CommandTimeout = 600
cn.Execute("IF EXISTS (SELECT...
|
by: Mike |
last post by:
Hi,
How can I pls get the maxvalue and the minvalue in a specific colunm in a
dataset or datareader.
thanks
--
Regads,
Rochdi
| |
by: technocrat |
last post by:
I wanted to know if i always have to use
1..load from /dev/null/ of del terminate into tablename nonrecoverable
or can i do something like
2...declare cur cursor for select * from tablename ...........( the
table which recently failed loading)
load from cur for cursor terminate into tablename ( the table which
failed loading )
|
by: smitashirole |
last post by:
can we create table with tablename as TABLE
eg. create table TABLE(no int ,name varchar(20));
like this.
|
by: Albin |
last post by:
Hi,
I have a html page where in the table spans for two pages
the first page's last row doesn end properly and the 2nd page's first row also isnt proper.The code i use is given below,the no of pages the table will spread over is dyanmically decided,
<html>
<head>
<style>
tHead
{
|
by: tvnaidu |
last post by:
database file gets created using below sql file, then lua script calls "db.import config_ascc", then I get errors says "insert table failed for eventLog", below are my sql file entry, config file, also import and saveTable function, any idea what is wrong, why I get error?. thanks in advance.
system.sql file
==========
CREATE TABLE eventLog
(
component text NOT NULL,
|
by: KarthikaKKD |
last post by:
Im passing table name & column name which im selecting from cursor.But its inserting correctly and also showing error like cursor is not open .
my proc is as:
CREATE OR REPLACE PROCEDURE TEST_BUILDINGCODE_PROC (IN v_AppId_Ver INTEGER)
BEGIN
DECLARE v_ObjId,v_LayerName,v_TableName,v_ColumnName varchar(30);
DECLARE v_CodeNo,v_DataCount integer;
DECLARE v_Statement,v_Schema,v_Counter varchar(200);
DECLARE v_stmt STATEMENT;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |