Stored procedure cursor

example: At present, there are three tables A, B and C. among them, A and B are one to many relationships, and B and C are one to many relationships. Now it is necessary to save the primary key of table A in B into C; The general idea is to query out B and update table C with an update statement, bu ...

Added by bobicles2 on Tue, 16 Jun 2020 10:41:40 +0300

oracle uses stored procedures for row to column conversion (executing dynamic SQL statements)

---------------------------------------------------------------Table building----------------Determine whether the student table exists declare num number; --Declare parameters num type number begin --start select count(1) into num from user_tables where table_name='student'; if num>0 then execute immediate 'drop table st ...

Added by crinkle on Thu, 21 May 2020 18:21:15 +0300

Issue 04: column CHECK constraint

check constraint means to filter one or more columns according to certain preset rules. If the condition is true, the filtering succeeds; if the condition is false, the filtering fails and the failure code is returned to the client. Why do you want to list and write this separately? You often encounter irregular SQL. In many cases, you can onl ...

Added by AndyB on Wed, 13 May 2020 12:25:22 +0300

[2020Python cultivation] MySQL view, trigger, transaction, stored procedure and function

[contents] (the rest are knowledge) A view Two triggers Three Affairs (mastery) Four stored procedures Five functions Vi. process control 7, Index theory   1, View 1. What is a view A view is a virtual table (non real existence). Its essence is to get a dynamic data set according to SQL statements and name it. When users use it, they only ne ...

Added by csplrj on Fri, 08 May 2020 11:46:25 +0300

On the limitation of SQL SERVER stored procedure hierarchy

Now I want to write a SQL stored procedure, which is mainly to determine whether the current two weeks are working hours every day, and then I will have a database table of my own for corresponding update operation to output the work calendar that conforms to my company. The problem encountered now is that the trigger format is ...

Added by drax007 on Sun, 05 Jan 2020 13:14:04 +0200

Get every day, week, month and year according to the start and end date of sql statement

Background: in many statistical reports, you need to enter start and end dates to query data according to different time units, and the displayed column names are your dynamic time units. Your table data is saved by the day, so you may need to do some sql functions or stored procedures to implement it. 1. Get each day in the r ...

Added by n1tr0b on Fri, 03 Jan 2020 18:40:00 +0200

Oracle regularly grabs Excel (csv format) data and writes it to database table

Oracle access to files requires UTL file, which is an Oracle built-in package. Permissions need to be granted: Create directory TEMP as' d: / test '; -- create directory and authorize. TEMP is the given path name Grant read, write on directory temp to ctmpmart? WF; -- grant permission to read and write directory Grant execut ...

Added by Static Cling on Tue, 31 Dec 2019 15:31:40 +0200

Cursor stored procedure view label

CREATE TABLE STUDENT ( SID INT PRIMARY KEY IDENTITY, SNAME NVARCHAR(50), SAGE DATETIME, SSEX CHAR(4) ) CREATE TABLE TEACHER ( TID INT PRIMARY KEY IDENTITY, TNAME NVARCHAR(50) ) CREATE TABLE COURSE ( CID INT PRIMARY KEY IDENTITY, CNAME NVARCHAR(50), TID INT FOREIGN KEY REFERENCES TEACHER(TID) ) CREATE TABLE SCORE ( ID ...

Added by broseph on Sun, 29 Dec 2019 22:18:25 +0200

MySQL big data table horizontal partition optimization

Change the large running table to a partitioned table The code of this article is limited to monthly horizontal partition based on data time. Other requirements can be implemented by modifying the code 1. Create a partition table The table field of this table is the same as that of the original table, with partition CREATE TABLE `metric_data_tm ...

Added by CrimsonSoul on Tue, 03 Dec 2019 04:40:27 +0200

. net mvc + Dapper instance

brief introduction This article is a learning instance of. net mvc + Dapper. There is a link to the source code of the instance. Why write this article Because I don't like EF's bloated and Linq's awkward, I used my own lightweight orm in previous projects. In thinking about and drawing on other ORM frameworks, Dapper found ...

Added by SteveFrost on Tue, 26 Nov 2019 22:15:59 +0200