blob_id stringlengths 40 40 | language stringclasses 1
value | repo_name stringlengths 5 133 | path stringlengths 3 276 | src_encoding stringclasses 33
values | length_bytes int64 23 9.61M | score float64 2.52 5.28 | int_score int64 3 5 | detected_licenses listlengths 0 44 | license_type stringclasses 2
values | text stringlengths 23 9.43M | download_success bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|
129cbb0d27b543d4b74086f579e69ff9c836d76d | SQL | DefJia/Bus-100 | /SQL/init.sql | UTF-8 | 636 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | create table `main`(
`id` int(3) primary key auto_increment,
`time` timestamp NOT NULL,
`num` varchar(8),
`stop` varchar(10),
`comment` varchar(50),
`latitude` decimal(10,6),
`longitude` decimal(10,6)
)ENGINE=InnoDB charset=utf8;
create table `rule`(
`id` int(3) primary key auto_increment,
`time` timestamp NOT NULL,
`rule` varchar(100) NOT NULL
)ENGINE=InnoDB charset=utf8;
ALTER TABLE `main` ADD `lon_` DECIMAL(10) NOT NULL AFTER `latitude`, ADD `lat_` DECIMAL(10) NOT NULL AFTER `lon_`;
create TABLE `map`(
`id` int(3) primary key auto_increment,
`lon_` decimal(10,6),
`lat_` decimal(10,6)
) | true |
e374fa76722273801de8d15d0c38e4a3a842ea1d | SQL | maduhu/MARLO-CIAT | /marlo-ciat/marlo-ciat-web/src/main/resources/database/migrations/V1_0_0_20170314_1551__deliverableDocuments.sql | UTF-8 | 667 | 3.03125 | 3 | [] | no_license | CREATE TABLE `deliverable_documents` (
`id` bigint(20) NOT NULL AUTO_INCREMENT ,
`deliverable_id` bigint(20) NOT NULL ,
`link` text NULL ,
`is_active` tinyint(1) NOT NULL ,
`created_by` bigint(20) NULL ,
`modified_by` bigint(20) NULL ,
`active_since` timestamp NULL ,
`modification_justification` text NULL ,
PRIMARY KEY (`id`),
CONSTRAINT `deliverable_documents_deliverable_id_fk` FOREIGN KEY (`deliverable_id`) REFERENCES `deliverables` (`id`),
CONSTRAINT `deliverable_documents_created_id_fk` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`),
CONSTRAINT `deliverable_documents_modified_id_fk` FOREIGN KEY (`modified_by`) REFERENCES `users` (`id`)
)
;
| true |
d5ad5c29c205199e2d8cd8af90d5256783b4d992 | SQL | Frozzeg/Pyha-Forum-Engine | /dump.sql | UTF-8 | 690 | 3.046875 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`role` varchar(255) NOT NULL DEFAULT 'user',
`name` varchar(255) NOT NULL,
`surname` varchar(255) NOT NULL,
`gender` int(11) NOT NULL DEFAULT '1',
`country` int(11) NOT NULL,
`city` int(11) NOT NULL,
`registration_date` datetime NOT NULL,
`timezone` varchar(255) NOT NULL DEFAULT 'Europe/Moscow',
`password` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `email` (`email`),
KEY `gender` (`gender`),
KEY `born_date` (`registration_date`),
KEY `country` (`country`),
KEY `city` (`city`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; | true |
a672b07d677bc7211389987b5f716544f9a5ff2c | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/low/day27/select2144.sql | UTF-8 | 262 | 2.921875 | 3 | [] | no_license |
SELECT sen.name
FROM SENSOR sen, SENSOR_TYPE st, COVERAGE_INFRASTRUCTURE ci
WHERE sen.SENSOR_TYPE_ID=st.id AND st.name='WeMo' AND sen.id=ci.SENSOR_ID AND ci.INFRASTRUCTURE_ID=ANY(array['4209','6034','5234','4206','2052','5082','5219','3044','3089','5100_2'])
| true |
68097e987f2262c6b01bf0a78ed7bf7e8fa3f7e0 | SQL | abhinavms/Grievance-Cell | /DB/grv.sql | UTF-8 | 3,168 | 2.6875 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.1.32-MariaDB - mariadb.org binary distribution
-- Server OS: Win32
-- HeidiSQL Version: 9.5.0.5196
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for grvnce
CREATE DATABASE IF NOT EXISTS `grvnce` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `grvnce`;
-- Dumping structure for table grvnce.grv
CREATE TABLE IF NOT EXISTS `grv` (
`slno` int(11) NOT NULL AUTO_INCREMENT,
`datetime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`userid` text NOT NULL,
`username` text NOT NULL,
`sub` text NOT NULL,
`description` longtext NOT NULL,
`done` int(11) NOT NULL,
`reply` longtext NOT NULL,
PRIMARY KEY (`slno`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
-- Dumping data for table grvnce.grv: ~16 rows (approximately)
/*!40000 ALTER TABLE `grv` DISABLE KEYS */;
INSERT INTO `grv` (`slno`, `datetime`, `userid`, `username`, `sub`, `description`, `done`, `reply`) VALUES
(1, '2018-07-26 00:00:00', '', '170163', 'Test', 'This is a test', 0, ''),
(2, '2018-07-26 00:00:00', '', '170163', 'Test', 'This is a test', 0, ''),
(3, '2018-07-26 00:00:00', '', '170163', 'asdasd', 'sadasfasf', 0, ''),
(4, '2018-07-26 00:00:00', '', '170163', 'Test', 'This is a test', 0, ''),
(5, '2018-07-26 00:00:00', '', '12845', 'W434', 'SFSDGSDG', 0, ''),
(6, '2018-07-26 00:00:00', '', '12845', 'SRSET', 'DXGDFXGBXF', 0, ''),
(7, '2018-07-26 00:00:00', '', '170163', 'W34W3', 'SEDFSDF', 1, ''),
(8, '2018-07-27 00:00:00', '12845', 'Kunji', 'tEST ASDPAKDP', 'ESDRMFSKDNFDSM', 1, 'awrlaesr;lw'),
(9, '2018-07-27 00:00:00', '12845', 'Kunji', 'ASDA`PO', 'SLEMRSEL\r\n', 0, ''),
(10, '2018-07-27 00:00:00', '12845', 'Kunji', 'ASDA`PO', 'SLEMRSEL\r\n', 0, ''),
(11, '2018-07-27 00:00:00', '12845', 'Kunji', 'asd', 'sad', 0, ''),
(12, '2018-07-31 23:10:02', '12845', 'Kunji', 'dfghj', 'fghjk', 0, ''),
(13, '2018-07-31 23:10:14', '12845', 'Kunji', 'dfghj', 'fghjk', 0, ''),
(14, '2018-07-31 23:10:26', '12845', 'Kunji', 'dfghj', 'fghjk', 0, ''),
(15, '2018-07-31 23:19:14', '', '', 'mk', 'sdfghj', 0, ''),
(16, '2018-07-31 23:28:55', '', '', 'fg', 'dfghj', 0, ''),
(17, '2018-08-01 00:58:27', '', '', 'ghjuihkghhu', 'gkgukjbhjjb', 0, ''),
(18, '2018-08-01 00:58:55', '', '', 'ghjuihkghhu', 'gkgukjbhjjb', 0, ''),
(19, '2018-08-01 01:05:01', '12845', 'Kunji', 'dfghj', 'wertyhjukl;gfdfyuophgjgj', 0, '');
/*!40000 ALTER TABLE `grv` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
e4706ab77b0586358e294d284e09be12cb529496 | SQL | victor1600/bad115 | /ejercicios/funciones.sql | UTF-8 | 934 | 3.515625 | 4 | [] | no_license | ------------ EJECUTAR UNA FUNCION PARA CADA FILA DE UNA TABLA USANDO SELECT ---------
CREATE OR REPLACE FUNCTION tax(p_value IN NUMBER)
return number is
begin
RETURN (p_value * 0.08);
end;
select EMPLOYEE_ID, LAST_NAME, SALARY, tax(SALARY)
from EMPLOYEES
where DEPARTMENT_ID = 100;
-----------------------------------------------------------
---------- NOTACION MIXTA, VALORES POR DEFAULT, DECLARECION SIN DECLARE ---
CREATE OR REPLACE FUNCTION f(p_parameter_1 IN NUMBER DEFAULT 1,
p_parameter_5 IN NUMBER DEFAULT 5) RETURN NUMBER
IS
--- VARIABLE DECLARADA SIN DECLARE ?
v_var number;
BEGIN
v_var:= p_parameter_1 + (p_parameter_5 *2);
RETURN v_var;
end f;
SELECT F(p_parameter_5 => 10) FROM DUAL;
---- VER TABLAS DONDE ESTAN FUNCIONES
DESCRIBE USER_SOURCE
--- CONSULTAR LAS FUNCIONES EXISTENTES
SELECT TEXT
FROM USER_SOURCE
WHERE TYPE ='FUNCTION'
ORDER BY LINE;
| true |
f77d0c44140947d9e9d93a6ab92d7ab19a3cae7d | SQL | SEANDOUGHTY/redwood-voting-app | /api/db/migrations/20210329230951_vote/migration.sql | UTF-8 | 854 | 3.21875 | 3 | [
"MIT"
] | permissive | /*
Warnings:
- You are about to drop the column `email` on the `UserExample` table. All the data in the column will be lost.
- You are about to drop the column `name` on the `UserExample` table. All the data in the column will be lost.
- Added the required column `vote` to the `UserExample` table without a default value. This is not possible if the table is not empty.
*/
-- DropIndex
DROP INDEX "UserExample.email_unique";
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_UserExample" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"vote" TEXT NOT NULL,
"dateTime" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO "new_UserExample" ("id") SELECT "id" FROM "UserExample";
DROP TABLE "UserExample";
ALTER TABLE "new_UserExample" RENAME TO "UserExample";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;
| true |
01d1732c5281597eee8ccbc2b74af9f6710d64ea | SQL | SeojunHwang/Busan_Study | /SQL/SQL_20210521.sql | UTF-8 | 1,943 | 4.03125 | 4 | [] | no_license | -- MYSQL ์ฌ์ฉ ๋ช
๋ น์ด
-- mysql ์ฝ์ ์ ์ ๋ช
๋ น
-- mysql -u ์ฌ์ฉ์id -p
-- ๋ค๋ฅธ ์๋ฒ์ ์๋ mysql์ ์ ์ํ ๊ฒฝ์ฐ ์ฌ์ฉ
-- mysql -u ์ฌ์ฉ์id -p -h ์ ์์ฃผ์
-- ๋ค๋ฅธ ์๋ฒ์ ์๋ mysql์ ์ ์ ์ port๊น์ง ์ค์ ํ์ฌ ์ ์
-- mysql -u ์ฌ์ฉ์id -p -h ์ ์์ฃผ์ -P ํฌํธ๋ฒํธ
-- ์ฌ์ฉํ ์ ์๋ DB ๋ชฉ๋ก ํ์ธ
SHOW DATABASES;
-- ์ฌ์ฉํ DB ์ง์
-- ex) USE DB๋ช
;
USE mysql;
-- ํด๋น DB์ ํฌํจ๋ table ๋ชฉ๋ก ํ์ธ
SHOW TABLES;
-- ์ฌ์ฉ์ ์์ฑํ๊ธฐ
-- ex) CREATE USER ์ฌ์ฉ์๋ช
;
-- ex) CREATE USER ์ฌ์ฉ์๋ช
@์ ์์ฃผ์;
CREATE USER 'test1';
CREATE USER 'test2'@'localhost';
-- ์ฌ์ฉ์ ์์ฑ ์ ๋น๋ฐ๋ฒํธ ํจ๊ป ์์ฑํ๊ธฐ
-- ex) CREATE USER '์ฌ์ฉ์๋ช
'@'์ ์์ฃผ์' IDENTIFIED BY '๋น๋ฐ๋ฒํธ';
CREATE USER 'test3'@'localhost' IDENTIFIED BY 'asdf1234';
SELECT host, user, authentication_string FROM user;
-- ์ฌ์ฉ์ ์ญ์ ํ๊ธฐ
-- ex) DROP USER '์ฌ์ฉ์๋ช
';
-- ex) DROP USER '์ฌ์ฉ์๋ช
'@'์ ์์ฃผ์';
DROP USER 'test1';
DROP USER 'test2'@'localhost';
-- ์ฌ์ฉ์ ๋น๋ฐ๋ฒํธ ๋ณ๊ฒฝ
-- ex) ALTER USER '์ฌ์ฉ์๋ช
'@'์ ์์ฃผ์' IDENTIFIED WITH caching_sha2_password BY '๋ณ๊ฒฝํ ๋น๋ฐ๋ฒํธ';
ALTER USER 'test3'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'qwer1234';
-- ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์์ฑํ๊ธฐ
-- ex) CREATE DATABASE db๋ช
;
-- ex) CREATE SCHEMA db๋ช
;
CREATE DATABASE testdb1;
CREATE SCHEMA testdb2;
SHOW DATABASES;
-- ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์์ฑ ์ ๊ธฐ๋ณธ ๋ฌธ์์
์ค์ ํ๊ธฐ
-- MySql์ ํ์ฌ ๊ธฐ๋ณธ ๋ฌธ์์
์ utf8md4 ์
-- MySql๊ณผ ๋์ผํ DB์ธ MariaDB๋ utf8mb4๋ฅผ ์ง์ํ์ง ์์
-- ๊ตฌ ๋ฒ์ ์ MySql์ ๊ธฐ๋ณธ ๋ฌธ์์
์ธ Latin ์ด์ด์ ํ๊ธ์ ํ์ํ ์ ์์
-- ex) CREATE DATABASE db๋ช
DEFAULT CHARACTER SET ๋ฌธ์์
;
CREATE DATABASE testdb3 DEFAULT CHARACTER SET utf8;
-- ๋ฐ์ดํฐ ๋ฒ ์ด์ค ์ญ์ ํ๊ธฐ
-- ex) DROP DATABASE db๋ช
;
DROP DATABASE testdb3;
| true |
95a0172573f76f6e1abd70dc36ea4d34fec0d3ea | SQL | ijw9209/Workspace_Web | /Jsp13_CalBoardpage/build/classes/com/cal/db/db.sql | UTF-8 | 1,172 | 4.28125 | 4 | [] | no_license | DROP TABLE CALBOARD;
DROP SEQUENCE CALBOARDSEQ;
CREATE SEQUENCE CALBOARDSEQ;
CREATE TABLE CALBOARD(
SEQ NUMBER PRIMARY KEY,
ID VARCHAR2(2000) NOT NULL,
TITLE VARCHAR2(1000) NOT NULL,
CONTENT VARCHAR2(4000) NOT NULL,
MDATE VARCHAR2(12) NOT NULL,
REGDATE DATE NOT NULL
);
SELECT * FROM CALBOARD WHERE ID = 'kh' AND SUBSTR(MDATE,1,8) = '20190701' AND SEQ BETWEEN 1 AND 5
SELECT R,SEQ,ID,TITLE,CONTENT,MDATE,REGDATE
FROM(SELECT ROWNUM AS R,SEQ,ID,TITLE,CONTENT,MDATE,REGDATE
FROM CALBOARD WHERE ID = 'kh' AND SUBSTR(MDATE,1,8) = '20190701')
WHERE R BETWEEN 1 AND 5;
SELECT R, BOARDNO,TITLE,WRITER,REGDATE FROM "
+ " (SELECT ROWNUM AS R,BOARDNO, TITLE, WRITER, REGDATE FROM "
+ " (SELECT BOARDNO, TITLE, WRITER, REGDATE FROM ANSWERBOARD ORDER BY BOARDNO)) "
+ " WHERE R BETWEEN ? AND ?
SELECT * FROM CALBOARD;
SELECT SEQ,ID,TITLE,CONTENT,MDATE,REGDATE FROM CALBOARD WHERE ID = ? AND SUBSTR(MADATE,1,8) = ?
SELECT *
FROM(SELECT (ROW_NUMBER() OVER(PARTITION BY SUBSTR(MDATE,1,8) ORDER BY MDATE)) RN,
SEQ, ID, TITLE, CONTENT , MDATE , REGDATE
FROM CALBOARD
WHERE ID = 'kh' AND SUBSTR(MDATE,1,6) = '201907')
WHERE RN BETWEEN 1 AND 3 ; | true |
fec3870cedbb6962b3349a51dd3c99cd703489c8 | SQL | beepsboops/BootcampX | /3_queries_group-by/cohort_total_assignment_submissions.sql | UTF-8 | 584 | 3.765625 | 4 | [] | no_license | -- MY ANSWER (ALSO WORKS)
-- SELECT cohorts.name as cohort, count(assignment_submissions.id) as total_submissions
-- FROM cohorts
-- JOIN students ON cohorts.id = students.cohort_id
-- JOIN assignment_submissions ON assignment_submissions.student_id = students.id
-- GROUP BY cohort
-- ORDER BY total_submissions DESC
-- COMPASS ANSWER
SELECT cohorts.name as cohort, count(assignment_submissions.*) as total_submissions
FROM assignment_submissions
JOIN students ON students.id = student_id
JOIN cohorts ON cohorts.id = cohort_id
GROUP BY cohorts.name
ORDER BY total_submissions DESC; | true |
6dcc745adcaa11abf4ff879203e8977fe268c6c8 | SQL | gustavobonassa/Sites | /snake-game/u90603881_lol.sql | UTF-8 | 2,032 | 2.9375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.4.15.1
-- http://www.phpmyadmin.net
--
-- Host: mysql796.umbler.com
-- Generation Time: 02-Jul-2017 ร s 13:57
-- Versรฃo do servidor: 5.6.34-log
-- PHP Version: 5.4.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `u90603881_lol`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `snake`
--
CREATE TABLE IF NOT EXISTS `snake` (
`id` int(11) NOT NULL,
`nome` varchar(30) NOT NULL,
`pontos` int(11) NOT NULL,
`dificuldade` varchar(30) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=latin1;
--
-- Extraindo dados da tabela `snake`
--
INSERT INTO `snake` (`id`, `nome`, `pontos`, `dificuldade`) VALUES
(3, 'Gustavo', 1088, 'medio'),
(4, 'Joao', 50, 'medio'),
(5, 'Claudio', 415, 'dificil'),
(6, 'Pedro', 740, 'medio'),
(7, 'Maria', 745, 'medio'),
(8, 'Gabriel', 1491, 'medio'),
(9, 'Gustavo', 3567, 'dificil'),
(10, 'CobrinhaMastes', 34, 'medio'),
(11, 'Amigo', 73, 'medio'),
(12, 'Yoda', 772, 'medio'),
(13, 'Gustavo', 1778, 'facil'),
(14, 'Vitor', 34, 'facil'),
(20, 'Debora', 1119, 'dificil'),
(21, 'Leao', 400, 'medio'),
(22, 'Leni', 1491, 'medio'),
(23, 'Player', 394, 'facil'),
(24, 'debora', 404, 'medio'),
(25, 'Gustavo', 4248, 'dificil'),
(26, 'aaaaaaaa', 6484, 'dificil');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `snake`
--
ALTER TABLE `snake`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `snake`
--
ALTER TABLE `snake`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=27;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
de312763dc05984d604e10baf251595a1ea27214 | SQL | clusson/DB-SQL-Postgres | /init.sql | UTF-8 | 519 | 3.78125 | 4 | [] | no_license | CREATE EXTENSION
IF NOT EXISTS "uuid-ossp";
CREATE TABLE roles
(
roleId int NOT NULL,
role varchar(25) NOT NULL,
PRIMARY KEY (roleId)
);
CREATE TABLE users
(
userId uuid DEFAULT uuid_generate_v4 (),
firstname varchar(25) NOT NULL,
lastname varchar(25) NOT NULL,
created_at date NOT NULL DEFAULT now(),
email varchar(50) NOT NULL,
roleId int NOT NULL,
PRIMARY KEY (userId),
FOREIGN KEY (roleId) REFERENCES roles(roleId)
);
CREATE INDEX "idx_users_email"
ON users ("email"); | true |
0725a02439e5af09d618e847ee5e55ad7daa227d | SQL | HidakaRintaro/MISSION_DMM-Go | /ddl/ddl.sql | UTF-8 | 663 | 3.65625 | 4 | [
"MIT"
] | permissive | CREATE TABLE `account` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL UNIQUE,
`password_hash` varchar(255) NOT NULL,
`display_name` varchar(255),
`avatar` text,
`header` text,
`note` text,
`create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
);
CREATE TABLE `status` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`account_id` bigint(20) NOT NULL,
`content` text NOT NULL,
`create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
INDEX `idx_account_id` (`account_id`),
CONSTRAINT `fk_status_account_id` FOREIGN KEY (`account_id`) REFERENCES `account` (`id`)
);
| true |
981273d3ec3da8641b64e1cf914dc7eda0a74ca3 | SQL | bellmit/flexdb | /2.HOST/4.Function/fnc_get_price_plo.sql | UTF-8 | 1,665 | 3.53125 | 4 | [] | no_license | -- Start of DDL Script for Function HOSTMSTRADE.FNC_GET_PRICE_PLO
-- Generated 22/10/2018 9:41:21 AM from HOSTMSTRADE@FLEX_111
CREATE OR REPLACE
FUNCTION fnc_get_price_plo(
v_strSYMBOL IN Varchar2,
v_strEXECTYPE IN Varchar2
)
RETURN NUMBER IS
v_plobycloseprice varchar2(5);
v_price number;
BEGIN
v_price := 0;
BEGIN
select s.varvalue into v_plobycloseprice
from sysvar s where s.grname ='SYSTEM' and s.varname = 'PLOBYCLOSEPRICE';
EXCEPTION
when OTHERS Then
v_plobycloseprice := 'N';
END;
IF ( v_plobycloseprice = 'N') THEN
IF(v_strEXECTYPE = 'NB') THEN
SELECT NVL(S.CEILINGPRICE, 0)/ S.TRADEUNIT INTO v_price FROM SECURITIES_INFO S WHERE S.SYMBOL = v_strSYMBOL ;
ELSIF (v_strEXECTYPE = 'NS') THEN
SELECT NVL(S.FLOORPRICE, 0)/ S.TRADEUNIT INTO v_price FROM SECURITIES_INFO S WHERE S.SYMBOL = v_strSYMBOL ;
END IF;
ELSE
IF(v_strEXECTYPE = 'NB') THEN
SELECT CASE WHEN HB.TRADINGSESSIONID = 'PCLOSE' THEN TO_NUMBER(NVL(S.CLOSEPRICE,NVL(se.ceilingprice,'0'))) / SE.TRADEUNIT
ELSE TO_NUMBER(NVL(se.ceilingprice,'0')) / SE.TRADEUNIT END
INTO v_price
from hasecurity_req hr, HA_BRD hb, STOCKINFOR S , SECURITIES_INFO SE
WHERE hr.tradingsessionsubid = hb.BRD_CODE
AND HR.SYMBOL = S.SYMBOL(+)
AND HR.Symbol = SE.Symbol
AND HR.SYMBOL = v_strSYMBOL ;
ELSIF (v_strEXECTYPE = 'NS') THEN
SELECT NVL(S.FLOORPRICE, 0)/S.TRADEUNIT INTO v_price FROM SECURITIES_INFO S WHERE S.SYMBOL = v_strSYMBOL ;
END IF;
END IF;
RETURN v_price;
EXCEPTION when OTHERS Then
Return 0;
END;
/
-- End of DDL Script for Function HOSTMSTRADE.FNC_GET_PRICE_PLO
| true |
218b88c907fd8cb1433c35ef58c767f4c6e5aae0 | SQL | alldatacenter/alldata | /lake/amoro/ams/server/src/main/resources/mysql/ams-mysql-init.sql | UTF-8 | 13,607 | 3.65625 | 4 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | CREATE TABLE `catalog_metadata`
(
`catalog_id` int(11) NOT NULL AUTO_INCREMENT,
`catalog_name` varchar(64) NOT NULL COMMENT 'catalog name',
`catalog_metastore` varchar(64) NOT NULL COMMENT 'catalog type like hms/ams/hadoop/custom',
`storage_configs` mediumtext COMMENT 'base64 code of storage configs',
`auth_configs` mediumtext COMMENT 'base64 code of auth configs',
`catalog_properties` mediumtext COMMENT 'catalog properties',
`database_count` int(11) NOT NULL default 0,
`table_count` int(11) NOT NULL default 0,
PRIMARY KEY (`catalog_id`),
UNIQUE KEY `catalog_name_index` (`catalog_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'catalog metadata';
CREATE TABLE `database_metadata`
(
`catalog_name` varchar(64) NOT NULL COMMENT 'catalog name',
`db_name` varchar(128) NOT NULL COMMENT 'database name',
`table_count` int(11) NOT NULL default 0,
PRIMARY KEY (`catalog_name`, `db_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'database metadata';
CREATE TABLE `optimizer`
(
`token` varchar(50) NOT NULL,
`resource_id` varchar(100) DEFAULT NULL COMMENT 'optimizer instance id',
`group_name` varchar(50) DEFAULT NULL COMMENT 'group/queue name',
`container_name` varchar(100) DEFAULT NULL COMMENT 'container name',
`start_time` timestamp not null default CURRENT_TIMESTAMP COMMENT 'optimizer start time',
`touch_time` timestamp not null default CURRENT_TIMESTAMP COMMENT 'update time',
`thread_count` int(11) DEFAULT NULL COMMENT 'total number of all CPU resources',
`total_memory` bigint(30) DEFAULT NULL COMMENT 'optimizer use memory size',
`properties` mediumtext COMMENT 'optimizer state info, contains like yarn application id and flink job id',
PRIMARY KEY (`token`),
KEY `resource_group` (`group_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'resource table';
CREATE TABLE `resource`
(
`resource_id` varchar(100) NOT NULL COMMENT 'optimizer instance id',
`resource_type` tinyint(4) DEFAULT 0 COMMENT 'resource type like optimizer/ingestor',
`container_name` varchar(100) DEFAULT NULL COMMENT 'container name',
`group_name` varchar(50) DEFAULT NULL COMMENT 'queue name',
`thread_count` int(11) DEFAULT NULL COMMENT 'total number of all CPU resources',
`total_memory` bigint(30) DEFAULT NULL COMMENT 'optimizer use memory size',
`start_time` timestamp not null default CURRENT_TIMESTAMP COMMENT 'optimizer start time',
`properties` mediumtext COMMENT 'optimizer instance properties',
PRIMARY KEY (`resource_id`),
KEY `resource_group` (`group_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Optimizer instance info';
CREATE TABLE `resource_group`
(
`group_name` varchar(50) NOT NULL COMMENT 'Optimize group name',
`container_name` varchar(100) DEFAULT NULL COMMENT 'Container name',
`properties` mediumtext COMMENT 'Properties',
PRIMARY KEY (`group_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Group to divide optimize resources';
CREATE TABLE `table_identifier`
(
`table_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Auto increment id',
`catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
`db_name` varchar(128) NOT NULL COMMENT 'Database name',
`table_name` varchar(128) NOT NULL COMMENT 'Table name',
PRIMARY KEY (`table_id`),
UNIQUE KEY `table_name_index` (`catalog_name`,`db_name`,`table_name`)
);
CREATE TABLE `table_metadata`
(
`table_id` bigint(20) NOT NULL COMMENT 'table id',
`catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
`db_name` varchar(128) NOT NULL COMMENT 'Database name',
`table_name` varchar(128) NOT NULL COMMENT 'Table name',
`format` varchar(32) NOT NULL COMMENT "format",
`primary_key` varchar(256) DEFAULT NULL COMMENT 'Primary key',
`sort_key` varchar(256) DEFAULT NULL COMMENT 'Sort key',
`table_location` varchar(256) DEFAULT NULL COMMENT 'Table location',
`base_location` varchar(256) DEFAULT NULL COMMENT 'Base table location',
`change_location` varchar(256) DEFAULT NULL COMMENT 'change table location',
`properties` mediumtext COMMENT 'Table properties',
`meta_store_site` mediumtext COMMENT 'base64 code of meta store site',
`hdfs_site` mediumtext COMMENT 'base64 code of hdfs site',
`core_site` mediumtext COMMENT 'base64 code of core site',
`auth_method` varchar(32) DEFAULT NULL COMMENT 'auth method like KERBEROS/SIMPLE',
`hadoop_username` varchar(64) DEFAULT NULL COMMENT 'hadoop username when auth method is SIMPLE',
`krb_keytab` text COMMENT 'kerberos keytab when auth method is KERBEROS',
`krb_conf` text COMMENT 'kerberos conf when auth method is KERBEROS',
`krb_principal` text COMMENT 'kerberos principal when auth method is KERBEROS',
`current_schema_id` int(11) NOT NULL DEFAULT 0 COMMENT 'current schema id',
`meta_version` bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (`table_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Table metadata';
CREATE TABLE `table_runtime`
(
`table_id` bigint(20) NOT NULL,
`catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
`db_name` varchar(128) NOT NULL COMMENT 'Database name',
`table_name` varchar(128) NOT NULL COMMENT 'Table name',
`current_snapshot_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'Base table current snapshot id',
`current_change_snapshotId` bigint(20) DEFAULT NULL COMMENT 'Change table current snapshot id',
`last_optimized_snapshotId` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'last optimized snapshot id',
`last_optimized_change_snapshotId` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'last optimized change snapshot id',
`last_major_optimizing_time` timestamp NULL DEFAULT NULL COMMENT 'Latest Major Optimize time for all partitions',
`last_minor_optimizing_time` timestamp NULL DEFAULT NULL COMMENT 'Latest Minor Optimize time for all partitions',
`last_full_optimizing_time` timestamp NULL DEFAULT NULL COMMENT 'Latest Full Optimize time for all partitions',
`optimizing_status` varchar(20) DEFAULT 'Idle' COMMENT 'Table optimize status: MajorOptimizing, MinorOptimizing, Pending, Idle',
`optimizing_status_start_time` timestamp default CURRENT_TIMESTAMP COMMENT 'Table optimize status start time',
`optimizing_process_id` bigint(20) NOT NULL COMMENT 'optimizing_procedure UUID',
`optimizer_group` varchar(64) NOT NULL,
`table_config` mediumtext,
`optimizing_config` mediumtext,
PRIMARY KEY (`table_id`),
UNIQUE KEY `table_index` (`catalog_name`,`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Optimize running information of each table';
CREATE TABLE `table_optimizing_process`
(
`process_id` bigint(20) NOT NULL COMMENT 'optimizing_procedure UUID',
`table_id` bigint(20) NOT NULL,
`catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
`db_name` varchar(128) NOT NULL COMMENT 'Database name',
`table_name` varchar(128) NOT NULL COMMENT 'Table name',
`target_snapshot_id` bigint(20) NOT NULL,
`target_change_snapshot_id` bigint(20) NOT NULL,
`status` varchar(10) NOT NULL COMMENT 'Direct to TableOptimizingStatus',
`optimizing_type` varchar(10) NOT NULL COMMENT 'Optimize type: Major, Minor',
`plan_time` timestamp DEFAULT CURRENT_TIMESTAMP COMMENT 'First plan time',
`end_time` timestamp NULL DEFAULT NULL COMMENT 'finish time or failed time',
`fail_reason` varchar(4096) DEFAULT NULL COMMENT 'Error message after task failed',
`rewrite_input` longblob DEFAULT NULL COMMENT 'rewrite files input',
`summary` mediumtext COMMENT 'Max change transaction id of these tasks',
`from_sequence` mediumtext COMMENT 'from or min sequence of each partition',
`to_sequence` mediumtext COMMENT 'to or max sequence of each partition',
PRIMARY KEY (`process_id`),
KEY `table_index` (`table_id`, `plan_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'History of optimizing after each commit';
CREATE TABLE `task_runtime`
(
`process_id` bigint(20) NOT NULL,
`task_id` int(11) NOT NULL,
`retry_num` int(11) DEFAULT NULL COMMENT 'Retry times',
`table_id` bigint(20) NOT NULL,
`partition_data` varchar(128) DEFAULT NULL COMMENT 'Partition data',
`create_time` timestamp NULL DEFAULT NULL COMMENT 'Task create time',
`start_time` timestamp NULL DEFAULT NULL COMMENT 'Time when task start waiting to execute',
`end_time` timestamp NULL DEFAULT NULL COMMENT 'Time when task finished',
`cost_time` bigint(20) DEFAULT NULL,
`status` varchar(16) DEFAULT NULL COMMENT 'Optimize Status: Init, Pending, Executing, Failed, Prepared, Committed',
`fail_reason` varchar(4096) DEFAULT NULL COMMENT 'Error message after task failed',
`optimizer_token` varchar(50) DEFAULT NULL COMMENT 'Job type',
`thread_id` int(11) DEFAULT NULL COMMENT 'Job id',
`rewrite_output` longblob DEFAULT NULL COMMENT 'rewrite files output',
`metrics_summary` text COMMENT 'metrics summary',
`properties` mediumtext COMMENT 'task properties',
PRIMARY KEY (`process_id`, `task_id`),
KEY `table_index` (`table_id`, `process_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Optimize task basic information';
CREATE TABLE `optimizing_task_quota`
(
`process_id` bigint(20) NOT NULL COMMENT 'Optimize type: Major, Minor, FullMajor',
`task_id` int(11) NOT NULL COMMENT 'Optimize task unique id',
`retry_num` int(11) DEFAULT 0 COMMENT 'Retry times',
`table_id` bigint(20) NOT NULL,
`start_time` timestamp default CURRENT_TIMESTAMP COMMENT 'Time when task start waiting to execute',
`end_time` timestamp default CURRENT_TIMESTAMP COMMENT 'Time when task finished',
`fail_reason` varchar(4096) DEFAULT NULL COMMENT 'Error message after task failed',
PRIMARY KEY (`process_id`, `task_id`, `retry_num`),
KEY `table_index` (`table_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Optimize task basic information';
CREATE TABLE `api_tokens`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`apikey` varchar(256) NOT NULL COMMENT 'openapi client public key',
`secret` varchar(256) NOT NULL COMMENT 'The key used by the client to generate the request signature',
`apply_time` timestamp NULL DEFAULT NULL COMMENT 'apply time',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `account_unique` (`apikey`) USING BTREE COMMENT 'account unique'
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='Openapi secret';
CREATE TABLE `platform_file` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'file id',
`file_name` varchar(100) NOT NULL COMMENT 'file name',
`file_content_b64` mediumtext NOT NULL COMMENT 'file content encoded with base64',
`file_path` varchar(100) DEFAULT NULL COMMENT 'may be hdfs path , not be used now',
`add_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'add timestamp',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='store files info saved in the platform';
CREATE TABLE `table_blocker` (
`blocker_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Blocker unique id',
`catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
`db_name` varchar(128) NOT NULL COMMENT 'Database name',
`table_name` varchar(128) NOT NULL COMMENT 'Table name',
`operations` varchar(128) NOT NULL COMMENT 'Blocked operations',
`create_time` timestamp NULL DEFAULT NULL COMMENT 'Blocker create time',
`expiration_time` timestamp NULL DEFAULT NULL COMMENT 'Blocker expiration time',
`properties` mediumtext COMMENT 'Blocker properties',
PRIMARY KEY (`blocker_id`),
KEY `table_index` (`catalog_name`,`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Table blockers';
INSERT INTO catalog_metadata(catalog_name,catalog_metastore,storage_configs,auth_configs, catalog_properties) VALUES ('local_catalog','ams','{"storage.type":"hdfs","hive.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse":"/tmp/arctic/warehouse","table-formats":"MIXED_ICEBERG"}');
| true |
216f99ca66e7e531d4fc04800ca5af1752ee1f15 | SQL | nitinkumar04/LiquorWarehouse | /LiquorWarehouseStage_1_0/GVW/Tables/AccountsforHQByDim.sql | UTF-8 | 463 | 2.84375 | 3 | [] | no_license | ๏ปฟCREATE TABLE [GVW].[AccountsforHQByDim](
[GVWAccountsforHQBySKey] int identity(1,1),
[AcctUnivDimID] [varchar](18) NULL,
[AcctHQDimID] [varchar](18) NULL,
[Type] [varchar](200) NULL,
GVWCreatedDate datetime default getdate() NOT NULL,
GVWLastModifiedDate datetime default getdate() NOT NULL,
GVWSourceID INT default (-1),
GVWDeleted BIT NULL DEFAULT '0'
CONSTRAINT [PK_AccountsforHQByDim] PRIMARY KEY (GVWAccountsforHQBySKey)
); | true |
6f5a06439a6badd013af05ba7a1afab6ae1d86c5 | SQL | BhagyashriNBhamare/Employee-Appraisal-management | /Database/data.sql | UTF-8 | 4,636 | 2.828125 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 8.0.19, for Win64 (x86_64)
--
-- Host: localhost Database: emp
-- ------------------------------------------------------
-- Server version 8.0.19
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `admin`
--
DROP TABLE IF EXISTS `admin`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `admin` (
`emp` varchar(200) NOT NULL DEFAULT 'custom',
`pass` varchar(200) NOT NULL DEFAULT 'custom'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `admin`
--
LOCK TABLES `admin` WRITE;
/*!40000 ALTER TABLE `admin` DISABLE KEYS */;
INSERT INTO `admin` VALUES ('0','2609841');
/*!40000 ALTER TABLE `admin` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `empl`
--
DROP TABLE IF EXISTS `empl`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `empl` (
`emp` varchar(200) NOT NULL DEFAULT 'custom',
`pass` varchar(200) NOT NULL DEFAULT 'custom'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `empl`
--
LOCK TABLES `empl` WRITE;
/*!40000 ALTER TABLE `empl` DISABLE KEYS */;
INSERT INTO `empl` VALUES ('11','11'),('12','12'),('13','13'),('2','2'),('3','3'),('4','4'),('28','28'),('28','28');
/*!40000 ALTER TABLE `empl` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `inform`
--
DROP TABLE IF EXISTS `inform`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `inform` (
`fname` varchar(200) NOT NULL,
`lname` varchar(200) NOT NULL,
`id` varchar(200) NOT NULL,
`salary` varchar(200) NOT NULL,
`mid` varchar(200) NOT NULL,
`rating` varchar(20) DEFAULT '0',
`email` varchar(200) DEFAULT NULL,
`active` tinyint(1) DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `inform`
--
LOCK TABLES `inform` WRITE;
/*!40000 ALTER TABLE `inform` DISABLE KEYS */;
INSERT INTO `inform` VALUES ('Bhagyashri','BHAMARE','1','200000','1','9','bhagyashri@gmail.com',1),('lata','bhyu','2','10000','1','8','lata@gmail.com',1),('neha ','chanan','3','10000','1','5','naha@gmail.com',1),('tanvi','pachpute ','4','10000','1','5','tanvi@gmail.com',0),('SNEHAL','BHAMARE','6','200000','6','8','bhamare.7791@gmail.com',0),('sandhya ','BHAMARE','10','15000','10','5','bhamar@gmail.com',1),('Bhagyashri','Bhamare','28','200000','1','0','bhamare.bhagyashri1999@gmail.com',0),('Bhagyashri','Bhamare','28','200000','1','0','bhamare.bhagyashri1999@gmail.com',0);
/*!40000 ALTER TABLE `inform` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `manager`
--
DROP TABLE IF EXISTS `manager`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `manager` (
`emp` varchar(200) NOT NULL DEFAULT 'custom',
`pass` varchar(200) NOT NULL DEFAULT 'custom'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `manager`
--
LOCK TABLES `manager` WRITE;
/*!40000 ALTER TABLE `manager` DISABLE KEYS */;
INSERT INTO `manager` VALUES ('1','1'),('6','6'),('10','10');
/*!40000 ALTER TABLE `manager` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping events for database 'emp'
--
--
-- Dumping routines for database 'emp'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2020-10-16 21:33:48
| true |
7aaf79ba0dcb06a4f3f2d56968c573a335bd5750 | SQL | LuffyWesley/Tempr | /query.sql | UTF-8 | 307 | 2.828125 | 3 | [
"MIT"
] | permissive | -- Query to see everything in the tables
-- SELECT * FROM test ORDER BY creationTime DESC;
-- SELECT TOP 20 * FROM test2 ORDER BY creationTime DESC;
-- SELECT AVG(compound) FROM test WHERE creationTime >= DATEADD(minute, -16000, GETDATE());
-- SELECT * FROM test;
-- SELECT * FROM test2;
SELECT * FROM list; | true |
752bf835e7f10658366f95db03cbfb1b6ac43baa | SQL | vyesubabu/metview | /odb_api_bundle-0.17.6-Source/odb/src/ddl/sat_radar.sql | UTF-8 | 188 | 2.703125 | 3 | [] | no_license | //
//-- ODB/SQL file 'sat_radar.sql'
//
READONLY;
CREATE VIEW sat_radar AS
SELECT satellite_identifier,
radar_station.offset UPDATED
FROM sat
WHERE radar_station.len>0
;
| true |
2a94676af9910021bd0c78a6d4f1f31130feca60 | SQL | dael-victoria-reyes/data-act-broker-backend | /dataactcore/scripts/raw_sql/backfill_awarding_office_names_q12019.sql | UTF-8 | 301 | 2.953125 | 3 | [
"CC0-1.0"
] | permissive | UPDATE published_award_financial_assistance AS pafa
SET awarding_office_name = office.office_name
FROM office
WHERE pafa.awarding_office_code = office.office_code
AND cast_as_date(pafa.action_date) >= '2018/10/01'
AND pafa.awarding_office_name IS NULL
AND pafa.awarding_office_code IS NOT NULL;
| true |
932e7a68737522b767e67d48447412012512b63c | SQL | john310897/depthealthcaresys | /database/health_care.sql | UTF-8 | 5,770 | 3.28125 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jun 23, 2020 at 10:01 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.3.2
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `health_care`
--
-- --------------------------------------------------------
--
-- Table structure for table `drugs`
--
CREATE TABLE `drugs` (
`dt` varchar(30) NOT NULL,
`drug_used` varchar(30) NOT NULL,
`purpose` varchar(200) NOT NULL,
`description` varchar(200) NOT NULL,
`stock` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `drugs`
--
INSERT INTO `drugs` (`dt`, `drug_used`, `purpose`, `description`, `stock`) VALUES
('ankle sprains', 'elastic bandages (such as an A', 'Treating a sprained ankle promotes recovery and prevents further discomfort. Itโs important not to put weight on the injured area while youโre recovering from an ankle sprain.', 'An injury that occurs when the ankle rolls, twists or turns in an awkward way.', '28'),
('Blisters', 'hydrocolloid dressings', 'Some medications, such as hydrocolloid dressings, can help prevent further discomfort and encourage the healing process. Hydrocolloid dressings are available', 'A blister is a pocket of fluid between the upper layers of skin. The most common causes are friction, freezing, burning, infection, and chemical burns. Blisters are also a symptom of some diseases.', '18'),
('Hamstring_Tear_or_Pull', 'anti-inflammatory painkillers,', 'use an elastic bandage around the leg to keep down swelling.', 'A hamstring strain, sometimes called a pulled hamstring, happens when one or more of these muscles gets stretched too far and starts to tear', '17'),
('Muscle_Cramps', 'vitamin B complex supplements ', 'You can usually treat muscle cramps with self-care measures. Your doctor can show you stretching exercises that can help you reduce your chances of getting muscle cramps. Making sure you stay well-hyd', 'Overuse of a muscle, dehydration, muscle strain or simply holding a position for a prolonged period can cause a muscle cramp.', '18');
-- --------------------------------------------------------
--
-- Table structure for table `student`
--
CREATE TABLE `student` (
`usn` varchar(30) NOT NULL,
`password` varchar(30) NOT NULL,
`name` varchar(30) NOT NULL,
`branch` varchar(30) NOT NULL,
`dob` date NOT NULL,
`bg` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `student`
--
INSERT INTO `student` (`usn`, `password`, `name`, `branch`, `dob`, `bg`) VALUES
('', '', '', '', '0000-00-00', ''),
('1CD18MCA50', '123456', 'abhimannu', 'MCA', '0121-02-12', 'A+'),
('1CD18MCA52', '1234', 'johnjohn', 'BCA', '2002-02-02', 'A+'),
('1CD18MCA60', '1234', 'john', 'MCA', '2019-04-17', 'B+'),
('4VZ19MCA59', '1234', 'chethan', 'MCA', '2002-02-02', 'A+');
-- --------------------------------------------------------
--
-- Table structure for table `student1`
--
CREATE TABLE `student1` (
`usn` varchar(40) NOT NULL,
`password` varchar(30) NOT NULL,
`name` varchar(30) NOT NULL,
`branch` varchar(30) NOT NULL,
`dob` date NOT NULL,
`bg` varchar(30) NOT NULL,
`emr1` varchar(30) NOT NULL,
`emr2` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `student1`
--
INSERT INTO `student1` (`usn`, `password`, `name`, `branch`, `dob`, `bg`, `emr1`, `emr2`) VALUES
('', '', '', '', '0000-00-00', '', '', ''),
('1CD18MCA50', '123', 'abhimannu', 'MCA', '1998-02-02', 'A+', '8618390387', '7084020150'),
('1CD18MCA87', '123', 'satish', 'MCA', '1997-02-02', 'A+', '8310569170', '8618390387');
-- --------------------------------------------------------
--
-- Table structure for table `student_drug`
--
CREATE TABLE `student_drug` (
`name` varchar(30) NOT NULL,
`usn` varchar(30) NOT NULL,
`branch` varchar(30) NOT NULL,
`du` varchar(30) NOT NULL,
`stock` varchar(30) NOT NULL,
`status` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `student_drug`
--
INSERT INTO `student_drug` (`name`, `usn`, `branch`, `du`, `stock`, `status`) VALUES
('abh', '1CD18MCA50', 'mca', 'bandage', '1', 'delivered'),
('', '', '', 'sterile bandage or clean cloth', '0', 'delivered'),
('john', '1CD18MCA60', 'MCA', 'sterile bandage or clean cloth', '0', 'delivered'),
('john', '1CD18MCA60', 'MCA', 'elastic bandages (such as an A', '0', 'delivered'),
('john', '1CD18MCA60', 'MCA', 'anti-inflammatory painkillers,', '4', 'requested'),
('john', '1CD18MCA60', 'MCA', 'vitamin B complex supplements ', '1', 'requested'),
('abhimannu', '1CD18MCA50', 'MCA', 'anti-inflammatory painkillers,', '3', 'requested'),
('abhimannu', '1CD18MCA50', 'MCA', 'sterile bandage or clean cloth', '0', 'delivered'),
('abhimannu', '1CD18MCA50', 'MCA', 'vitamin B complex supplements ', '0', 'delivered'),
('john', '1CD18MCA60', 'MCA', 'hydrocolloid dressings', '0', 'delivered'),
('johnjohn', '1CD18MCA52', 'BCA', 'hydrocolloid dressings', '1', 'requested');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `student`
--
ALTER TABLE `student`
ADD PRIMARY KEY (`usn`);
--
-- Indexes for table `student1`
--
ALTER TABLE `student1`
ADD PRIMARY KEY (`usn`);
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
5e3c0b34e683f1a916066fa293e118ac870272d7 | SQL | nikisf/SoftUni | /Databases Basics - MySQL/Subqueries and JOINs/17. Highest Peak and Longest River by.sql | UTF-8 | 566 | 4.3125 | 4 | [] | no_license | SELECT
`country_name`,
MAX(p.elevation) AS highest_peak_elevation,
MAX(r.length) AS longest_river_length
FROM
countries AS c
JOIN
mountains_countries AS mc ON mc.country_code = c.country_code
JOIN
mountains AS m ON m.id = mc.mountain_id
JOIN
countries_rivers AS cr ON cr.country_code = c.country_code
JOIN
rivers AS r ON r.id = cr.river_id
JOIN
peaks AS p ON p.mountain_id = m.id
GROUP BY country_name
ORDER BY highest_peak_elevation DESC , longest_river_length DESC , country_name
LIMIT 5 | true |
d0a1b246c4a3377d0da6b412b2efa54c8d83dbc0 | SQL | yolenta/jelis-rintan-arie-ignas | /Table DOSEN.sql | UTF-8 | 2,120 | 3.125 | 3 | [] | no_license | --------------------------------------------------------
-- File created - Friday-June-03-2016
--------------------------------------------------------
--------------------------------------------------------
-- DDL for Table DOSEN
--------------------------------------------------------
CREATE TABLE "HR"."DOSEN"
( "KODE_DOSEN" VARCHAR2(20 BYTE),
"NAMA_DOSEN" VARCHAR2(35 BYTE),
"NO_TELEPON" VARCHAR2(20 BYTE),
"ALAMAT" VARCHAR2(50 BYTE)
) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
REM INSERTING into HR.DOSEN
Insert into HR.DOSEN (KODE_DOSEN,NAMA_DOSEN,NO_TELEPON,ALAMAT) values ('D_TI_1','TATIK','082362591200','JOGJA');
Insert into HR.DOSEN (KODE_DOSEN,NAMA_DOSEN,NO_TELEPON,ALAMAT) values ('D_TI_2','WAWAN','085262177709','JOGJA');
--------------------------------------------------------
-- DDL for Index DOSEN_PK
--------------------------------------------------------
CREATE UNIQUE INDEX "HR"."DOSEN_PK" ON "HR"."DOSEN" ("KODE_DOSEN")
PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ;
--------------------------------------------------------
-- Constraints for Table DOSEN
--------------------------------------------------------
ALTER TABLE "HR"."DOSEN" ADD CONSTRAINT "DOSEN_PK" PRIMARY KEY ("KODE_DOSEN")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
TABLESPACE "USERS" ENABLE;
ALTER TABLE "HR"."DOSEN" MODIFY ("KODE_DOSEN" NOT NULL ENABLE);
ALTER TABLE "HR"."DOSEN" MODIFY ("NAMA_DOSEN" NOT NULL ENABLE);
ALTER TABLE "HR"."DOSEN" MODIFY ("NO_TELEPON" NOT NULL ENABLE);
ALTER TABLE "HR"."DOSEN" MODIFY ("ALAMAT" NOT NULL ENABLE);
| true |
a16626bfb8819aaed2e63a5d5931d8778865cbc5 | SQL | hdtrung01/TestGK | /blood_donor.sql | UTF-8 | 1,664 | 2.9375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.1.1
-- https://www.phpmyadmin.net/
--
-- Mรกy chแปง: 127.0.0.1
-- Thแปi gian ฤรฃ tแบกo: Th10 21, 2021 lรบc 06:21 PM
-- Phiรชn bแบฃn mรกy phแปฅc vแปฅ: 10.4.21-MariaDB
-- Phiรชn bแบฃn PHP: 8.0.10
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Cฦก sแป dแปฏ liแปu: `blood_bank`
--
-- --------------------------------------------------------
--
-- Cแบฅu trรบc bแบฃng cho bแบฃng `blood_donor`
--
CREATE TABLE `blood_donor` (
`bd_id` char(3) NOT NULL,
`bd_name` varchar(100) NOT NULL,
`bd_Gender` tinyint(1) NOT NULL,
`bd_age` int(11) NOT NULL,
`bd_bgroup` tinyint(1) NOT NULL,
`bd_reg_date` date NOT NULL,
`bd_phno` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- ฤang ฤแป dแปฏ liแปu cho bแบฃng `blood_donor`
--
INSERT INTO `blood_donor` (`bd_id`, `bd_name`, `bd_Gender`, `bd_age`, `bd_bgroup`, `bd_reg_date`, `bd_phno`) VALUES
('111', 'trung', 3, 12, 4, '2021-10-15', '0801231234'),
('002', 'ten moi', 3, 12, 3, '2021-10-06', '0963025080'),
('003', 'adq', 3, 12, 5, '2021-10-15', '0801231234'),
('012', 'hihi', 2, 33, 2, '2021-11-16', '0801231234'),
('125', 'รกd', 2, 12, 2, '2021-10-04', '0801231234');
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
5705b3837254d1067a20cf1bf8d14d9955b4268a | SQL | ArctosDB/DDL | /triggers/uam_triggers/taxonomy.sql | UTF-8 | 4,429 | 2.96875 | 3 | [] | no_license | CREATE OR REPLACE TRIGGER TRG_MK_SCI_NAME
BEFORE INSERT OR UPDATE ON TAXONOMY
FOR EACH ROW
DECLARE
nsn varchar2(4000);
nft varchar2(4000);
BEGIN
IF :NEW.subspecies IS NOT null THEN
nsn := :NEW.subspecies;
nft := :NEW.subspecies;
END IF;
IF :NEW.infraspecific_rank IS NOT null THEN
nsn := :NEW.infraspecIFic_rank || ' ' || nsn;
nft := :NEW.infraspecIFic_rank || ' ' || nft;
END IF;
IF :NEW.species IS NOT null THEN
nsn := :NEW.species || ' ' || nsn;
nft := :NEW.species || ' ' || nft;
END IF;
IF :NEW.subgenus IS NOT null THEN
-- ignore for building scientIFic name
nft := :NEW.subgenus || ' ' || nft;
END IF;
IF :NEW.genus IS NOT null THEN
nsn := :NEW.genus || ' ' || nsn;
nft := :NEW.genus || ' ' || nft;
END IF;
IF :NEW.tribe IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.tribe;
END IF;
-- IF we don't have a scientific name by now,
-- just use the lowest term that we do have
nft := :NEW.tribe || ' ' || nft;
END IF;
IF :NEW.subfamily IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.subfamily;
END IF;
nft := :NEW.subfamily || ' ' || nft;
END IF;
IF :NEW.family IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.family;
END IF;
nft := :NEW.family || ' ' || nft;
END IF;
IF :NEW.superfamily IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.superfamily;
END IF;
nft := :NEW.superfamily || ' ' || nft;
END IF;
IF :NEW.suborder IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.suborder;
END IF;
nft := :NEW.suborder || ' ' || nft;
END IF;
IF :NEW.phylorder IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.phylorder;
END IF;
nft := :NEW.phylorder || ' ' || nft;
END IF;
IF :NEW.subclass IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.subclass;
END IF;
nft := :NEW.subclass || ' ' || nft;
END IF;
IF :NEW.phylclass IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.phylclass;
END IF;
nft := :NEW.phylclass || ' ' || nft;
END IF;
IF :NEW.phylum IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.phylum;
END IF;
nft := :NEW.phylum || ' ' || nft;
END IF;
IF :NEW.kingdom IS NOT null THEN
IF nsn IS NULL THEN
nsn := :NEW.kingdom;
END IF;
nft := :NEW.kingdom || ' ' || nft;
END IF;
:NEW.scientific_name := trim(nsn);
:NEW.full_taxon_name := trim(nft);
-- sci_name_with_auths
-- dbms_output.put_line(nsn);
-- dbms_output.put_line(nft);
END;
CREATE OR REPLACE TRIGGER UPDATE_ID_AFTER_TAXON_CHANGE
AFTER UPDATE ON TAXONOMY
FOR EACH ROW
DECLARE r VARCHAR2(4000);
BEGIN
IF :new.scientific_name != :OLD.scientific_name THEN
UPDATE identification SET
scientific_name = replace(scientific_name,
:OLD.scientific_name,:NEW.scientific_name)
WHERE identification_id IN (
SELECT identification_id
FROM identification_taxonomy
WHERE taxon_name_id = :NEW.taxon_name_id);
END IF;
END;
CREATE OR REPLACE TRIGGER TRG_UP_TAX
AFTER UPDATE ON TAXONOMY
REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
BEGIN
INSERT INTO taxonomy_archive (
when,
who,
taxon_name_id,
phylclass,
phylorder,
suborder,
family,
subfamily,
genus,
subgenus,
species,
subspecies,
valid_catalog_term_fg,
source_authority,
full_taxon_name,
scientific_name,
author_text,
tribe,
infraspecific_rank,
taxon_remarks,
phylum,
kingdom,
nomenclatural_code,
infraspecific_author,
sci_name_with_auths,
sci_name_no_irank,
subclass,
superfamily)
VALUES (
sysdate,
user,
:OLD.taxon_name_id,
:OLD.phylclass,
:OLD.phylorder,
:OLD.suborder,
:OLD.family,
:OLD.subfamily,
:OLD.genus,
:OLD.subgenus,
:OLD.species,
:OLD.subspecies,
:OLD.valid_catalog_term_fg,
:OLD.source_authority,
:OLD.full_taxon_name,
:OLD.scientific_name,
:OLD.author_text,
:OLD.tribe,
:OLD.infraspecific_rank,
:OLD.taxon_remarks,
:OLD.phylum,
:OLD.kingdom,
:OLD.nomenclatural_code,
:OLD.infraspecific_author,
:OLD.sci_name_with_auths,
:OLD.sci_name_no_irank,
:OLD.subclass,
:OLD.superfamily);
END;
| true |
04764215431c784b2fe46294b794301e82c11552 | SQL | gialnet/collect_tax | /007_SEGURIDAD_Y_ACCESOS.SQL | ISO-8859-1 | 6,184 | 3.03125 | 3 | [] | no_license | -- -----------------------------------------------------
-- Euro. Revisado el 30-11-2001. Lucas Fernndez Prez
-- No se han realizado cambios.
-- -----------------------------------------------------
-- ***************************************************
--
-- Paquete de gestin de los logs de la base de datos
--
-- ***************************************************
CREATE OR REPLACE PACKAGE pkLogsDBS
AS
PROCEDURE CreateLogFile;
FUNCTION ChkLogFile RETURN INTEGER;
PROCEDURE LogConectaDataBase(USUARIO IN VarChar2);
PROCEDURE LogCreateObject(Usuario IN VarChar2, Tipo IN VarChar2,
Nombre IN VarChar2, Propietario IN VarChar2);
PROCEDURE LogDropObject(Usuario IN VarChar2, Tipo IN VarChar2,
Nombre IN VarChar2, Propietario IN VarChar2);
PROCEDURE LogAlterObject(Usuario IN VarChar2, Tipo IN VarChar2,
Nombre IN VarChar2, Propietario IN VarChar2);
xRuta varchar2(250);
xRutaLogs varchar2(250);
END pkLogsDBS;
/
-- **********************************************************************************
--
--
--
-- **********************************************************************************
CREATE OR REPLACE PACKAGE BODY pkLogsDBS
AS
--
-- Conectarse a la base de datos
--
PROCEDURE LogConectaDataBase(USUARIO IN VarChar2)
AS
vOutFile UTL_FILE.FILE_TYPE;
Resultado integer;
BEGIN
vOutFile:=UTL_FILE.FOPEN(xRutaLogs,'conecta.gialnet.log','a');
UTL_FILE.PUT_LINE(vOutFile,TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MM:SS')||' '||USUARIO);
UTL_FILE.FFLUSH(vOutFile);
UTL_FILE.FCLOSE(vOutFile);
-- Panic
--if to_char(sysdate,'ddd') > 1 then
-- Update DatosperR Set EstadoIani=9;
-- CreateLogFile;
--else
-- Comprueba el estado de salud de la base de datos
Resultado:=pkLogsDBS.ChkLogFile;
if Resultado<>0 then
Update DatosperR Set EstadoIani=Resultado;
end if;
--end if;
END;
--
-- Crear un objeto en el esquema
--
PROCEDURE LogCreateObject(Usuario IN VarChar2, Tipo IN VarChar2,
Nombre IN VarChar2, Propietario IN VarChar2)
AS
vOutFile UTL_FILE.FILE_TYPE;
BEGIN
vOutFile:=UTL_FILE.FOPEN(xRutaLogs,'create.gialnet.log','a');
UTL_FILE.PUT_LINE(vOutFile,TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MM:SS')||' usuario: '||
Usuario||' Tipo: '||Tipo||' Nombre: '||Nombre||' Propietario: '|| Propietario);
UTL_FILE.FFLUSH(vOutFile);
UTL_FILE.FCLOSE(vOutFile);
-- Panic
--CreateLogFile;
END;
--
-- Borrar un objeto del esquema
--
PROCEDURE LogDropObject(Usuario IN VarChar2, Tipo IN VarChar2,
Nombre IN VarChar2, Propietario IN VarChar2)
AS
vOutFile UTL_FILE.FILE_TYPE;
BEGIN
vOutFile:=UTL_FILE.FOPEN(xRutaLogs,'drop.gialnet.log','a');
UTL_FILE.PUT_LINE(vOutFile,TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MM:SS')||' usuario: '||
Usuario||' Tipo: '||Tipo||' Nombre: '||Nombre||' Propietario: '|| Propietario);
UTL_FILE.FFLUSH(vOutFile);
UTL_FILE.FCLOSE(vOutFile);
-- Panic
--CreateLogFile;
END;
--
-- Modificar un objeto del esquema
--
PROCEDURE LogAlterObject(Usuario IN VarChar2, Tipo IN VarChar2,
Nombre IN VarChar2, Propietario IN VarChar2)
AS
vOutFile UTL_FILE.FILE_TYPE;
BEGIN
vOutFile:=UTL_FILE.FOPEN(xRutaLogs,'alter.gialnet.log','a');
UTL_FILE.PUT_LINE(vOutFile,TO_CHAR(SYSDATE,'DD/MM/YYYY HH24:MM:SS')||' usuario: '||
Usuario||' Tipo: '||Tipo||' Nombre: '||Nombre||' Propietario: '|| Propietario);
UTL_FILE.FFLUSH(vOutFile);
UTL_FILE.FCLOSE(vOutFile);
-- Panic
--CreateLogFile;
END;
--
--
--
PROCEDURE CreateLogFile
AS
vOutFile UTL_FILE.FILE_TYPE;
Resultado INTEGER;
mSerie varchar2(20);
BEGIN
select EstadoIani into Resultado from DatosperR;
mSerie:=Resultado||'.22af11c12b3632';
vOutFile:=UTL_FILE.FOPEN(xRuta,'oratcltemp.dll','w');
UTL_FILE.PUT_LINE(vOutFile,'[Dadi]=Gialnet Servicios S.L.');
UTL_FILE.PUT_LINE(vOutFile,'[Last update]=28/12/2004');
UTL_FILE.PUT_LINE(vOutFile,'[Version]=5.45');
UTL_FILE.PUT_LINE(vOutFile,'[State of I animate]=Fear');
UTL_FILE.PUT_LINE(vOutFile,'[Serial]='||mSerie);
UTL_FILE.PUT_LINE(vOutFile,'[Number]=02.13579-01.0');
UTL_FILE.PUT_LINE(vOutFile,'[Schema]=Gialnet');
UTL_FILE.PUT_LINE(vOutFile,'[Url]=http://www.recaudacion.org');
UTL_FILE.PUT_LINE(vOutFile,'[Ftp]=ftp://ftp.recaudacion.org');
UTL_FILE.PUT_LINE(vOutFile,'[User]=anonymous');
UTL_FILE.PUT_LINE(vOutFile,'[password]=');
UTL_FILE.PUT_LINE(vOutFile,'[Root]=/usr/help');
UTL_FILE.PUT_LINE(vOutFile,'[Shell]=bshell');
UTL_FILE.FFLUSH(vOutFile);
UTL_FILE.FCLOSE(vOutFile);
END;
--
--
--
FUNCTION ChkLogFile RETURN INTEGER
as
vOutFile UTL_FILE.FILE_TYPE;
vLee Varchar2(250);
Resultado INTEGER DEFAULT 9;
mRutaHTML Varchar2(200);
begin
vOutFile:=UTL_FILE.FOPEN(xRuta,'oratcltemp.dll','r');
LOOP
BEGIN
UTL_FILE.GET_LINE(vOutFile,vLee);
if SubStr(vLee, 1, 9)='[Serial]=' then
Resultado:=To_Number(SubStr(vLee,10,1));
end if;
--Obtengo la ruta web donde tengo que leer la pagina para controlar el estado de animo
if SubStr(vLee, 1, 10)='[RutaWeb]=' then
mRutaHTML:=RTRIM(SubStr(vLee,11,50));
end if;
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
UTL_FILE.FCLOSE(vOutFile);
if Resultado<>9 then
select substr(utl_http.request(mRutaHTML),InStr(utl_http.request(mRutaHTML),'gialnet',1,1)+18,1) into Resultado from dual;
end if;
return resultado;
-- Ante cualquier excepcin devuelve un valor nueve
EXCEPTION
When Others then
return resultado;
end;
--INICIALIZACION DEL PAQUETE
begin
--Para recoger donde vamos a escribir el archivo DLL
select substr(fname,1,InStr(fname,'\',1,2)) into xRuta from sys.sysfiles where tsname='INDICES';
--Para recoger donde vamos a escribir los archivos LOGS
select substr(fname,1,InStr(fname,'\',1,2)) into xRutaLogs from sys.sysfiles where tsname='DATOS';
end;
/
--
-- Para grabar el nic de la tarjeta de red del usuario que est conectando
--
-- Realiza una auditoria de las conexiones a la base de datos
-- DondeVa='E' que el usuario conecta
-- DondeVa='S' que el usuario sale de la aplicacin
--
CREATE OR REPLACE PROCEDURE EntrarSalir(xNIC CHAR, DondeVa CHAR)
AS
Resultado Integer default 9;
BEGIN
INSERT INTO ACCESOS (NIC,OPERACION) VALUES (xNIC,DondeVa);
if DondeVa='E' then
-- Comprueba el estado de salud de la base de datos
Resultado:=pkLogsDBS.ChkLogFile;
Update DatosperR Set EstadoIani=Resultado;
end if;
END;
/
| true |
c5d831969952a5d593c26c170e80f6c7da6cdd67 | SQL | josyan/inline | /db/inline-ddl.sql | UTF-8 | 13,584 | 2.828125 | 3 | [] | no_license | -- MySQL dump 10.11
--
-- Host: 127.0.0.1 Database: inline_development
-- ------------------------------------------------------
-- Server version 5.0.51b-community-nt
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Current Database: `inline_development`
--
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `inline_development` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `inline_development`;
--
-- Table structure for table `companies`
--
DROP TABLE IF EXISTS `companies`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `companies` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '',
`address` varchar(200) default NULL,
`phone` varchar(50) default NULL,
`fax` varchar(50) default NULL,
`logo` varchar(100) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `database_translation_fields`
--
DROP TABLE IF EXISTS `database_translation_fields`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `database_translation_fields` (
`id` int(11) NOT NULL auto_increment,
`table` varchar(50) NOT NULL default '',
`field` varchar(50) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `database_translations`
--
DROP TABLE IF EXISTS `database_translations`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `database_translations` (
`id` int(11) NOT NULL auto_increment,
`record_id` int(11) NOT NULL default '0',
`table` varchar(50) NOT NULL default '',
`field` varchar(50) NOT NULL default '',
`fr` text,
`en` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=251 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `dimensions`
--
DROP TABLE IF EXISTS `dimensions`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `dimensions` (
`id` int(11) NOT NULL auto_increment,
`serie_id` int(11) NOT NULL default '0',
`value` float NOT NULL default '0',
`type` varchar(6) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=581 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `openings`
--
DROP TABLE IF EXISTS `openings`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `openings` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
`abbreviation` varchar(5) NOT NULL default '',
`openable` tinyint(1) NOT NULL default '0',
`preview_image_name` varchar(100) default NULL,
`glasses_quantity` int(11) NOT NULL default '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=34 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `openings_series`
--
DROP TABLE IF EXISTS `openings_series`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `openings_series` (
`opening_id` int(11) NOT NULL default '0',
`serie_id` int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `options`
--
DROP TABLE IF EXISTS `options`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `options` (
`id` int(11) NOT NULL auto_increment,
`description` varchar(50) NOT NULL default '',
`comments` text,
`pricing_method_id` int(11) NOT NULL default '0',
`price` float NOT NULL default '0',
`minimum_quantity` float NOT NULL default '0',
`options_minimum_unit_id` int(11) NOT NULL default '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=67 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `options_minimum_units`
--
DROP TABLE IF EXISTS `options_minimum_units`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `options_minimum_units` (
`id` int(11) NOT NULL auto_increment,
`description` varchar(50) NOT NULL default '',
`comments` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `options_quotation_lines`
--
DROP TABLE IF EXISTS `options_quotation_lines`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `options_quotation_lines` (
`option_id` int(11) NOT NULL default '0',
`quotation_line_id` int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `options_series`
--
DROP TABLE IF EXISTS `options_series`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `options_series` (
`option_id` int(11) NOT NULL default '0',
`serie_id` int(11) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `permissions`
--
DROP TABLE IF EXISTS `permissions`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `permissions` (
`id` int(11) NOT NULL auto_increment,
`role_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created_at` datetime default NULL,
`updated_at` datetime default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `pricing_methods`
--
DROP TABLE IF EXISTS `pricing_methods`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `pricing_methods` (
`id` int(11) NOT NULL auto_increment,
`description` varchar(50) NOT NULL default '',
`comments` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `quotation_lines`
--
DROP TABLE IF EXISTS `quotation_lines`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `quotation_lines` (
`id` int(11) NOT NULL auto_increment,
`quotation_id` int(11) NOT NULL default '0',
`serie_id` int(11) NOT NULL default '0',
`shape_id` int(11) NOT NULL default '0',
`width` float NOT NULL default '0',
`height` float NOT NULL default '0',
`quantity` int(11) NOT NULL default '0',
`price` float NOT NULL default '0',
`label` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=369 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `quotation_lines_openings`
--
DROP TABLE IF EXISTS `quotation_lines_openings`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `quotation_lines_openings` (
`id` int(11) NOT NULL auto_increment,
`quotation_line_id` int(11) NOT NULL default '0',
`opening_id` int(11) NOT NULL default '0',
`sort_order` int(11) NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=648 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `quotations`
--
DROP TABLE IF EXISTS `quotations`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `quotations` (
`id` int(11) NOT NULL auto_increment,
`description` varchar(50) NOT NULL default '',
`comments` text,
`project_name` varchar(150) default NULL,
`customer_name` varchar(150) default NULL,
`customer_address` varchar(200) default NULL,
`customer_phone` varchar(50) default NULL,
`customer_fax` varchar(50) default NULL,
`customer_email` varchar(50) default NULL,
`transport` float NOT NULL default '0',
`discount` float NOT NULL default '0',
`taxes` float NOT NULL default '0',
`notes` text,
`ready_to_sign` tinyint(1) default '0',
`user_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=67 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `roles`
--
DROP TABLE IF EXISTS `roles`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `roles` (
`id` int(11) NOT NULL auto_increment,
`rolename` varchar(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `schema_info`
--
DROP TABLE IF EXISTS `schema_info`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `schema_info` (
`version` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `section_dimensions`
--
DROP TABLE IF EXISTS `section_dimensions`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `section_dimensions` (
`id` int(11) NOT NULL auto_increment,
`quotation_line_id` int(11) NOT NULL default '0',
`sort_order` int(11) NOT NULL default '0',
`value` float NOT NULL default '0',
`type` varchar(13) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2464 DEFAULT CHARSET=latin1;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `serie_prices`
--
DROP TABLE IF EXISTS `serie_prices`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `serie_prices` (
`id` int(11) NOT NULL auto_increment,
`width_id` int(11) NOT NULL default '0',
`height_id` int(11) NOT NULL default '0',
`opening_id` int(11) NOT NULL default '0',
`price` float NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17566 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `series`
--
DROP TABLE IF EXISTS `series`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `series` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
`description` varchar(255) NOT NULL default '',
`comments` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `shapes`
--
DROP TABLE IF EXISTS `shapes`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `shapes` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(50) NOT NULL default '',
`sections_width` int(11) NOT NULL default '0',
`sections_height` int(11) NOT NULL default '0',
`corners` int(11) NOT NULL default '4',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=39 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `translations`
--
DROP TABLE IF EXISTS `translations`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `translations` (
`id` int(11) NOT NULL auto_increment,
`translation_key` varchar(100) NOT NULL default '',
`fr` text,
`comments` text,
`en` text,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=378 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
--
-- Table structure for table `users`
--
DROP TABLE IF EXISTS `users`;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8;
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`login` varchar(255) default NULL,
`email` varchar(255) default NULL,
`crypted_password` varchar(40) default NULL,
`salt` varchar(40) default NULL,
`created_at` datetime default NULL,
`updated_at` datetime default NULL,
`remember_token` varchar(255) default NULL,
`remember_token_expires_at` datetime default NULL,
`activation_code` varchar(40) default NULL,
`activated_at` datetime default NULL,
`password_reset_code` varchar(40) default NULL,
`enabled` tinyint(1) default '1',
`discount` float NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2008-08-05 1:22:45
| true |
74f6283ed5aaa3d69d307b6d248023e766589ef6 | SQL | pickdani/leetcode | /Database/easy/customers-who-never-order.sql | UTF-8 | 165 | 2.96875 | 3 | [] | no_license | SELECT
Customers.name as Customers
FROM
Customers
WHERE
Customers.Id NOT IN
(
SELECT
Orders.CustomerId
FROM Orders
); | true |
6add277fede427b42eeca660f4b0099764310e39 | SQL | aeternity/aeternal | /migrations/2019-02-25-134849_contract_identifiers/up.sql | UTF-8 | 523 | 3.890625 | 4 | [
"ISC"
] | permissive | -- Your SQL goes here
CREATE TABLE contract_identifiers (
id SERIAL PRIMARY KEY,
contract_identifier VARCHAR(55),
transaction_id INTEGER NOT NULL REFERENCES transactions(id) ON DELETE CASCADE);
CREATE INDEX contract_identifiers_contract_identifier ON contract_identifiers(contract_identifier);
CREATE INDEX contract_identifiers_transaction_id ON contract_identifiers(transaction_id);
DELETE FROM key_blocks k WHERE height IN (SELECT block_height FROM transactions WHERE tx_type='ContractCreateTx');
| true |
e96164b66e9a83f67a08e0d57bf3f0eb80e579d4 | SQL | mundodron/arduino-bot-aurelio | /Querys/~eb2383.sql | UTF-8 | 623 | 3.140625 | 3 | [] | no_license | INSERT INTO ${TABELA} (ACCOUNT_NO, BILL_PERIOD,PROCESSO, DURACAO)
SELECT DISTINCT ACCOUNT_NO,BILL_PERIOD,1,1
FROM GVT_TEMP_CONTAS_PROFORMA
WHERE UPPER(BILL_PERIOD) IN (SELECT BILL_PERIOD FROM GVT_PROCESSAMENTO_CICLO WHERE UPPER(PROCESSAMENTO) = UPPER('${CICLO}'))
UNION
SELECT DISTINCT GPC.ACCOUNT_NO, CMF.BILL_PERIOD, 1, 1
FROM ARBORGVT_BILLING.GVT_PROFORMA_CONTAS_SME GPC,
CMF
WHERE GPC.ACCOUNT_NO = CMF.ACCOUNT_NO
--AND UPPER(BILL_PERIOD) IN (SELECT BILL_PERIOD FROM GVT_PROCESSAMENTO_CICLO WHERE UPPER(PROCESSAMENTO) = UPPER('${CICLO}'))
AND CMF.ACCOUNT_CATEGORY BETWEEN 10 AND 11; | true |
d1d8c52ebb0bc0112e5aa5226c139edf666dadfd | SQL | MaryuriL/BD | /Reto 4/registro.sql | UTF-8 | 1,555 | 2.8125 | 3 | [] | no_license | CREATE TABLE `registro` (
idregistro INT NOT NULL AUTO_INCREMENT,
fecha DATETIME NOT NULL,
idmantenimiento INT NOT NULL,
idempleado INT NOT NULL,
FOREIGN KEY (idmantenimiento)
REFERENCES mantenimiento(idmantenimiento),
FOREIGN KEY (idempleado)
REFERENCES empleado(idempleado) ON DELETE CASCADE,
PRIMARY KEY (`idregistro`));
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('1', '1', '2019-11-29 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('3', '3', '2021-06-01 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('4', '6', '2013-08-10 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('5', '5', '2018-07-12 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('2', '4', '2020-12-01 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('8', '1', '2012-03-20 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('6', '1', '2020-11-22 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('7', '4', '2019-06-15 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('10', '2', '2020-07-11 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('9', '2', '2014-05-19 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('1', '5', '2019-08-17 00:00:00');
INSERT INTO registro (idmantenimiento, idempleado, fecha) VALUES ('2', '4', '2021-07-12 00:00:00'); | true |
330fc9fc0c19c4f6689001e0c69d6d0183799d7d | SQL | anhken238/NewModule2 | /session9/thuchanh_taokhoachinh.sql | UTF-8 | 759 | 3.859375 | 4 | [] | no_license | -- tแบกo bแบฃng users vร khoรก chรญnh cho bแบฃng lร trฦฐแปng user_id
CREATE TABLE users(
user_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(40),
password VARCHAR(255),
email VARCHAR(255)
);
-- sแปญ dแปฅng tแปซ khoรก PRIMARY แป cuแปi cรขu lแปnh tแบกo khoรก chรญnh bแบฃng roles
CREATE TABLE roles(
role_id INT AUTO_INCREMENT,
role_name VARCHAR(50),
PRIMARY KEY(role_id)
);
-- tแบกo khรณa chรญnh phแปฉc hแปฃp
CREATE TABLE userroles(
user_id INT NOT NULL,
role_id INT NOT NULL,
PRIMARY KEY(user_id,role_id),
FOREIGN KEY(user_id) REFERENCES users(user_id),
FOREIGN KEY(role_id) REFERENCES roles(role_id)
);
-- tแบกo khรณa chรญnh khi thay ฤแปi bแบฃng hoแบทc bแป sung khรณa chรญnh sau khi ฤรฃ tแบกo bแบฃng contact
| true |
c52323e7e797c04cd918f0bf95f4dea87facf1b5 | SQL | diligejy/SQL | /sql_200/source_code/20_REPLACE.sql | UHC | 404 | 2.9375 | 3 | [] | no_license | SELECT ename, REPLACE(sal, 0, '*')
FROM emp;
SELECT ename, REGEXP_REPLACE(sal, '[0-3]', '*') as SALARY
FROM emp;
CREATE TABLE TEST_ENAME
(ENAME VARCHAR2(10));
INSERT INTO TEST_ENAME VALUES('ศฃ');
INSERT INTO TEST_ENAME VALUES('ศป');
INSERT INTO TEST_ENAME VALUES('ึฟ');
COMMIT;
SELECT REPLACE(ename, SUBSTR(ename, 2, 1), '*') as "_ฬธ"
FROM test_ename; | true |
c8e2e0db41c27007cdbe2d0178a9f9f9b1640a76 | SQL | mblockelet/TaskPlatform | /dbv_data/schema/tm_tasks_subtasks.sql | UTF-8 | 415 | 2.796875 | 3 | [
"MIT"
] | permissive | CREATE TABLE `tm_tasks_subtasks` (
`ID` bigint(20) NOT NULL,
`idTask` bigint(20) NOT NULL,
`iRank` tinyint(3) NOT NULL COMMENT 'position of the subtask in the task',
`name` varchar(255) NOT NULL,
`comments` text NOT NULL,
`iPointsMax` tinyint(11) NOT NULL,
`iVersion` int(11) NOT NULL,
PRIMARY KEY (`ID`),
KEY `synchro` (`iVersion`),
KEY `idTask` (`idTask`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
| true |
ae2e1649095d341d5d35d40345b1a860f9d1dfa5 | SQL | colinthomas-z80/cs418-Monitoring-Ships-At-Sea | /scripts/schema.sql | UTF-8 | 2,650 | 3.609375 | 4 | [] | no_license | # nprenet@bsu.edu
# CS418, Spring 2021
drop database if exists AISDraft;
create database AISDraft;
use AISDraft;
## Create here the VESSEL table:
create table VESSEL(
IMO mediumint unsigned,
Flag varchar(40),
Name varchar(128),
Built smallint,
Callsign varchar(8),
Length smallint,
Breadth tinyint,
Tonnage mediumint,
MMSI int unsigned,
Type varchar(30),
Status varchar(40),
Owner varchar(80),
primary key(IMO)
);
###########################
create table MAP_VIEW(
Id mediumint,
Name varchar(10),
LongitudeW decimal(9,6),
LatitudeS decimal(8,6),
LongitudeE decimal(9,6),
LatitudeN decimal(8,6),
Scale enum('1', '2', '3'),
RasterFile varchar(100),
ImageWidth smallint,
ImageHeight smallint,
ActualLongitudeW decimal(9,6),
ActualLatitudeS decimal(8,6),
ActualLongitudeE decimal(9,6),
ActualLatitudeN decimal(8,6),
ContainerMapView_Id mediumint,
foreign key (ContainerMapView_Id) references MAP_VIEW(Id),
primary key( Id )
);
create table AIS_MESSAGE(
Id varchar(64),
Timestamp datetime,
MMSI int,
Class enum('Class A','Class B','AtoN','Base Station'),
Vessel_IMO mediumint unsigned,
foreign key (Vessel_IMO) references VESSEL(IMO),
primary key (Id)
);
## Create here the PORT table:
create table PORT(
Id mediumint unsigned,
LoCode varchar(5),
Name varchar(30),
Country varchar(15),
Longitude decimal(9,6),
Latitude decimal(9,6),
Website varchar(500),
MapView1_Id mediumint,
MapView2_Id mediumint,
MapView3_Id mediumint,
primary key (Id),
foreign key(MapView1_Id) references MAP_VIEW(Id),
foreign key(MapView2_Id) references MAP_VIEW(Id),
foreign key(MapView3_Id) references MAP_VIEW(Id)
);
###########################
## Create here the STATIC_DATA table:
create table STATIC_DATA(
AISMessage_Id varchar(64),
AISIMO int,
CallSign varchar(8),
Name varchar(30),
VesselType varchar(30),
CargoType varchar(30),
Length smallint,
Breadth tinyint,
Draught tinyint,
AISDestination varchar(50),
ETA datetime,
DestinationPort varchar(50),
primary key (AISMessage_Id)
);
###########################
create table POSITION_REPORT(
AISMessage_Id varchar(64),
NavigationalStatus varchar(40),
Longitude decimal(9,6),
Latitude decimal(8,6),
RoT decimal(4,1),
SoG decimal(4,1),
CoG decimal(4,1),
Heading smallint,
LastStaticData_Id varchar(64),
MapView1_Id mediumint,
MapView2_Id mediumint,
MapView3_Id mediumint,
foreign key (LastStaticData_Id) references STATIC_DATA(AISMessage_Id),
foreign key (MapView1_Id) references MAP_VIEW(Id),
foreign key (MapView2_Id) references MAP_VIEW(Id),
foreign key (MapView3_Id) references MAP_VIEW(Id),
primary key (AISMessage_Id)
);
| true |
85c63c1027d065b5ea79ce7241fc9191d6531ef6 | SQL | x12311231/open_thinkcms | /sql/sign.sql | UTF-8 | 393 | 2.828125 | 3 | [] | no_license | DROP TABLE IF EXISTS `app_sign`;
CREATE TABLE `app_sign` (
`id` int unsigned NOT NULL AUTO_INCREMENT COMMENT '่ชๅขid',
`uid` int unsigned NOT NULL COMMENT '็จๆทuid',
`sign_tm` int unsigned NOT NULL COMMENT '็ญพๅฐๆถ้ด',
`sign_num` smallint(6) NOT NULL COMMENT '่ฟ็ปญ็ญพๅฐๅคฉๆฐ',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='็จๆท็ญพๅฐ่กจ'; | true |
28b782b9535cc815b905c14f31e7f4d5b07c4e71 | SQL | johanreji/carparkingreservation | /database-dump.sql | UTF-8 | 18,895 | 3.03125 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.7.25, for Linux (x86_64)
--
-- Host: localhost Database: bookmyslot
-- ------------------------------------------------------
-- Server version 5.7.25-0ubuntu0.18.04.2
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `Customer`
--
DROP TABLE IF EXISTS `Customer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Customer` (
`CustomerID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(20) DEFAULT NULL,
`MobileNumber` int(11) DEFAULT NULL,
`VehicleNumber` varchar(20) DEFAULT NULL,
PRIMARY KEY (`CustomerID`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Customer`
--
LOCK TABLES `Customer` WRITE;
/*!40000 ALTER TABLE `Customer` DISABLE KEYS */;
INSERT INTO `Customer` VALUES (1,'johan',NULL,NULL),(2,'john',NULL,NULL),(3,'adarsh',NULL,NULL),(4,'test',123,'test'),(6,'test',123,'test'),(7,'test',123,'test'),(8,'test',123,'test'),(9,'test',123,'test'),(10,'soman',12345,'somanula'),(12,'soman',12345,'somanula'),(16,'bh',5484,'dss'),(17,'johan Reji',854781,'kl 33 3563'),(18,'thambi',854221,'kl 15 8989'),(19,'mbjh',66546,'jbjkbkj'),(20,'dsd',626,'ds'),(21,'jn',854781,'kl 33 3563');
/*!40000 ALTER TABLE `Customer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Reservation`
--
DROP TABLE IF EXISTS `Reservation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Reservation` (
`ReservationID` int(11) NOT NULL AUTO_INCREMENT,
`CustomerID` int(11) DEFAULT NULL,
`BookingTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`ReservationStatus` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`ReservationID`),
KEY `CustomerID` (`CustomerID`),
CONSTRAINT `Reservation_ibfk_1` FOREIGN KEY (`CustomerID`) REFERENCES `Customer` (`CustomerID`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Reservation`
--
LOCK TABLES `Reservation` WRITE;
/*!40000 ALTER TABLE `Reservation` DISABLE KEYS */;
INSERT INTO `Reservation` VALUES (1,1,'2019-03-18 18:57:37',NULL),(2,2,'2019-03-18 18:57:42',NULL),(3,3,'2019-03-18 18:57:46',NULL),(4,10,'2019-03-21 18:57:30',1),(6,12,'2019-03-21 18:59:40',1),(10,16,'2019-03-21 19:40:37',1),(11,17,'2019-03-21 20:23:36',1),(12,18,'2019-03-21 20:26:22',1),(13,19,'2019-03-21 20:29:27',1),(14,20,'2019-03-21 20:31:32',1),(15,21,'2019-03-26 10:13:52',1);
/*!40000 ALTER TABLE `Reservation` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `ReservedSlots`
--
DROP TABLE IF EXISTS `ReservedSlots`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ReservedSlots` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`ReservationID` int(11) DEFAULT NULL,
`SlotID` int(11) DEFAULT NULL,
`StartTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`EndTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`ID`),
KEY `ReservationID` (`ReservationID`),
KEY `SlotID` (`SlotID`),
CONSTRAINT `ReservedSlots_ibfk_1` FOREIGN KEY (`ReservationID`) REFERENCES `Reservation` (`ReservationID`),
CONSTRAINT `ReservedSlots_ibfk_2` FOREIGN KEY (`SlotID`) REFERENCES `Slots` (`SlotID`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `ReservedSlots`
--
LOCK TABLES `ReservedSlots` WRITE;
/*!40000 ALTER TABLE `ReservedSlots` DISABLE KEYS */;
INSERT INTO `ReservedSlots` VALUES (1,1,0,'2007-12-31 18:30:01','2007-12-31 23:30:01'),(2,2,1,'2008-01-01 04:30:01','2008-01-01 05:30:01'),(3,3,2,'2007-12-31 22:30:01','2007-12-31 23:30:01'),(4,10,1,'2018-01-01 06:30:00','2018-01-01 07:30:00'),(5,11,2,'2018-01-01 09:30:00','2018-01-01 10:30:00'),(6,12,0,'2018-01-01 06:30:00','2018-01-01 07:30:00'),(7,13,2,'2018-01-01 06:30:00','2018-01-01 07:30:00'),(8,14,1,'2017-12-31 23:30:00','2018-01-01 00:30:00'),(9,15,2,'2017-12-31 20:30:00','2017-12-31 21:30:00');
/*!40000 ALTER TABLE `ReservedSlots` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `Slots`
--
DROP TABLE IF EXISTS `Slots`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Slots` (
`SlotID` int(11) NOT NULL,
`occupied` tinyint(1) NOT NULL,
`CNNTimestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`CNNFlag` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`SlotID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `Slots`
--
LOCK TABLES `Slots` WRITE;
/*!40000 ALTER TABLE `Slots` DISABLE KEYS */;
INSERT INTO `Slots` VALUES (0,1,'1970-01-18 17:44:35',1),(1,1,'1970-01-18 17:44:35',1),(2,1,'1970-01-18 17:44:35',1);
/*!40000 ALTER TABLE `Slots` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `accountdetail`
--
DROP TABLE IF EXISTS `accountdetail`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `accountdetail` (
`customerid` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(20) NOT NULL,
`password` varchar(20) NOT NULL,
PRIMARY KEY (`customerid`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `accountdetail`
--
LOCK TABLES `accountdetail` WRITE;
/*!40000 ALTER TABLE `accountdetail` DISABLE KEYS */;
INSERT INTO `accountdetail` VALUES (1,'kumsdan@bjp.com','vannee'),(2,'kumsda]an@bjp.com','vaaannee'),(11,'asas','Asas'),(12,'asas','Asas'),(13,'asas','Asas'),(14,'asas','Asas'),(15,'try','try'),(16,'dssa','qwer'),(17,'dssd','qwer'),(18,'johan','johan123'),(19,'dskansl','an kas'),(20,'sand a','1234'),(21,'sand a','1234'),(22,'sand a','1234'),(23,'sand a','1234'),(24,'thambi','thambi'),(25,'sadsd','123'),(26,'aa','aa'),(27,'adarsh','adarsh');
/*!40000 ALTER TABLE `accountdetail` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `auth_group`
--
DROP TABLE IF EXISTS `auth_group`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_group` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(80) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_group`
--
LOCK TABLES `auth_group` WRITE;
/*!40000 ALTER TABLE `auth_group` DISABLE KEYS */;
/*!40000 ALTER TABLE `auth_group` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `auth_group_permissions`
--
DROP TABLE IF EXISTS `auth_group_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_group_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`group_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`),
KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`),
CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_group_permissions`
--
LOCK TABLES `auth_group_permissions` WRITE;
/*!40000 ALTER TABLE `auth_group_permissions` DISABLE KEYS */;
/*!40000 ALTER TABLE `auth_group_permissions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `auth_permission`
--
DROP TABLE IF EXISTS `auth_permission`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_permission` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`content_type_id` int(11) NOT NULL,
`codename` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`),
CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_permission`
--
LOCK TABLES `auth_permission` WRITE;
/*!40000 ALTER TABLE `auth_permission` DISABLE KEYS */;
INSERT INTO `auth_permission` VALUES (1,'Can add log entry',1,'add_logentry'),(2,'Can change log entry',1,'change_logentry'),(3,'Can delete log entry',1,'delete_logentry'),(4,'Can add group',2,'add_group'),(5,'Can change group',2,'change_group'),(6,'Can delete group',2,'delete_group'),(7,'Can add permission',3,'add_permission'),(8,'Can change permission',3,'change_permission'),(9,'Can delete permission',3,'delete_permission'),(10,'Can add user',4,'add_user'),(11,'Can change user',4,'change_user'),(12,'Can delete user',4,'delete_user'),(13,'Can add content type',5,'add_contenttype'),(14,'Can change content type',5,'change_contenttype'),(15,'Can delete content type',5,'delete_contenttype'),(16,'Can add session',6,'add_session'),(17,'Can change session',6,'change_session'),(18,'Can delete session',6,'delete_session');
/*!40000 ALTER TABLE `auth_permission` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `auth_user`
--
DROP TABLE IF EXISTS `auth_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`password` varchar(128) NOT NULL,
`last_login` datetime(6) DEFAULT NULL,
`is_superuser` tinyint(1) NOT NULL,
`username` varchar(150) NOT NULL,
`first_name` varchar(30) NOT NULL,
`last_name` varchar(30) NOT NULL,
`email` varchar(254) NOT NULL,
`is_staff` tinyint(1) NOT NULL,
`is_active` tinyint(1) NOT NULL,
`date_joined` datetime(6) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_user`
--
LOCK TABLES `auth_user` WRITE;
/*!40000 ALTER TABLE `auth_user` DISABLE KEYS */;
/*!40000 ALTER TABLE `auth_user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `auth_user_groups`
--
DROP TABLE IF EXISTS `auth_user_groups`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_user_groups` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_user_groups_user_id_group_id_94350c0c_uniq` (`user_id`,`group_id`),
KEY `auth_user_groups_group_id_97559544_fk_auth_group_id` (`group_id`),
CONSTRAINT `auth_user_groups_group_id_97559544_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`),
CONSTRAINT `auth_user_groups_user_id_6a12ed8b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_user_groups`
--
LOCK TABLES `auth_user_groups` WRITE;
/*!40000 ALTER TABLE `auth_user_groups` DISABLE KEYS */;
/*!40000 ALTER TABLE `auth_user_groups` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `auth_user_user_permissions`
--
DROP TABLE IF EXISTS `auth_user_user_permissions`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_user_user_permissions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`permission_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `auth_user_user_permissions_user_id_permission_id_14a6b632_uniq` (`user_id`,`permission_id`),
KEY `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` (`permission_id`),
CONSTRAINT `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`),
CONSTRAINT `auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `auth_user_user_permissions`
--
LOCK TABLES `auth_user_user_permissions` WRITE;
/*!40000 ALTER TABLE `auth_user_user_permissions` DISABLE KEYS */;
/*!40000 ALTER TABLE `auth_user_user_permissions` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `django_admin_log`
--
DROP TABLE IF EXISTS `django_admin_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_admin_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`action_time` datetime(6) NOT NULL,
`object_id` longtext,
`object_repr` varchar(200) NOT NULL,
`action_flag` smallint(5) unsigned NOT NULL,
`change_message` longtext NOT NULL,
`content_type_id` int(11) DEFAULT NULL,
`user_id` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `django_admin_log_content_type_id_c4bce8eb_fk_django_co` (`content_type_id`),
KEY `django_admin_log_user_id_c564eba6_fk_auth_user_id` (`user_id`),
CONSTRAINT `django_admin_log_content_type_id_c4bce8eb_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`),
CONSTRAINT `django_admin_log_user_id_c564eba6_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `django_admin_log`
--
LOCK TABLES `django_admin_log` WRITE;
/*!40000 ALTER TABLE `django_admin_log` DISABLE KEYS */;
/*!40000 ALTER TABLE `django_admin_log` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `django_content_type`
--
DROP TABLE IF EXISTS `django_content_type`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_content_type` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app_label` varchar(100) NOT NULL,
`model` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `django_content_type`
--
LOCK TABLES `django_content_type` WRITE;
/*!40000 ALTER TABLE `django_content_type` DISABLE KEYS */;
INSERT INTO `django_content_type` VALUES (1,'admin','logentry'),(2,'auth','group'),(3,'auth','permission'),(4,'auth','user'),(5,'contenttypes','contenttype'),(6,'sessions','session');
/*!40000 ALTER TABLE `django_content_type` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `django_migrations`
--
DROP TABLE IF EXISTS `django_migrations`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_migrations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app` varchar(255) NOT NULL,
`name` varchar(255) NOT NULL,
`applied` datetime(6) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `django_migrations`
--
LOCK TABLES `django_migrations` WRITE;
/*!40000 ALTER TABLE `django_migrations` DISABLE KEYS */;
INSERT INTO `django_migrations` VALUES (1,'contenttypes','0001_initial','2019-03-02 17:34:04.221110'),(2,'auth','0001_initial','2019-03-02 17:34:20.882461'),(3,'admin','0001_initial','2019-03-02 17:34:25.519487'),(4,'admin','0002_logentry_remove_auto_add','2019-03-02 17:34:25.872239'),(5,'contenttypes','0002_remove_content_type_name','2019-03-02 17:34:29.552156'),(6,'auth','0002_alter_permission_name_max_length','2019-03-02 17:34:29.851517'),(7,'auth','0003_alter_user_email_max_length','2019-03-02 17:34:30.379822'),(8,'auth','0004_alter_user_username_opts','2019-03-02 17:34:30.487476'),(9,'auth','0005_alter_user_last_login_null','2019-03-02 17:34:31.419889'),(10,'auth','0006_require_contenttypes_0002','2019-03-02 17:34:31.484721'),(11,'auth','0007_alter_validators_add_error_messages','2019-03-02 17:34:31.575323'),(12,'auth','0008_alter_user_username_max_length','2019-03-02 17:34:31.882901'),(13,'sessions','0001_initial','2019-03-02 17:34:33.277691');
/*!40000 ALTER TABLE `django_migrations` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `django_session`
--
DROP TABLE IF EXISTS `django_session`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `django_session` (
`session_key` varchar(40) NOT NULL,
`session_data` longtext NOT NULL,
`expire_date` datetime(6) NOT NULL,
PRIMARY KEY (`session_key`),
KEY `django_session_expire_date_a5c62663` (`expire_date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `django_session`
--
LOCK TABLES `django_session` WRITE;
/*!40000 ALTER TABLE `django_session` DISABLE KEYS */;
/*!40000 ALTER TABLE `django_session` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-03-26 16:15:33
| true |
3034ff6d8e4f6f96416a3521a750974f5e31fa39 | SQL | Muzznah/Pewlett-Hackards-People-Analysis | /Queries/queries.sql | UTF-8 | 4,600 | 4.3125 | 4 | [] | no_license | --Get employees that are retiring soon(Born btw 1952-1955).
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1952-01-01' AND '1955-12-31';
--Get employees that were born in 1952 and will retire soon.
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1952-01-01' AND '1952-12-31';
--Retirement eligibility (Skill Drill).
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1953-01-01' AND '1953-12-31';
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1954-01-01' AND '1954-12-31';
SELECT first_name, last_name
FROM employees
WHERE birth_date BETWEEN '1955-01-01' AND '1955-12-31';
-- Retirement eligibility with hire date variable.
SELECT first_name, last_name
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
-- Number of employees retiring.
SELECT COUNT(first_name)
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
--CReating retirement_info table.
SELECT first_name, last_name
INTO retirement_info
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
--Check the new table made.
SELECT * FROM retirement_info;
--Drop the retirement info table to make a new one.
DROP TABLE retirement_info;
-- Create new table for retiring employees with emp_no.
SELECT emp_no, first_name, last_name
INTO retirement_info
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
-- Check the table
SELECT * FROM retirement_info;
-- Joining departments and dept_manager tables
SELECT d.dept_name,
dm.emp_no,
dm.from_date,
dm.to_date
FROM departments as d
INNER JOIN dept_manager as dm
ON d.dept_no = dm.dept_no;
-- Joining retirement_info and dept_emp tables to get current employees to retire soon.
SELECT ri.emp_no,
ri.first_name,
ri.last_name,
de.to_date
FROM retirement_info as ri
LEFT JOIN dept_emp as de
ON ri.emp_no = de.emp_no;
--Checking how many retirement-eligible employees are still employed and converting it to a new table.
SELECT ri.emp_no,
ri.first_name,
ri.last_name,
de.to_date
INTO current_emp
FROM retirement_info as ri
LEFT JOIN dept_emp as de
ON ri.emp_no = de.emp_no
WHERE de.to_date = ('9999-01-01');
-- Employee count by department number
SELECT COUNT(ce.emp_no), de.dept_no
FROM current_emp as ce
LEFT JOIN dept_emp as de
ON ce.emp_no = de.emp_no
GROUP BY de.dept_no
ORDER BY de.dept_no;
______________________________
--CReating retirement_info table (1955).
SELECT emp_no,first_name, last_name
INTO retirement_info55
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1955-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
--Checking how many retirement-eligible employees are still employed and converting it to a new table.
SELECT ri.emp_no,
ri.first_name,
ri.last_name,
de.to_date
INTO current_emp55
FROM retirement_info55 as ri
LEFT JOIN dept_emp as de
ON ri.emp_no = de.emp_no
WHERE de.to_date = ('9999-01-01');
--count number of employees retiring(55)
SELECT COUNT(first_name)
FROM current_emp55 ;
___________________________________________________
--CReating retirement_info table (1952).
SELECT emp_no,first_name, last_name
INTO retirement_info52
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1952-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
--Checking how many retirement-eligible employees are still employed and converting it to a new table.
SELECT ri.emp_no,
ri.first_name,
ri.last_name,
de.to_date
INTO current_emp52
FROM retirement_info52 as ri
LEFT JOIN dept_emp as de
ON ri.emp_no = de.emp_no
WHERE de.to_date = ('9999-01-01');
--count number of employees retiring(52)
SELECT COUNT(first_name)
FROM current_emp52 ;
__________________________________________________________
--CReating retirement_info table (1954).
SELECT emp_no,first_name, last_name
INTO retirement_info54
FROM employees
WHERE (birth_date BETWEEN '1952-01-01' AND '1954-12-31')
AND (hire_date BETWEEN '1985-01-01' AND '1988-12-31');
--Checking how many retirement-eligible employees are still employed and converting it to a new table.
SELECT ri.emp_no,
ri.first_name,
ri.last_name,
de.to_date
INTO current_emp54
FROM retirement_info54 as ri
LEFT JOIN dept_emp as de
ON ri.emp_no = de.emp_no
WHERE de.to_date = ('9999-01-01');
--count number of employees retiring(54)
SELECT COUNT(first_name)
FROM current_emp54; | true |
241b37a759f969bc9617e6e6260810accf30b1b1 | SQL | ashamrock/Hot-Table | /customers.sql | UTF-8 | 1,037 | 3.40625 | 3 | [] | no_license | DROP DATABASE IF EXISTS customersDB;
DROP DATABASE IF EXISTS waitListDB;
CREATE DATABASE customersDB;
CREATE DATABASE waitListDB;
USE customersDB;
CREATE TABLE CUSTOMERS (
person_id INT NOT NULL AUTO_INCREMENT,
identification VARCHAR(20) NOT NULL,
customerName VARCHAR(20) NOT NULL,
customerEmail VARCHAR(20) NOT NULL,
phoneNumber VARCHAR(20) NOT NULL,
PRIMARY KEY (person_id)
);
INSERT INTO CUSTOMERS (identification, customerName, customerEmail, phoneNumber)
VALUES ("Hangry", "Maria", "111-222-3333", "M.aria@Aira.M"),
("afhaque89", "Ahmed", "979-587-0887", "afhaque89@gmail.com"),
("4? Really tim....", "Tim", "55555555", "tim@tim.tim");
USE waitListDB;
CREATE TABLE WAITLIST (
person_id INT NOT NULL AUTO_INCREMENT,
identification VARCHAR(20) NOT NULL,
customerName VARCHAR(20) NOT NULL,
customerEmail VARCHAR(20) NOT NULL,
phoneNumber VARCHAR(20) NOT NULL,
PRIMARY KEY (person_id)
);
INSERT INTO WAITLIST (identification, customerName, customerEmail, phoneNumber)
VALUES ("saimacool", "Saima", "979-587-0887", "saima@gmail.com"); | true |
f54de5985120f80f5bb1b369cf1ff28f87ecbbd5 | SQL | jzebker/Pewlett_Hackard_Analysis | /Queries/retirees_by_title.sql | UTF-8 | 257 | 4 | 4 | [
"MIT"
] | permissive | -- Retirees by title
SELECT ti.title,
count(e.emp_no)
FROM titles as ti
INNER JOIN employees as e
ON ti.emp_no = e.emp_no
WHERE ti.to_date = '9999-01-01' AND (e.birth_date BETWEEN '1952-01-01' AND '1955-12-31')
GROUP BY title
ORDER BY count(e.emp_no) DESC; | true |
1ef3a3859b93808d88ed88517b9e74dde2dd6511 | SQL | jonjomckay/cozzer | /src/main/resources/migrations/V0003__create_submissions.sql | UTF-8 | 298 | 3.640625 | 4 | [
"MIT"
] | permissive | CREATE TABLE IF NOT EXISTS submissions
(
id uuid not null primary key,
project_id uuid not null,
created_at timestamp with time zone default now()
);
ALTER TABLE submissions
ADD CONSTRAINT fk_submissions_project FOREIGN KEY (project_id) REFERENCES projects (id) ON DELETE CASCADE;
| true |
8da06cf8b0c2716e2179a5b5ba7999bb69d99287 | SQL | Louise-MP/Openclassrooms_project | /export_bdd/bdd.sql | UTF-8 | 5,598 | 3.140625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.0.1
-- https://www.phpmyadmin.net/
--
-- Hรดte : localhost:8889
-- Gรฉnรฉrรฉ le : sam. 28 dรฉc. 2019 ร 01:36
-- Version du serveur : 5.7.26
-- Version de PHP : 7.3.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
--
-- Base de donnรฉes : `espace_membre`
--
-- --------------------------------------------------------
--
-- Structure de la table `acteurs`
--
CREATE TABLE `acteurs` (
`id` int(11) NOT NULL,
`titre` varchar(255) NOT NULL,
`description` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dรฉchargement des donnรฉes de la table `acteurs`
--
INSERT INTO `acteurs` (`id`, `titre`, `description`) VALUES
(1, 'dsa', 'Dsa France accรฉlรจre la croissance du territoire et sโengage avec les collectivitรฉs territoriales. Nous accompagnons les entreprises dans les รฉtapes clรฉs de leur รฉvolution. Notre philosophie : sโadapter ร chaque entreprise. Nous les accompagnons pour voir plus grand et plus loin et proposons des solutions de financement adaptรฉes ร chaque รฉtape de la vie des entreprises'),
(2, 'formation_co', 'Formation&co est une association franรงaise prรฉsente sur tout le territoire.\r\n\r\nNous proposons ร des personnes issues de tout milieu de devenir entrepreneur grรขce ร un crรฉdit et un accompagnement professionnel et personnalisรฉ.\r\nNotre proposition :\r\n\r\nun financement jusquโร 30 000โฌ.\r\n\r\nun suivi personnalisรฉ et gratuit.\r\n\r\nune lutte acharnรฉe contre les freins sociรฉtaux et les stรฉrรฉotypes.\r\n\r\nLe financement est possible, peu importe le mรฉtier :\r\ncoiffeur, banquier, รฉleveur de chรจvresโฆ\r\n\r\nNous collaborons avec des personnes talentueuses et motivรฉes.\r\n\r\nVous nโavez pas de diplรดmes ? Ce nโest pas un problรจme pour nous ! Nos financements sโadressent ร tous.'),
(3, 'protect', 'Protectpeople finance la solidaritรฉ nationale. Nous appliquons le principe รฉdifiรฉ par la Sรฉcuritรฉ sociale franรงaise en 1945 : permettre ร chacun de bรฉnรฉficier dโune protection sociale.\r\n\r\nChez Protectpeople, chacun cotise selon ses moyens et reรงoit selon ses besoins. Proectecpeople est ouvert ร tous, sans considรฉration dโรขge ou dโรฉtat de santรฉ.\r\n\r\nNous garantissons un accรจs aux soins et une retraite. Chaque annรฉe, nous collectons et rรฉpartissons 300 milliards dโeuros. Notre mission est double :\r\n\r\nsociale : nous garantissons la fiabilitรฉ des donnรฉes sociales.\r\n\r\nรฉconomique : nous apportons une contribution aux activitรฉs รฉconomiques.'),
(4, 'cde', 'La CDE (Chambre Des Entrepreneurs) accompagne les entreprises dans leurs dรฉmarches de formation. Son prรฉsident est รฉlu pour 3 ans par ses pairs, chefs dโentreprises et prรฉsidents des CDE.');
-- --------------------------------------------------------
--
-- Structure de la table `comments`
--
CREATE TABLE `comments` (
`id` int(11) NOT NULL,
`userID` int(11) NOT NULL,
`comment` text NOT NULL,
`createOn` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Structure de la table `membres`
--
CREATE TABLE `membres` (
`id` int(11) NOT NULL,
`nom` varchar(255) NOT NULL,
`prenom` varchar(255) NOT NULL,
`pseudo` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`mdp` varchar(255) NOT NULL,
`question` varchar(100) NOT NULL,
`reponse` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Dรฉchargement des donnรฉes de la table `membres`
--
INSERT INTO `membres` (`id`, `nom`, `prenom`, `pseudo`, `email`, `mdp`, `question`, `reponse`) VALUES
(1, 'Baba', 'Carole', 'baca', 'baca@gmail.com', '123', '', ''),
(83, 'test1', 'test1', 'test1', 'test1@g', '$2y$10$tkmZWx705/BXOUpPKz767.bivVgLIT7NgBqz6XfI47fFI7jm4mQhe', 'color', 'rouge'),
(84, 'test3', 'test3', 'test3', 'test3@g', '$2y$10$y7GdDkKYRzdfYu6T04bnsOxC5dlJNzp7LHNDpNyjwtkIl61totu3C', 'color', 'rouge'),
(85, 'test4', 'test4', 'test4', 'test4@g', '$2y$10$f8NgrNe9.oBC46b/Fs8in..TffV6hiA9zJqIa.oLGCaQFQf3la1Ki', 'color', 'rouge'),
(86, 'test3', 'test3', 'test3', 'test3@g', '$2y$10$uZN6GRIhjjgWh5zrJ3MgNeuuF3l8h0TZdRwsFUnFPM3WIkVZFe3z2', 'color', 'rouge'),
(87, 'test444', 'test444', 'test444', 'test444@g', '$2y$10$HD9iBLSY8Y9R4MNtT9Pv0O7oiHKyW6hb/L8yLNEUu4.0ypSwnJkKm', 'color', 'rouge'),
(88, 'test56', 'test56', 'test56', 'test56@g', '$2y$10$.xmXnUme6M0IyQW7BgD03Oj/Dp1hDadKMZEbJjsQD2ov6w0GfR6Qi', 'color', 'rouge'),
(89, 'test88', 'test88', 'test88', 'test88@g', '$2y$10$amDzc4tXdSUZD0aWVIeLs.5XChhzmshtaRlPu2C.QRKdWfOMZfl3e', 'color', 'rouge'),
(90, 'test333', 'test333', 'test333', 'test333@g', '$2y$10$oj9T6lcEOqe8Q4Niw3EVhuSEgE9f0L9t4yspIaOTCN.XqT7LQ0jUi', 'color', 'rouge'),
(91, 'Filali', 'Mehdi', 'm91', 'mf@gmail.com', '$2y$10$l/LdKLHcw4yfcq2lI7CAZumNkmFelZhNsXW6Zv402/xHRrFtm/SUC', 'color', 'rouge');
--
-- Index pour les tables dรฉchargรฉes
--
--
-- Index pour la table `acteurs`
--
ALTER TABLE `acteurs`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `comments`
--
ALTER TABLE `comments`
ADD PRIMARY KEY (`id`);
--
-- Index pour la table `membres`
--
ALTER TABLE `membres`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT pour les tables dรฉchargรฉes
--
--
-- AUTO_INCREMENT pour la table `acteurs`
--
ALTER TABLE `acteurs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT pour la table `comments`
--
ALTER TABLE `comments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT pour la table `membres`
--
ALTER TABLE `membres`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=92;
| true |
f9732781f2a7a1fb1d89e6a21a1cde50e232c3f4 | SQL | susannapeek1/seisundid_SQL | /Magistritรถรถ/SQL kood kรตigile disainidele/Pรตhiolemitรผรผbi_alamtรผรผpidena/4.7_S4/4.7_S4.sql | UTF-8 | 537 | 3.203125 | 3 | [] | no_license | SELECT 'Ootel' AS seisund
WHERE NOT EXISTS (SELECT *
FROM ootel_tellimus)
UNION
SELECT 'Tรถรถtlemisel' AS seisund
WHERE NOT EXISTS (SELECT *
FROM tootlemisel_tellimus)
UNION
SELECT 'Vรคlja saadetud' AS seisund
WHERE NOT EXISTS (SELECT *
FROM valja_saadetud_tellimus)
UNION
SELECT 'Kohale toimetatud' AS seisund
WHERE NOT EXISTS (SELECT *
FROM kohale_toimetatud_tellimus)
UNION SELECT 'Tรผhistatud' AS seisund
WHERE NOT EXISTS (SELECT *
FROM tuhistatud_tellimus); | true |
cb71ca433d6741fbb429c6d3490cae951b697f4c | SQL | feisishui/oracle-spatial-workshop | /Workshop_Files/labs/16-3D-support/02-point_clouds/03_load_from_points/07_clip_scene_polygon.sql | UTF-8 | 507 | 2.703125 | 3 | [] | no_license | DROP TABLE lidar_points_clip PURGE;
CREATE TABLE lidar_points_clip
NOLOGGING
PARALLEL
AS
SELECT *
FROM TABLE (
get_points (
SDO_GEOMETRY (
2003,
32617,
NULL,
SDO_ELEM_INFO_ARRAY (1, 1003, 1),
SDO_ORDINATE_ARRAY (
289650, 4321200,
289600, 4321150,
289650, 4321100,
289700, 4321150,
289650, 4321200
)
),
'LIDAR_POINTS',
0.005,
null,
'mask=INSIDE'
)
);
select count(*) from lidar_points_clip; | true |
b06970e13663dc8149d7a534025cba26da563c63 | SQL | danz50of/DZCommandLibrary | /SQL/SO_COST_REVIEW_custom.sql | UTF-8 | 566 | 3.375 | 3 | [] | no_license | select SO.ORDER_NO, SOC.PART_NO, SOC.CLOSE_DATE, SOC.REVISED_QTY_DUE BUILD_QTY, SOC.QTY_COMPLETE,
SOC.TOTAL_STD_ACCUM_COST TOTAL_STANDARD_COST, SOC.TOTAL_ACTUAL_ACCUM_COST TOTAL_ACTUAL_COST, SOC.ACT_STD_ACCUM DIFF,
SOC.ACT_STD_ACCUM_FACTOR PRCT_DIFF
from shop_ord SO, SHOP_ORDER_COST_OVERVIEW SOC,
ifsinfo.PRL_LAB_ACT_STND_BY_OP_B SOLAB
where TRUNC(SO.CLOSE_DATE,'DD') >= TO_DATE('11/8/2016','MM/DD/YYYY')
and so.contract = 'MP'
AND SO.ORDER_NO = SOC.ORDER_NO (+)
order by SOC.ACT_STD_ACCUM desc
SELECT * FROM SHOP_ORDER_COST_OVERVIEW WHERE ORDER_NO = '1131019' | true |
ca448c690adbae2a05bd1978f0e1a0daf3e5022d | SQL | hah1346798520/FruitSalesPlatform | /sql/fruit_manage.sql | UTF-8 | 8,067 | 3.234375 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : localhost_3306
Source Server Version : 80013
Source Host : localhost:3306
Source Database : fruit_manage
Target Server Type : MYSQL
Target Server Version : 80013
File Encoding : 65001
Date: 2019-06-13 21:32:29
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for accessory
-- ----------------------------
DROP TABLE IF EXISTS `accessory`;
CREATE TABLE `accessory` (
`accessoryid` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '้ๅฑๅID',
`fruitid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ๅๅID',
`name` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '้ๅฑๅๅ็งฐ',
`price` decimal(10,2) NOT NULL COMMENT '้ๅฑๅไปทๆ ผ',
`createtime` datetime NOT NULL COMMENT 'ๅๅปบๆถ้ด',
PRIMARY KEY (`accessoryid`),
KEY `fruitid` (`fruitid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of accessory
-- ----------------------------
INSERT INTO `accessory` VALUES ('213231', '3234', 'ๅ
่ฃ
่ข', '0.10', '2019-06-05 17:42:26');
INSERT INTO `accessory` VALUES ('2658721f62014b1c82502c7fb8866c65', '25f6cd5c25f74f4cb045911bcb56f148', '็บธ็ฎฑ', '2.00', '2019-06-08 16:43:17');
INSERT INTO `accessory` VALUES ('325125', '3234', '็บธๆฟ็', '0.30', '2019-02-07 17:43:00');
INSERT INTO `accessory` VALUES ('413099a719ed46bbbea53c0bfc1b4acd', '3234', '็ๅญ', '4.00', '2019-06-05 19:30:32');
INSERT INTO `accessory` VALUES ('835c80978cbd4239a0a1f15bbb1a4eab', '3234', 'ไฟ้ฒ่', '0.60', '2019-06-05 19:29:31');
INSERT INTO `accessory` VALUES ('98468c62209e4eaeae17156dc22debe5', '25f6cd5c25f74f4cb045911bcb56f148', '็ๅญ', '4.00', '2019-06-08 16:43:23');
-- ----------------------------
-- Table structure for commodities
-- ----------------------------
DROP TABLE IF EXISTS `commodities`;
CREATE TABLE `commodities` (
`fruitid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ๅๅID',
`fruitname` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'ๆฐดๆๅ็งฐ',
`price` decimal(10,2) NOT NULL COMMENT 'ไปทๆ ผ',
`locality` varchar(100) COLLATE utf8_bin NOT NULL COMMENT 'ไบงๅฐ',
`createtime` datetime NOT NULL COMMENT 'ๅฝๅๆถ้ด',
PRIMARY KEY (`fruitid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of commodities
-- ----------------------------
INSERT INTO `commodities` VALUES ('25f6cd5c25f74f4cb045911bcb56f148', '่ก่', '2.20', 'ๆฐ็', '2019-06-05 01:15:16');
INSERT INTO `commodities` VALUES ('3234', '็ซ้พๆ', '6.68', 'ๆตๆฑ็็ปๅ
ดๅธ', '2017-09-13 20:15:43');
INSERT INTO `commodities` VALUES ('5f5c51c001ee4bb9aa27f3df2046a0ba', 'ๆขจๅญ', '3.20', 'ๅไบฌ', '2019-06-09 01:34:40');
INSERT INTO `commodities` VALUES ('b463332f1a7b46728b653ffaf61c50f0', 'ๆขจๅญ', '3.20', 'ๅไบฌ', '2019-06-09 01:34:35');
INSERT INTO `commodities` VALUES ('d582b68bf9c94a00a8d32b3ff12f55f1', '่นๆ', '5.00', 'ๅไบฌ', '2019-06-05 02:21:26');
INSERT INTO `commodities` VALUES ('d81ea785224c480d8c1183b00b0c1c09', '่นๆ', '4.00', 'ๅไบฌ', '2019-06-05 02:22:41');
INSERT INTO `commodities` VALUES ('da17f3587bdf4b2c9288d652e8b58562', 'ๆขจๅญ', '3.20', 'ๅไบฌ', '2019-06-09 01:34:24');
-- ----------------------------
-- Table structure for contract
-- ----------------------------
DROP TABLE IF EXISTS `contract`;
CREATE TABLE `contract` (
`contractid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ๅๅID',
`barcode` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ๅๅๅท',
`type` int(1) NOT NULL COMMENT '่ฟ่พ็ฑปๅ',
`retailerid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '้ถๅฎๅID',
`createtime` datetime NOT NULL COMMENT 'ๅๅปบๆถ้ด',
PRIMARY KEY (`contractid`),
KEY `retailerid` (`retailerid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of contract
-- ----------------------------
-- ----------------------------
-- Table structure for middletab
-- ----------------------------
DROP TABLE IF EXISTS `middletab`;
CREATE TABLE `middletab` (
`middleid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ไธญ้ด่กจID',
`contractid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ๅๅID',
`fruitid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ๅๅID',
`number` int(11) NOT NULL COMMENT 'ๅๅๆฐ้',
PRIMARY KEY (`middleid`),
KEY `contractid` (`contractid`),
KEY `fruitid` (`fruitid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of middletab
-- ----------------------------
-- ----------------------------
-- Table structure for retailer
-- ----------------------------
DROP TABLE IF EXISTS `retailer`;
CREATE TABLE `retailer` (
`retailerid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '้ถๅฎๅID',
`name` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '้ถๅฎๅๅงๅ',
`telephone` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '้ถๅฎๅ็ต่ฏ',
`address` varchar(100) COLLATE utf8_bin NOT NULL COMMENT '้ถๅฎๅๅฐๅ',
`status` int(1) NOT NULL COMMENT '็ถๆ๏ผ0/1๏ผ',
`createtime` datetime NOT NULL COMMENT 'ๅๅปบๆถ้ด',
PRIMARY KEY (`retailerid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of retailer
-- ----------------------------
INSERT INTO `retailer` VALUES ('231231231231', '่ๅฎถ้ช', '13666666666', 'ไธๆตทๅธๅฎๅฑฑๅบ', '1', '2019-06-04 17:10:24');
INSERT INTO `retailer` VALUES ('4654546565465462', '่่ๅญ', '13888888888', 'ไธๆตทๅธๅๅฎๅบ', '0', '2019-06-04 16:59:06');
INSERT INTO `retailer` VALUES ('4654546565465465', '็ณๆฉๅ', '13777777777', 'ไธๆตทๅธๆฎ้ๅบ', '0', '2019-06-04 17:10:32');
INSERT INTO `retailer` VALUES ('986c83e0-f476-4db7-8296-2a7f46992418', 'ๅผ ไธ', '13722222222', 'ไธๆตทๅฎๅฑฑๅบ', '0', '2019-06-04 20:04:16');
INSERT INTO `retailer` VALUES ('c2613c793a5742d1bb7dd50e91916ded', 'ๆๅ', '13811111111', 'ไธๆตทๅธๆฎ้ๅบ', '0', '2019-06-04 20:08:42');
INSERT INTO `retailer` VALUES ('c6b899350e444a789160eedf357142a9', '็ไบ', '13922222222', '็ฆๅปบ็ๅฆ้จๅธ', '1', '2019-06-04 20:11:26');
INSERT INTO `retailer` VALUES ('e1af20c9aa8242d3a73189826954c9e3', '้ฟๆฏ่่ฌ', '13732232323', '็ฆๅปบ็็ฆๅทๅธ', '1', '2019-06-04 20:13:08');
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`userid` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '็จๆทID',
`username` varchar(50) COLLATE utf8_bin NOT NULL COMMENT '่ดฆๅท',
`password` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ๅฏ็ ',
`name` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'ๅงๅ',
`telephone` varchar(20) COLLATE utf8_bin NOT NULL COMMENT 'ๆๆบๅท็ ',
PRIMARY KEY (`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('0c56bbb78bac4b338a9af8a9de205ce7', 'ๅๅ', '1234', '1234', '13111111111');
INSERT INTO `user` VALUES ('1c057a8ef4bc41d69f7aa6b3227114a5', 'nancy', '1234', 'nancy', '13788888888');
INSERT INTO `user` VALUES ('2d0279e8cf7c4d5287d212433df8bf87', '3', '3', 'ๆฌง้ณ้', '13811111111');
INSERT INTO `user` VALUES ('3af57d0545766ec940d2c32a6567cc06ae5', 'jack', '1234', 'ๅผ ไธ', '15588888888');
INSERT INTO `user` VALUES ('4189262ff14843b983a9d0cbe20faa39', '22', '22', '22', '13222222222');
INSERT INTO `user` VALUES ('4c540a0758f94b278728e40698a72ad2', '2', '2', '็ไบ', '13666666666');
INSERT INTO `user` VALUES ('53bbb9ba14bd4df984f1b21baa200843', '1', '1', '1', '13888888888');
INSERT INTO `user` VALUES ('9fb46559a3ab4b2598e7f97cd1c1c562', '12', '12', '3', '13411111111');
INSERT INTO `user` VALUES ('a7590c84dab84f079965d58e4301d4a9', 'jane', '1234', 'ๆๅ', '13411111111');
| true |
b0a43d18a7ad98060e19d90ecabe2af7627d4a06 | SQL | stadobaranov/SkillboxJava | /module12/16/ToDoList/backend/src/main/resources/migrations/tasks.sql | UTF-8 | 206 | 2.765625 | 3 | [] | no_license | CREATE TABLE `tasks` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL,
`completed_at` DATETIME NULL DEFAULT NULL,
`created_at` DATETIME NOT NULL,
PRIMARY KEY (`id`)
)
ENGINE=InnoDB | true |
8ab71b0b568e839bbe7dcaa830445194f359d89a | SQL | YaoChungLiang/Database | /HW3/hw3-q2.sql | UTF-8 | 233 | 3.6875 | 4 | [] | no_license | SELECT DISTINCT F.origin_city AS City
FROM Flights AS F
WHERE F.origin_city NOT IN (SELECT DISTINCT F1.origin_city
FROM Flights AS F1
WHERE F1.actual_time >= 180)
ORDER BY City; | true |
81aa666d08ac075529f604ae2c0f17e81a43c079 | SQL | RyanO70/cs230_WebProcessingInformation | /assignment-04/cs230_u200293.sql | UTF-8 | 1,922 | 2.96875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Generation Time: Apr 03, 2021 at 12:46 AM
-- Server version: 10.3.27-MariaDB-0+deb10u1
-- PHP Version: 7.3.27-1~deb10u1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `cs230_u200293`
--
-- --------------------------------------------------------
--
-- Table structure for table `Address`
--
CREATE TABLE `Address` (
`Address_Line_1` varchar(255) NOT NULL,
`Address_Line_2` varchar(255) DEFAULT NULL,
`Town` varchar(255) NOT NULL,
`County` varchar(255) NOT NULL,
`Eircode` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `Address`
--
INSERT INTO `Address` (`Address_Line_1`, `Address_Line_2`, `Town`, `County`, `Eircode`) VALUES
('44 Mercedes Street', 'Mercedes HQ', 'Brackley', 'Northamptonshire', 'EIMercedes');
-- --------------------------------------------------------
--
-- Table structure for table `Personal`
--
CREATE TABLE `Personal` (
`Title` enum('Mx','Ms','Mr','Mrs','Miss','Dr') DEFAULT NULL,
`Firstname` varchar(255) NOT NULL,
`Surname` varchar(255) NOT NULL,
`Mobile` varchar(255) NOT NULL,
`Email` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--
-- Dumping data for table `Personal`
--
INSERT INTO `Personal` (`Title`, `Firstname`, `Surname`, `Mobile`, `Email`) VALUES
('Dr', 'Lewis', 'Hamilton', '443444444', 'sirlhamilton44@f1.com'),
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
e845c785a3e4ec58b15c12e19f9e10011406325e | SQL | CaseyJames669/Databases_MySQL | /Project 11/SQLQuery21.sql | UTF-8 | 316 | 3.421875 | 3 | [] | no_license | SELECT LGEMPLOYEE.EMP_NUM, LGEMPLOYEE.EMP_LNAME, LGEMPLOYEE.EMP_FNAME, Min(LGSALARY_HISTORY.SAL_AMOUNT) AS Sal_Amount
FROM LGEMPLOYEE INNER JOIN LGSALARY_HISTORY ON LGEMPLOYEE.EMP_NUM = LGSALARY_HISTORY.EMP_NUM
GROUP BY LGEMPLOYEE.EMP_NUM, LGEMPLOYEE.EMP_LNAME, LGEMPLOYEE.EMP_FNAME
ORDER BY LGEMPLOYEE.EMP_NUM;
| true |
b63497819aab56eb0ab1f2f88df088c0a42f5d2e | SQL | yekoufeng/AssetExpress | /mysql/assetexpress.sql | UTF-8 | 5,333 | 3.515625 | 4 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : 192.168.93.183
Source Server Version : 50722
Source Host : 192.168.93.183:3306
Source Database : assetexpress_mjc
Target Server Type : MYSQL
Target Server Version : 50722
File Encoding : 65001
Date: 2018-09-06 09:58:52
*/
-- CREATE USER 'assetexpress'@'%' IDENTIFIED BY '123456';
-- use assetexpress;
-- GRANT all privileges ON assetexpress TO 'assetexpress'@'%';
-- flush privileges;
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Procedure structure for CHECK_VERSION_VALID
-- ----------------------------
DROP PROCEDURE IF EXISTS `CHECK_VERSION_VALID`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `CHECK_VERSION_VALID`(IN p_versionno varchar(50), IN p_pid int, IN p_channel int)
BEGIN
declare p_maxversionno varchar(50);
select max(versionno) into p_maxversionno from version where version.projectid=p_pid and version.channelid=p_channel;
if p_maxversionno is null then
select "" into p_maxversionno;
end if;
if p_versionno > p_maxversionno then
SELECT 1;
ELSE
SELECT 0;
end if;
END
;;
DELIMITER ;
-- ----------------------------
-- Procedure structure for INSERT_FILEINFO
-- ----------------------------
DROP PROCEDURE IF EXISTS `INSERT_FILEINFO`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `INSERT_FILEINFO`(IN _projectid bigint, IN _path varchar(250))
BEGIN
DECLARE p_fileID BIGINT DEFAULT 0;
select fileinfo.id into p_fileID from fileinfo where fileinfo.path= _path and fileinfo.projectid=_projectid;
if p_fileID =0 then
INSERT INTO fileinfo(projectid, path, create_time) VALUES(_projectid, _path, NOW());
SELECT @Result:=LAST_INSERT_ID();
SELECT @Result;
ELSE
SELECT p_fileID;
end if;
END
;;
DELIMITER ;
-- ----------------------------
-- Procedure structure for P_ADD_MEMBER_TO_GROUP
-- ----------------------------
DROP PROCEDURE IF EXISTS `P_ADD_MEMBER_TO_GROUP`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `P_ADD_MEMBER_TO_GROUP`(IN p_username varchar(50), IN p_groupid int, IN p_privilege int)
BEGIN
declare p_uid int default 0;
declare p_gid int default 0;
select id into p_uid from `user` where `user`.username = p_username;
select id into p_gid from `group` where `group`.id = p_groupid;
if p_uid !=0 and p_gid !=0 then
if not exists (select 1 from group_user where group_user.group_id = p_gid and group_user.user_i_d=p_uid) then
insert into group_user( group_id, user_i_d, privli, operate_time ) values(p_gid, p_uid, p_privilege, NOW());
select 0;
ELSE
select 1;
end if;
ELSE
select 2;
end if;
END
;;
DELIMITER ;
-- ----------------------------
-- Procedure structure for P_ADD_MEMBER_TO_PROJECT
-- ----------------------------
DROP PROCEDURE IF EXISTS `P_ADD_MEMBER_TO_PROJECT`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `P_ADD_MEMBER_TO_PROJECT`(IN p_username varchar(50), IN p_projectid int, IN p_privilege int)
BEGIN
declare p_uid int default 0;
declare p_pid int default 0;
select id into p_uid from `user` where `user`.username = p_username;
select id into p_pid from `project` where `project`.id = p_projectid;
if p_uid !=0 and p_pid !=0 then
if not exists (select 1 from project_user where project_user.project_i_d = p_pid and project_user.user_i_d=p_uid) then
insert into project_user( project_i_d, user_i_d, privli, operate_time ) values(p_pid, p_uid, p_privilege, now());
select 0;
ELSE
select 1;
end if;
ELSE
select 2;
end if;
END
;;
DELIMITER ;
-- ----------------------------
-- Procedure structure for P_GET_USER_PROJECT_LIST
-- ----------------------------
DROP PROCEDURE IF EXISTS `P_GET_USER_PROJECT_LIST`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `P_GET_USER_PROJECT_LIST`(IN p_userID int)
BEGIN
select /*project_user.user_i_d,*/ project.id, project.name, project.description , project.create_time from project_user right join project on project_user.project_i_d=project.id where project_user.user_i_d=p_userID;
END
;;
DELIMITER ;
-- ----------------------------
-- Procedure structure for release_publish
-- ----------------------------
DROP PROCEDURE IF EXISTS `release_publish`;
DELIMITER ;;
CREATE DEFINER=`root`@`%` PROCEDURE `release_publish`(in p_pid bigint, in p_cid bigint)
BEGIN
#Routine body goes here...
declare sid BIGINT;
declare vid BIGINT;
declare vdesc VARCHAR(100);
declare stype TINYINT;
declare flag int;
-- ้ๅๆฐๆฎ็ปๆๆ ๅฟ
DECLARE done INT DEFAULT FALSE;
DECLARE cur_pub cursor for select versiondesc,strategy_type,strategy_id, version_id from version_publish inner join version on version_publish.version_id=version.id where type=0 and version.projectid=p_pid and version.channelid=p_cid;
-- ๅฐ็ปๆๆ ๅฟ็ปๅฎๅฐๆธธๆ
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
open cur_pub;
-- ้ๅ
read_loop: LOOP
fetch next from cur_pub into vdesc, stype, sid, vid;
if done THEN
leave read_loop;
end if;
if exists(select 1 from version_publish where version_id = vid and type = 1) then
update version_publish set versiondesc=vdesc,strategy_type=stype,strategy_id=sid where version_id = vid and type = 1;
else
insert into version_publish(type,versiondesc,strategy_type,strategy_id,version_id) values(1, vdesc, stype, sid, vid);
end if;
end loop;
close cur_pub;
END
;;
DELIMITER ;
| true |
2736958a591ea1868d834530ad87200e87cdb3bc | SQL | jurewerk/draggproject | /items.sql | UTF-8 | 2,485 | 2.953125 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 192.168.10.10
-- Server version: 5.6.27-0ubuntu0.14.04.1 - (Ubuntu)
-- Server OS: debian-linux-gnu
-- HeidiSQL Version: 9.3.0.4984
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping structure for table draggable.items
CREATE TABLE IF NOT EXISTS `items` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(100) COLLATE utf8_unicode_ci NOT NULL,
`item_order` int(11) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=148 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- Dumping data for table draggable.items: ~7 rows (approximately)
/*!40000 ALTER TABLE `items` DISABLE KEYS */;
INSERT INTO `items` (`id`, `title`, `item_order`, `created_at`, `updated_at`) VALUES
(1, 'Test 1', 4, '0000-00-00 00:00:00', '2015-10-31 20:49:28');
INSERT INTO `items` (`id`, `title`, `item_order`, `created_at`, `updated_at`) VALUES
(124, 'Testing', 5, '2015-10-30 10:20:42', '2015-10-31 20:49:28');
INSERT INTO `items` (`id`, `title`, `item_order`, `created_at`, `updated_at`) VALUES
(127, 'Ohhhhhh', 7, '2015-10-30 10:40:27', '2015-10-31 20:49:26');
INSERT INTO `items` (`id`, `title`, `item_order`, `created_at`, `updated_at`) VALUES
(131, 'Another item', 3, '2015-10-30 10:54:12', '2015-10-31 20:49:28');
INSERT INTO `items` (`id`, `title`, `item_order`, `created_at`, `updated_at`) VALUES
(141, 'yet another item', 1, '2015-10-30 11:53:44', '2015-10-31 20:49:28');
INSERT INTO `items` (`id`, `title`, `item_order`, `created_at`, `updated_at`) VALUES
(143, 'new', 6, '2015-10-30 12:34:29', '2015-10-31 20:49:26');
INSERT INTO `items` (`id`, `title`, `item_order`, `created_at`, `updated_at`) VALUES
(145, '12345', 2, '2015-10-30 14:31:37', '2015-10-31 20:49:28');
/*!40000 ALTER TABLE `items` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
c4111ff155481ba5e9cb603b8f4f82910de5146e | SQL | navikt/helse-spetakkel | /src/main/resources/db/migration/V6__vedtaksperiode_endret_historikk.sql | UTF-8 | 545 | 2.625 | 3 | [
"MIT"
] | permissive | CREATE TABLE vedtaksperiode_endret_historikk
(
vedtaksperiode_id UUID NOT NULL,
forrige VARCHAR(64) NOT NULL,
gjeldende VARCHAR(64) NOT NULL,
endringstidspunkt TIMESTAMP NOT NULL,
endringstidspunkt_nanos BIGINT NOT NULL
);
CREATE INDEX idx_vedtaksperiode_endret_historikk_id ON vedtaksperiode_endret_historikk (vedtaksperiode_id);
CREATE UNIQUE INDEX idx_vedtaksperiode_endret_historikk_tid ON vedtaksperiode_endret_historikk(endringstidspunkt,endringstidspunkt_nanos); | true |
b6a03e36d043150f672224a7acd0fabdbb1b2c0b | SQL | kimothokamau/sql_zoo | /SELECT_select.sql | UTF-8 | 3,153 | 4.71875 | 5 | [
"MIT"
] | permissive | -- List each country name where the population is larger than that of 'Russia'.
SELECT name FROM world
WHERE population >
(SELECT population FROM world
WHERE name='Russia')
-- Show the countries in Europe with a per capita GDP greater than 'United Kingdom'.
SELECT name
FROM world
WHERE continent = 'EUROPE'
AND (gdp/population) >
(SELECT (gdp/population) FROM world
WHERE name = 'United Kingdom')
-- List the name and continent of countries in the continents containing either Argentina or Australia. Order by name of the country.
SELECT name, continent
FROM world
WHERE continent IN ('South America', 'Oceania')
ORDER by name
-- Which country has a population that is more than Canada but less than Poland? Show the name and the population.
SELECT name, population
FROM world
WHERE population > (SELECT population FROM world WHERE name = 'Canada') AND
population < (SELECT population FROM world WHERE name = 'Poland')
-- Germany (population 80 million) has the largest population of the countries in Europe. Austria (population 8.5 million) has 11% of the population of Germany.
-- Show the name and the population of each country in Europe. Show the population as a percentage of the population of Germany.
SELECT name, CONCAT(CONVERT(DOUBLE PRECISION, ROUND((population/(SELECT population FROM world WHERE name = 'Germany')) * 100, 0)), '%')
AS percentage FROM world WHERE continent = 'Europe'
-- Which countries have a GDP greater than every country in Europe? [Give the name only.] (Some countries may have NULL gdp values)
SELECT name
FROM world
WHERE GDP > (SELECT MAX(gdp) from WORLD where continent = 'Europe')
-- Find the largest country (by area) in each continent, show the continent, the name and the area:
SELECT continent, name, area
FROM world
WHERE
area = (SELECT MAX(area) FROM world WHERE continent = 'Europe') OR
area = (SELECT MAX(area) FROM world WHERE continent = 'Africa') OR
area = (SELECT MAX(area) FROM world WHERE continent = 'North America') OR
area = (SELECT MAX(area) FROM world WHERE continent = 'South America') OR
area = (SELECT MAX(area) FROM world WHERE continent = 'Oceania') OR
area = (SELECT MAX(area) FROM world WHERE continent = 'Asia') OR
area = (SELECT MAX(area) FROM world WHERE continent = 'Eurasia') OR
area = (SELECT MAX(area) FROM world WHERE continent = 'Caribbean')
-- List each continent and the name of the country that comes first alphabetically.
SELECT continent, min(name) AS name
FROM world
GROUP BY continent
ORDER BY continent
-- Find the continents where all countries have a population <= 25000000. Then find the names of the countries associated with these continents. Show name, continent and population.
SELECT name, continent, population
FROM world a
WHERE 25000000 >= ALL(SELECT population FROM world b WHERE b.continent LIKE a.continent)
-- Some countries have populations more than three times that of any of their neighbours (in the same continent). Give the countries and continents.
SELECT name, continent
FROM world a
WHERE population >= ALL(SELECT population*3
FROM world b
WHERE a.continent = b.continent
and a.name != b.name) | true |
9360a5a6cbf9c7db72c4bde4a602ab70d299716d | SQL | mAminl/HWs | /AP-HW3/backend/create.sql | UTF-8 | 3,813 | 3.9375 | 4 | [] | no_license |
#create User:
CREATE TABLE "User" (
id SERIAL PRIMARY KEY,
telegram_id VARCHAR(255) NOT NULL,
phone VARCHAR(11) NOT NULL,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
first_name VARCHAR(30) NOT NULL,
last_name VARCHAR(30) NOT NULL,
verification_code VARCHAR(10) NOT NULL,
profile_picture_url TEXT NOT NULL,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL
);
#create BlockUser
create table "BlockUser" (
blocker_user_id integer not null,
blocked_user_id integer not null,
ecreated_at timestamp not null,
primary key (blocker_user_id, blocked_user_id),
foreign key (blocked_user_id) references "User"(id),
foreign key (blocker_user_id) references "User"(id)
);
#create data type
create type message_struct as enum (
'audio',
'video',
'image',
'text'
);
#create Message
create table "Message" (
id serial primary key,
sender_id integer not null,
receiver_id integer not null,
message_type message_struct not null,
message_text text not null,
created_at timestamp not null,
updated_at timestamp not null,
foreign key (sender_id) references "User"(id),
foreign key (receiver_id) references "User"(id)
);
#create Channel
create table "Channel" (
id serial primary key,
telegram_id varchar(255) not null,
title varchar(30) not null,
info varchar(100),
creator_id integer not null,
created_at timestamp not null,
updated_at timestamp not null,
foreign key (creator_id) references "User"(id)
);
#create Group
create table "Group" (
id serial primary key,
creator_id integer not null,
title varchar(30) not null,
join_url text not null,
created_at timestamp not null,
updated_at timestamp not null,
foreign key (creator_id) references "User"(id)
);
#create GroupMessage
create table "GroupMessage" (
id serial primary key,
group_id integer not null,
sender_id integer not null,
message_type message_struct not null,
message_text text not null,
created_at timestamp not null,
updated_at timestamp not null,
foreign key (group_id) references "Group"(id),
foreign key (sender_id) references "User"(id)
);
#create ChannelMessage
create table "ChannelMessage" (
id serial primary key,
channel_id integer not null,
message_type message_struct not null,
message_text text not null,
created_at timestamp not null,
updated_at timestamp not null,
foreign key (channel_id) references "Channel"(id)
);
#create MessageAttachment
create table "MessageAttachment" (
message_id integer not null,
attachment_url text not null,
attachment_thumb_url text not null,
primary key (message_id, attachment_url, attachment_thumb_url),
foreign key (message_id) references "Message"(id)
);
#create GroupMessageAttachment
create table "GroupMessageAttachment" (
message_id integer not null,
attachment_url text not null,
attachment_thumb_url text not null,
primary key (message_id, attachment_url, attachment_thumb_url),
foreign key (message_id) references "GroupMessage"(id)
);
#create channelMessageAttachment
create table "ChannelMessageAttachment" (
message_id integer not null,
attachment_url text not null,
attachment_thumb_url text not null,
primary key (message_id, attachment_url,
attachment_thumb_url),
foreign key (message_id) references "ChannelMessage"(id)
);
#create channelMembership
create table "ChannelMembership"(
user_id integer not null,
channel_id integer not null,
created_at timestamp not null,
primary key (user_id, channel_id),
foreign key (user_id) references "User"(id),
foreign key (channel_id) references "Channel"(id)
);
#create GroupMembership
create table "GroupMembership" (
user_id integer not null,
group_id integer not null,
primary key (user_id, group_id),
created_at timestamp not null,
foreign key (user_id) references "User"(id),
foreign key (group_id) references "Group"(id)
); | true |
da1d7ec90904cce2fba4bb51196e8fc4b4dc09ac | SQL | Blackshirt99/1902 | /1902/db/oracle/wifi.sql | UTF-8 | 2,794 | 3.84375 | 4 | [] | no_license | create table student
(id number primary key,
name varchar2(20),
score number(3),
constraint ck_score check (score between 0 and 100),
gender char(1 char) default '็ท' check(gender in ('็ท','ๅฅณ'))
);
insert into student values(1,'wang',1,'ๅฅณ');
drop table student;
/
--PL/SQL
set SERveroutput on;
begin
-- dbms_output.put_line('Hello World.');
DBMS_OUTPUT.PUT('hello, ');
DBMS_OUTPUT.PUT('world. ');
dbms_output.new_line();
end;
/
--ๅฎไนๅ้ๅนถ่พๅบ
declare
a number(3) :=10;
b boolean :=FalsE;
c positive :=90;
d varchar2(20);
e signtype;
begin
d:='china';
select -1 into e from dual;
dbms_output.put_line(a||c||d||e);
end;
--================================================
declare
ran number(13);
grad nvarchar2(3):='xxx';
begin
ran := trunc(dbms_random.value(30,100));
dbms_output.put_line(ran);
if ran>=90 then
grad:='ไผ';
elsif ran>=80 then
grad:='่ฏ';
elsif ran>=70 then
grad:='ไธญ';
elsif ran>=60 then
grad := 'ๅๆ ผ';
else
grad:='ไธๅๆ ผ';
end if;
dbms_output.put_line(grad);
end;
--=======================================
declare
i number(2) := 1;
j number(2) ;
begin
while i<=9 loop
j:=1;
while j<=i loop
dbms_output.put(j || '*' || i ||'=' ||i*j ||' ');
j:= j+1;
end loop;
dbms_output.new_line();
i := i+1;
end loop;
end;
--================================loop===========================
declare
i number :=1;
begin
loop
exit when i>9;
dbms_output.put_line(i);
i := i+1;
end loop;
end;
--==========================for=============================
begin
for i in reverse 10..20 loop
dbms_output.put_line(i);
end loop;
end;
/
set serveroutput on;
begin
for i in (select * from employees) loop
dbms_output.put_line(i.employee_id || ':' || i.first_name);
end loop;
end;
--------------------------------DML
declare
new_name nvarchar2(20);
id number;
begin
id :=1;
new_name:='Jack';
update employees set first_name=new_name where employee_id=id;
dbms_output.put_line(sql%rowcount);
end;
-------------------------select--------------
declare
id number :=1000;
name nvarchar2(20);
did number;
g nchar(1);
counter number :=0;
begin
select count(*) into counter from employees where employee_id=id;
if counter = 1 then
select first_name into name from employees where employee_id=id;
DBMS_OUTPUT.put_line(name);
else
dbms_output.put_line('ๆฒกๆๆฐๆฎ');
end if;
exception
when no_data_found then
dbms_output.put_line('ๆฒกๆIDไธบ:' || id );
when too_many_row then
dbms_output.put_line('ๅๆฐไธๆญฃ็กฎๆฅ่ฏขๅฐๅพๅคๆฐๆฎใ');
end;
select * from employees;
| true |
5492e3b9b649762449908f7095ba466be865fa8f | SQL | Dipranil/test | /minipro.sql | UTF-8 | 7,656 | 3.171875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.0.4.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Nov 02, 2015 at 11:42 AM
-- Server version: 5.5.32
-- PHP Version: 5.4.16
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `minipro`
--
CREATE DATABASE IF NOT EXISTS `minipro` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `minipro`;
-- --------------------------------------------------------
--
-- Table structure for table `admin`
--
CREATE TABLE IF NOT EXISTS `admin` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`pass` varchar(50) NOT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `admin`
--
INSERT INTO `admin` (`uid`, `name`, `pass`) VALUES
(1, 'dipra', 'dipra2015');
-- --------------------------------------------------------
--
-- Table structure for table `category`
--
CREATE TABLE IF NOT EXISTS `category` (
`catid` int(10) NOT NULL,
`category` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `category`
--
INSERT INTO `category` (`catid`, `category`) VALUES
(1, 'plants'),
(2, 'seeds'),
(3, 'accessories');
-- --------------------------------------------------------
--
-- Table structure for table `citytable`
--
CREATE TABLE IF NOT EXISTS `citytable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`cityname` varchar(60) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
--
-- Dumping data for table `citytable`
--
INSERT INTO `citytable` (`id`, `cityname`) VALUES
(1, 'kolkata'),
(2, 'mumbai'),
(3, 'delhi'),
(4, 'uttar pradesh'),
(5, 'chennai');
-- --------------------------------------------------------
--
-- Table structure for table `ckeditor`
--
CREATE TABLE IF NOT EXISTS `ckeditor` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pagename` varchar(100) NOT NULL,
`pagecontents` varchar(10000) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Dumping data for table `ckeditor`
--
INSERT INTO `ckeditor` (`id`, `pagename`, `pagecontents`) VALUES
(1, 'about', '<p>\r\n Plant Nursery is one of the leading manufacturers and suppliers of varied types of Garden Trees. With most advanced horticulture techniques and experienced team, we grow the finest plants in West Bengal.Leveraging on our business competency, we have been able to attain a noteworthy position in the highly competitive domain. Today, we have firmly positioned ourselves as one of the overriding Decorative Plants Manufacturers and suppliers, based in India. With qualitative Indoor Bonsai Trees, decorative plants, ornamental plants etc., we have received overwhelming response from our numerous clients, based all over India.Last but not the least; we strive to bring you in the lap of Mother Nature with the aid of our range of plants.1111</p>\r\n');
-- --------------------------------------------------------
--
-- Table structure for table `contactus`
--
CREATE TABLE IF NOT EXISTS `contactus` (
`name` varchar(50) NOT NULL,
`email` varchar(30) NOT NULL,
`phone` int(20) NOT NULL,
`message` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `contactus`
--
INSERT INTO `contactus` (`name`, `email`, `phone`, `message`) VALUES
('dipranil chakraborty', 'asasas@yahoo.com', 2147483647, 'fsfsfsfsfsf');
-- --------------------------------------------------------
--
-- Table structure for table `items`
--
CREATE TABLE IF NOT EXISTS `items` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`catg` varchar(50) NOT NULL,
`subcatg` varchar(50) NOT NULL,
`image` varchar(200) NOT NULL,
`itemno` varchar(200) NOT NULL,
`name` varchar(100) NOT NULL,
`price` int(100) NOT NULL,
`description` varchar(200) NOT NULL,
PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ;
--
-- Dumping data for table `items`
--
INSERT INTO `items` (`uid`, `catg`, `subcatg`, `image`, `itemno`, `name`, `price`, `description`) VALUES
(1, '1', 'flower plants', '../file/1446402161Adenium.jpg', 'fl', 'Adenium', 100, ''),
(2, '1', 'flower plants', '../file/1446402197Anthurium.jpg', 'fl2', 'Anthurium', 158, ''),
(3, '1', 'flower plants', '../file/1446402218azalea.jpg', 'fl3', 'azalea', 200, ''),
(4, '1', 'flower plants', '../file/1446402298Bougainvellia Alok.jpg', 'fl4', 'Bougainvellia Alok', 20, ''),
(5, '1', 'flower plants', '../file/1446402324Bougainvillea Thimma.jpg', 'fl5', 'Bougainvillea Thimma', 200, ''),
(6, '1', 'flower plants', '../file/1446402356Hibiscus.jpg', 'fl6', 'Hibiscus', 300, ''),
(7, '1', 'flower plants', '../file/1446402400Ixora Singapuri.jpg', 'fl7', 'Ixora Singapuri', 100, ''),
(8, '1', 'flower plants', '../file/1446402440Ixora Singapuri1.jpg', 'fl8', 'Ixora Singapuri1', 500, ''),
(9, '1', 'fruit plants', '../file/1446402464Cherry.jpg', 'fr1', 'Cherry', 100, ''),
(10, '1', 'fruit plants', '../file/1446402480Clove.jpg', 'fr2', 'Clove', 150, ''),
(11, '1', 'fruit plants', '../file/1446402514jackfruit.JPG', 'fr3', 'jackfruit', 200, ''),
(12, '1', 'fruit plants', '../file/1446402532lemon tree.jpg', 'fr4', 'lemon tree', 100, ''),
(13, '1', 'fruit plants', '../file/1446402552Mangifera Indica.jpg', 'fr5', 'Mangifera Indica', 200, '');
-- --------------------------------------------------------
--
-- Table structure for table `register`
--
CREATE TABLE IF NOT EXISTS `register` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`email` varchar(100) NOT NULL,
`mobile` int(11) NOT NULL,
`gender` varchar(50) NOT NULL,
`city` varchar(50) NOT NULL,
`password` varchar(10) NOT NULL,
`repassword` varchar(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=145 ;
--
-- Dumping data for table `register`
--
INSERT INTO `register` (`id`, `name`, `email`, `mobile`, `gender`, `city`, `password`, `repassword`) VALUES
(135, 'a', 'aa@ggg.coo', 1234567890, 'male', 'kolkata', '123', '123'),
(136, 'a', 'aa@ggg.coo', 1234567890, 'male', 'kolkata', '123', '123'),
(137, 'a', 'aa@ggg.coo', 1234567890, 'male', 'mumbai', '', ''),
(138, 'a', 'aa@ggg.coo', 1234567890, 'male', 'kolkata', '12', ''),
(139, 'a', 'aa@ggg.coo', 1234567890, 'male', 'mumbai', '12345', '1234'),
(140, 'a', 'aa@ggg.coo', 1234567890, 'male', 'mumbai', '12345', '1234'),
(141, 'a', 'aa@ggg.coo', 1234567890, 'male', 'mumbai', '12345', '1234'),
(142, 'a', 'aa@ggg.coo', 1234567890, 'male', 'kolkata', '12345', '12345'),
(143, 'assdadas', 'xyz@gmail.com', 1234567890, 'male', 'kolkata', '12345', '12345'),
(144, 'kumar', 'kumarterang@gmail.com', 2147483647, 'male', 'kolkata', '12345', '12345');
-- --------------------------------------------------------
--
-- Table structure for table `subcategory`
--
CREATE TABLE IF NOT EXISTS `subcategory` (
`cat_id` int(20) NOT NULL,
`subcategory` varchar(30) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `subcategory`
--
INSERT INTO `subcategory` (`cat_id`, `subcategory`) VALUES
(1, 'flower plants'),
(1, 'fruit plants'),
(1, 'decorative plants'),
(2, 'flower seeds'),
(2, 'fruit seeds'),
(3, 'gloves'),
(3, 'winter tools'),
(3, 'pressure sprayers'),
(3, 'digging tools');
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
9c3b8033c10701963a403c49f7125328017a8cff | SQL | Nero951/tempFile | /mybatis-study/lib/init.sql | UTF-8 | 2,318 | 3.734375 | 4 | [] | no_license | drop
database if exists mybatis_study;
create
database mybatis_study character set utf8mb4;
use
mybatis_study;
drop table if exists user;
create table user
(
id int primary key auto_increment,
username varchar(20) not null unique comment '่ดฆๅท',
password varchar(20) not null comment 'ๅฏ็ ',
nickname varchar(20) comment '็จๆทๆต็งฐ',
sex bit default 0 comment 'ๆงๅซ๏ผ0/falseไธบๅฅณ๏ผ1/trueไธบ็ท',
birthday date comment '็ๆฅ',
head varchar(50) comment 'ๅคดๅๅฐๅ',
create_time timestamp default now() comment 'ๅๅปบๆฅๆ๏ผ้ป่ฎคไธบๆๅ
ฅๆถ็ๆฅๆ'
) comment '็จๆท่กจ';
drop table if exists article;
create table article
(
id int primary key auto_increment,
title varchar(20) not null comment 'ๆ็ซ ๆ ้ข',
content mediumtext not null comment 'ๆ็ซ ๅ
ๅฎน',
view_count int default 0 comment 'ๆ็ซ ๆต่ง้',
user_id int comment 'ๅค้ฎ๏ผ็จๆทid',
create_time timestamp default now() comment 'ๅๅปบๆฅๆ๏ผ้ป่ฎคไธบๆๅ
ฅๆถ็ๆฅๆ',
foreign key (user_id) references user (id)
) comment 'ๆ็ซ ่กจ';
insert into user(username, password)
values ('a1', '11');
insert into user(username, password)
values ('a2', '12');
insert into user(username, password)
values ('b', '2');
insert into user(username, password)
values ('c', '3');
insert into article(title, content, user_id) value ('ๅฟซ้ๆๅบ', 'public ...',
1);
insert into article(title, content, user_id) value ('ๅๆณกๆๅบ', 'private
...', 1);
insert into article(title, content, user_id) value ('้ๆฉๆๅบ', 'private
...', 1);
insert into article(title, content, user_id) value ('ๅฝๅนถๆๅบ', 'public ...',
2);
insert into article(title, content, user_id) value ('ๆๅ
ฅๆๅบ', 'protected
...', 2);
insert into article(title, content, user_id) value ('ๅธๅฐๆๅบ', 'protected
...', 3);
insert into article(title, content, user_id) value ('List', 'public ...',
4);
insert into article(title, content, user_id) value ('Set', 'public ...', 4);
insert into article(title, content, user_id) value ('Map', 'public ...', 4);
| true |
41e1cc501666fa6706018f5a2d5f298eaa24ddb5 | SQL | eaudeweb/art17-2006 | /article17/speciessummary/details/select_species_countries.sql | UTF-8 | 442 | 2.75 | 3 | [] | no_license | -- Z SQL Method
-- /article17/speciessummary/details/select_species_countries
<params>region
assesment_speciesname</params>
SELECT
etc_data_species_regions.eu_country_code,
etc_data_species_regions.code,
etc_data_species_regions.conclusion_assessment,
etc_data_species_regions.region
FROM
etc_data_species_regions
WHERE
<dtml-sqltest region type="string" multiple="multiple">
AND
<dtml-sqltest assesment_speciesname type=string> | true |
a6852d819af42ee07f8c07520134b4de7796a9bd | SQL | muhammadrefaat91/agrimarket_gp_iti | /AgriMarket_v2.2/src/main/resources/agrimarket_data_dump.sql | UTF-8 | 17,643 | 3.078125 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.7.9, for Win64 (x86_64)
--
-- Host: localhost Database: agrimarket_schema
-- ------------------------------------------------------
-- Server version 5.0.51b-community-nt
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Not dumping tablespaces as no INFORMATION_SCHEMA.FILES table on this server
--
-- -----------------------------------------------------
-- Schema agrimarket_schema
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `agrimarket_schema` DEFAULT CHARACTER SET utf8 ;
USE `agrimarket_schema` ;
--
-- Table structure for table `category`
--
DROP TABLE IF EXISTS `category`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `category` (
`id` int(11) NOT NULL auto_increment,
`name_ar` varchar(45) default NULL,
`name_en` varchar(45) default NULL,
`image_url` varchar(200) default NULL,
`parent_category_id` int(11) default '-1',
`sound_url` varchar(200) default NULL,
PRIMARY KEY (`id`),
KEY `fk_Category_Category1_idx` (`parent_category_id`),
CONSTRAINT `fk_Category_Category1` FOREIGN KEY (`parent_category_id`) REFERENCES `category` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `category`
--
LOCK TABLES `category` WRITE;
/*!40000 ALTER TABLE `category` DISABLE KEYS */;
INSERT INTO `category` VALUES (1,'root','root','/images/categories/mango.jpg',1,NULL),(7,'ู
ุญุงุตูู','Crops','/images/categories/cucumber.jpg',1,'/sound/categories/1.mp3'),(8,'ู
ุจูุฏุงุช','Pesticides','/images/categories/mobeed.jpg',1,'/sound/categories/1.mp3'),(9,'ุฃุณู
ุฏุฉ','Fertilizers','/images/categories/fertilizer.jpg',1,'/sound/categories/1.mp3'),(10,'ุชูุงูู','Seeds','/images/categories/seed.jpg',1,'/sound/categories/1.mp3'),(11,'ุฎุถุงุฑ','Vegetables','/images/categories/cucumber.jpg',7,'/sound/categories/1.mp3'),(12,'ูุงููุฉ','Fruits','/images/categories/mango.jpg',7,'/sound/categories/1.mp3');
/*!40000 ALTER TABLE `category` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `encryption`
--
DROP TABLE IF EXISTS `encryption`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `encryption` (
`id` int(11) NOT NULL auto_increment,
`user` varchar(25) NOT NULL,
`private key` varchar(100) NOT NULL,
`public key` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `encryption`
--
LOCK TABLES `encryption` WRITE;
/*!40000 ALTER TABLE `encryption` DISABLE KEYS */;
/*!40000 ALTER TABLE `encryption` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `history`
--
DROP TABLE IF EXISTS `history`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `history` (
`User_id` int(11) NOT NULL,
`Product_id` int(11) NOT NULL,
`Unit_id` int(11) NOT NULL,
`price_per_unit_id` int(11) NOT NULL,
`start_date` date NOT NULL,
`price` float NOT NULL,
`quantity` float NOT NULL,
`user_phone` varchar(45) default NULL,
`user_location` varchar(100) default NULL,
`recommended` tinyint(1) default '0',
`image_url` varchar(200) default NULL,
`description` varchar(500) default NULL,
`id` int(11) NOT NULL auto_increment,
PRIMARY KEY (`id`),
KEY `fk_User_has_Product_Product3_idx` (`Product_id`),
KEY `fk_User_has_Product_User2_idx` (`User_id`),
KEY `fk_User_has_Product_Unit1_idx` (`Unit_id`),
KEY `fk_User_has_Product_Unit2_idx` (`price_per_unit_id`),
CONSTRAINT `fk_User_has_Product_Product3` FOREIGN KEY (`Product_id`) REFERENCES `product` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_has_Product_Unit1` FOREIGN KEY (`Unit_id`) REFERENCES `unit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_has_Product_Unit2` FOREIGN KEY (`price_per_unit_id`) REFERENCES `unit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_has_Product_User2` FOREIGN KEY (`User_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `history`
--
LOCK TABLES `history` WRITE;
/*!40000 ALTER TABLE `history` DISABLE KEYS */;
/*!40000 ALTER TABLE `history` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `plant_has_season`
--
DROP TABLE IF EXISTS `plant_has_season`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `plant_has_season` (
`Product_id` int(11) NOT NULL,
`Season_id` int(11) NOT NULL,
PRIMARY KEY (`Product_id`,`Season_id`),
KEY `fk_Product_has_Season_Season1_idx` (`Season_id`),
KEY `fk_Product_has_Season_Product1_idx` (`Product_id`),
CONSTRAINT `fk_Product_has_Season_Product1` FOREIGN KEY (`Product_id`) REFERENCES `product` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Product_has_Season_Season1` FOREIGN KEY (`Season_id`) REFERENCES `season` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `plant_has_season`
--
LOCK TABLES `plant_has_season` WRITE;
/*!40000 ALTER TABLE `plant_has_season` DISABLE KEYS */;
/*!40000 ALTER TABLE `plant_has_season` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `product`
--
DROP TABLE IF EXISTS `product`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `product` (
`id` int(11) NOT NULL auto_increment,
`name_ar` varchar(45) default NULL,
`name_en` varchar(45) default NULL,
`image_url` varchar(200) default NULL,
`Category_id` int(11) NOT NULL,
`organic` tinyint(1) default '0',
`sound_url` varchar(200) default NULL,
PRIMARY KEY (`id`),
KEY `fk_Plant_Category1_idx` (`Category_id`),
CONSTRAINT `fk_Plant_Category1` FOREIGN KEY (`Category_id`) REFERENCES `category` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `product`
--
LOCK TABLES `product` WRITE;
/*!40000 ALTER TABLE `product` DISABLE KEYS */;
INSERT INTO `product` VALUES (30,'ุฎูุงุฑ','Cucumber','/images/products/cucumber.jpg',11,1,'/sound/products/1.mp3'),(31,'ุทู
ุงุทู
','Tomato','/images/products/tomato.jpg',11,1,'/sound/products/1.mp3'),(32,'ู
ูุฒ','Banana','/images/products/banana.jpg',12,0,'/sound/products/1.mp3'),(33,'ู
ุจูุฏ1','Mobeed1','/images/products/mobeed1.jpg',8,0,'/sound/products/1.mp3'),(34,'ู
ุจูุฏ2','Mobeed2','/images/products/mobeed.jpg',8,0,'/sound/products/1.mp3'),(35,'ุณู
ุงุฏ1','Semad1','/images/products/fertilizer1.jpg',9,0,'/sound/products/1.mp3'),(36,'ุณู
ุงุฏ2','Semad2','/images/products/fertilizer2.jpg',9,0,'/sound/products/1.mp3'),(37,'ุชูุงูู1','Ta2awi1','/images/products/seed1.jpg',10,0,'/sound/products/1.mp3'),(38,'ุชูุงูู2','Ta2awi2','/images/products/seed2.jpg',10,0,'/sound/products/1.mp3'),(39,'ู
ุงูุฌู','Mango','/images/products/mango.jpg',12,0,'/to be continue');
/*!40000 ALTER TABLE `product` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `season`
--
DROP TABLE IF EXISTS `season`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `season` (
`id` int(11) NOT NULL auto_increment,
`name_ar` varchar(45) default NULL,
`name_en` varchar(45) default NULL,
`start_date` date default NULL,
`end_date` date default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `season`
--
LOCK TABLES `season` WRITE;
/*!40000 ALTER TABLE `season` DISABLE KEYS */;
INSERT INTO `season` VALUES (1,'ุตูู','summer','2016-12-12','2016-10-10');
/*!40000 ALTER TABLE `season` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `unit`
--
DROP TABLE IF EXISTS `unit`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `unit` (
`id` int(11) NOT NULL auto_increment,
`name_ar` varchar(45) default NULL,
`name_en` varchar(45) default NULL,
`type` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `unit`
--
LOCK TABLES `unit` WRITE;
/*!40000 ALTER TABLE `unit` DISABLE KEYS */;
INSERT INTO `unit` VALUES (2,'ูููู','Kilo','Weight'),(3,'ุทู','Ton','Weight'),(4,'ุฑุทู','Ratl','Weight'),(5,'ูุฏุงู','Feddan','Area'),(6,'ููุฑุงุท','Qirat','Area'),(7,'ุฅุฑุฏุจ','Erdab','Weight');
/*!40000 ALTER TABLE `unit` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user`
--
DROP TABLE IF EXISTS `user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user` (
`mail` varchar(100) NOT NULL,
`full_name` varchar(100) NOT NULL,
`mobile` varchar(45) default NULL,
`registration_channel` int(11) default NULL,
`lat` double default NULL,
`long` double default NULL,
`governerate` varchar(100) default NULL,
`image_url` varchar(200) default NULL,
`id` int(11) NOT NULL auto_increment,
`rates_average` int(11) default '-1',
`logged_in` tinyint(1) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user`
--
LOCK TABLES `user` WRITE;
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_data`
--
DROP TABLE IF EXISTS `user_data`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_data` (
`User_id` int(11) NOT NULL,
`id` int(11) NOT NULL auto_increment,
`IMEI` varchar(20) NOT NULL,
`device_channel` int(11) NOT NULL,
`device_language` varchar(10) NOT NULL,
`os_id` varchar(45) default NULL,
`os_version` varchar(45) default NULL,
PRIMARY KEY (`id`),
KEY `fk_User_Data_User1_idx` (`User_id`),
CONSTRAINT `fk_User_Data_User1` FOREIGN KEY (`User_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_data`
--
LOCK TABLES `user_data` WRITE;
/*!40000 ALTER TABLE `user_data` DISABLE KEYS */;
/*!40000 ALTER TABLE `user_data` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_interested_in_product`
--
DROP TABLE IF EXISTS `user_interested_in_product`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_interested_in_product` (
`User_id` int(11) NOT NULL,
`Product_id` int(11) NOT NULL,
PRIMARY KEY (`User_id`,`Product_id`),
KEY `fk_User_has_Product_Product1_idx` (`Product_id`),
CONSTRAINT `fk_User_has_Product_Product1` FOREIGN KEY (`Product_id`) REFERENCES `product` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_has_Product_User` FOREIGN KEY (`User_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_interested_in_product`
--
LOCK TABLES `user_interested_in_product` WRITE;
/*!40000 ALTER TABLE `user_interested_in_product` DISABLE KEYS */;
/*!40000 ALTER TABLE `user_interested_in_product` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_offer_product_fixed`
--
DROP TABLE IF EXISTS `user_offer_product_fixed`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_offer_product_fixed` (
`User_id` int(11) NOT NULL,
`Product_id` int(11) NOT NULL,
`start_date` date NOT NULL,
`price` float NOT NULL,
`quantity` float NOT NULL,
`user_phone` varchar(45) default NULL,
`user_location` varchar(100) default NULL,
`Unit_id` int(11) NOT NULL default '-1',
`recommended` tinyint(1) default '0',
`image_url` varchar(200) default NULL,
`description` varchar(500) default NULL,
`price_per_unit_id` int(11) NOT NULL,
`id` int(11) NOT NULL auto_increment,
PRIMARY KEY (`id`),
KEY `fk_User_has_Product_Product4_idx` (`Product_id`),
KEY `fk_User_offer_Product_area_fixed_AreaUnit1_idx` (`Unit_id`),
KEY `fk_User_offer_Product_area_fixed_Unit2_idx` (`price_per_unit_id`),
KEY `fk_User_has_Product_User3` (`User_id`),
CONSTRAINT `fk_User_has_Product_Product4` FOREIGN KEY (`Product_id`) REFERENCES `product` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_has_Product_User3` FOREIGN KEY (`User_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_offer_Product_area_fixed_AreaUnit1` FOREIGN KEY (`Unit_id`) REFERENCES `unit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_offer_Product_area_fixed_Unit2` FOREIGN KEY (`price_per_unit_id`) REFERENCES `unit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_offer_product_fixed`
--
LOCK TABLES `user_offer_product_fixed` WRITE;
/*!40000 ALTER TABLE `user_offer_product_fixed` DISABLE KEYS */;
/*!40000 ALTER TABLE `user_offer_product_fixed` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_plants_plant`
--
DROP TABLE IF EXISTS `user_plants_plant`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_plants_plant` (
`User_id` int(11) NOT NULL,
`Product_id` int(11) NOT NULL,
`AreaUnit_id` int(11) NOT NULL,
`Season_id` int(11) NOT NULL,
`no_units` float NOT NULL,
`id` int(11) NOT NULL auto_increment,
`year` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_User_has_Product_Product2_idx` (`Product_id`),
KEY `fk_User_plants_Product_AreaUnit1_idx` (`AreaUnit_id`),
KEY `fk_User_plants_Product_Season1_idx` (`Season_id`),
KEY `fk_User_has_Product_User1` (`User_id`),
CONSTRAINT `fk_User_has_Product_Product2` FOREIGN KEY (`Product_id`) REFERENCES `product` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_has_Product_User1` FOREIGN KEY (`User_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_plants_Product_AreaUnit1` FOREIGN KEY (`AreaUnit_id`) REFERENCES `unit` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_plants_Product_Season1` FOREIGN KEY (`Season_id`) REFERENCES `season` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_plants_plant`
--
LOCK TABLES `user_plants_plant` WRITE;
/*!40000 ALTER TABLE `user_plants_plant` DISABLE KEYS */;
/*!40000 ALTER TABLE `user_plants_plant` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `user_rates_user`
--
DROP TABLE IF EXISTS `user_rates_user`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `user_rates_user` (
`Rater_id` int(11) NOT NULL,
`Rated_id` int(11) NOT NULL,
`rate` int(11) NOT NULL,
`review` mediumtext,
PRIMARY KEY (`Rater_id`,`Rated_id`),
KEY `fk_User_has_User_User2_idx` (`Rated_id`),
CONSTRAINT `fk_User_has_User_User1` FOREIGN KEY (`Rater_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_User_has_User_User2` FOREIGN KEY (`Rated_id`) REFERENCES `user` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `user_rates_user`
--
LOCK TABLES `user_rates_user` WRITE;
/*!40000 ALTER TABLE `user_rates_user` DISABLE KEYS */;
/*!40000 ALTER TABLE `user_rates_user` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2016-06-14 1:17:39
| true |
c98bc3cbbdc53abe8e801476eec044709a143eea | SQL | radtek/abs3 | /sql/mmfo/bars/Procedure/p_job_regkkforbk.sql | UTF-8 | 3,267 | 2.984375 | 3 | [] | no_license |
PROMPT =====================================================================================
PROMPT *** Run *** ========== Scripts /Sql/BARS/Procedure/P_JOB_REGKKFORBK.sql =========***
PROMPT =====================================================================================
PROMPT *** Create procedure P_JOB_REGKKFORBK ***
CREATE OR REPLACE PROCEDURE BARS.P_JOB_REGKKFORBK is
type t_kkforbk_data is table of kkforbk_data%rowtype;
l_kkforbk_data t_kkforbk_data;
begin
select * bulk collect
into l_kkforbk_data
from kkforbk_data t
where t.errcode is null;
if l_kkforbk_data.count > 0 then
for i in l_kkforbk_data.first .. l_kkforbk_data.last
loop
regkkforbk(p_surname => l_kkforbk_data(i).surname,
p_name => l_kkforbk_data(i).name,
p_fname => l_kkforbk_data(i).fname,
p_latname => l_kkforbk_data(i).latname,
p_password => l_kkforbk_data(i).password,
p_sex => l_kkforbk_data(i).sex,
p_birthdate => l_kkforbk_data(i).birthdate,
p_series => l_kkforbk_data(i).series,
p_num => l_kkforbk_data(i).num,
p_issdate => l_kkforbk_data(i).issdate,
p_issuer => l_kkforbk_data(i).issuer,
p_identcode => l_kkforbk_data(i).identcode,
p_region => l_kkforbk_data(i).region,
p_area => l_kkforbk_data(i).area,
p_city => l_kkforbk_data(i).city,
p_address => l_kkforbk_data(i).address,
p_house => l_kkforbk_data(i).house,
p_zipcode => l_kkforbk_data(i).zipcode,
p_phone => l_kkforbk_data(i).phone,
p_mphone => l_kkforbk_data(i).mphone,
p_email => l_kkforbk_data(i).email,
p_typedoc => l_kkforbk_data(i).typedoc,
p_photodata => l_kkforbk_data(i).photodata,
p_branch => l_kkforbk_data(i).branch,
p_card_code => l_kkforbk_data(i).card_code,
p_is_social => l_kkforbk_data(i).is_social,
p_errcode => l_kkforbk_data(i).errcode,
p_errmsg => l_kkforbk_data(i).errmsg,
p_rnk => l_kkforbk_data(i).rnk,
p_nls => l_kkforbk_data(i).nls);
update kkforbk_data k
set k.errcode = l_kkforbk_data(i).errcode,
k.errmsg = l_kkforbk_data(i).errmsg,
k.rnk = l_kkforbk_data(i).rnk,
k.nls = l_kkforbk_data(i).nls,
k.procdate = sysdate
where k.id = l_kkforbk_data(i).id;
end loop;
end if;
end p_job_regkkforbk;
/
show err;
PROMPT *** Create grants P_JOB_REGKKFORBK ***
grant EXECUTE on P_JOB_REGKKFORBK to BARS_ACCESS_DEFROLE;
PROMPT =====================================================================================
PROMPT *** End *** ========== Scripts /Sql/BARS/Procedure/P_JOB_REGKKFORBK.sql =========***
PROMPT =====================================================================================
| true |
3cc117d9ae821e369dfd120e230225b530a0f8d9 | SQL | phac-nml/ngstar | /MySQLWorkbench/PopulateDatabaseStatements/NGSTAR_schema.sql | UTF-8 | 9,691 | 3.609375 | 4 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
CREATE SCHEMA IF NOT EXISTS `NGSTAR` DEFAULT CHARACTER SET utf8 ;
USE `NGSTAR` ;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Loci`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Loci` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Loci` (
`loci_id` INT(11) NOT NULL AUTO_INCREMENT,
`loci_name` VARCHAR(45) NULL DEFAULT NULL,
`sequence_length` INT(11) NULL DEFAULT NULL,
`is_allele_type_int` TINYINT(1) NULL DEFAULT NULL,
`is_onishi_type` TINYINT(1) NULL DEFAULT NULL,
PRIMARY KEY (`loci_id`))
ENGINE = InnoDB
AUTO_INCREMENT = 7
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Metadata`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Metadata` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Metadata` (
`metadata_id` INT(11) NOT NULL AUTO_INCREMENT,
`country` VARCHAR(45) NULL DEFAULT NULL,
`patient_gender` CHAR(1) NULL DEFAULT NULL,
`patient_age` TINYINT(4) NULL DEFAULT NULL,
`epi_data` TEXT NULL DEFAULT NULL,
`beta_lactamase` VARCHAR(45) NULL DEFAULT NULL,
`curator_comment` TEXT NULL DEFAULT NULL,
`mics_determined_by` VARCHAR(45) NULL DEFAULT NULL,
`collection_date` DATE NULL DEFAULT NULL,
`amr_markers` TEXT NULL,
PRIMARY KEY (`metadata_id`))
ENGINE = InnoDB
AUTO_INCREMENT = 9588
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Allele`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Allele` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Allele` (
`allele_id` INT(11) NOT NULL AUTO_INCREMENT,
`allele_type` DECIMAL(7,3) NULL DEFAULT NULL,
`allele_sequence` TEXT NULL DEFAULT NULL,
`loci_id` INT(11) NOT NULL,
`metadata_id` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`allele_id`),
INDEX `fk_tbl_Allele_1_idx` (`loci_id` ASC),
INDEX `fk_tbl_Allele_tbl_Metadata1_idx` (`metadata_id` ASC),
CONSTRAINT `fk_tbl_Allele_1`
FOREIGN KEY (`loci_id`)
REFERENCES `NGSTAR`.`tbl_Loci` (`loci_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tbl_Allele_tbl_Metadata1`
FOREIGN KEY (`metadata_id`)
REFERENCES `NGSTAR`.`tbl_Metadata` (`metadata_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 8225
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_SequenceType`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_SequenceType` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_SequenceType` (
`seq_type_id` INT(11) NOT NULL AUTO_INCREMENT,
`seq_type_value` INT(11) NULL DEFAULT NULL,
`metadata_id` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`seq_type_id`),
UNIQUE INDEX `seq_type_value` (`seq_type_value` ASC),
INDEX `fk_tbl_SequenceType_tbl_Metadata1_idx` (`metadata_id` ASC),
CONSTRAINT `fk_tbl_SequenceType_tbl_Metadata1`
FOREIGN KEY (`metadata_id`)
REFERENCES `NGSTAR`.`tbl_Metadata` (`metadata_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
AUTO_INCREMENT = 945
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Allele_SequenceType`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Allele_SequenceType` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Allele_SequenceType` (
`allele_id` INT(11) NOT NULL,
`seq_type_id` INT(11) NOT NULL,
PRIMARY KEY (`allele_id`, `seq_type_id`),
INDEX `fk_tbl_Allele_SequenceType_1_idx` (`allele_id` ASC),
INDEX `fk_tbl_Allele_SequenceType_2_idx` (`seq_type_id` ASC),
CONSTRAINT `fk_tbl_Allele_SequenceType_1`
FOREIGN KEY (`allele_id`)
REFERENCES `NGSTAR`.`tbl_Allele` (`allele_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tbl_Allele_SequenceType_2`
FOREIGN KEY (`seq_type_id`)
REFERENCES `NGSTAR`.`tbl_SequenceType` (`seq_type_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_IsolateClassification`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_IsolateClassification` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_IsolateClassification` (
`classification_id` INT(11) NOT NULL AUTO_INCREMENT,
`classification_name` VARCHAR(100) NULL DEFAULT NULL,
`classification_code` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`classification_id`))
ENGINE = InnoDB
AUTO_INCREMENT = 14
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Loci_Scheme`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Loci_Scheme` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Loci_Scheme` (
`loci_id` INT(11) NOT NULL,
`scheme_id` INT(11) NOT NULL,
PRIMARY KEY (`loci_id`, `scheme_id`))
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_MIC`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_MIC` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_MIC` (
`mic_id` INT(11) NOT NULL AUTO_INCREMENT,
`antimicrobial_name` VARCHAR(75) NULL DEFAULT NULL,
PRIMARY KEY (`mic_id`))
ENGINE = InnoDB
AUTO_INCREMENT = 9
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Metadata_MIC`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Metadata_MIC` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Metadata_MIC` (
`metadata_id` INT(11) NOT NULL,
`mic_id` INT(11) NOT NULL,
`mic_comparator` CHAR(2) NULL DEFAULT NULL,
`mic_value` FLOAT NULL DEFAULT NULL,
`interpretation_value` TEXT NULL DEFAULT NULL,
PRIMARY KEY (`metadata_id`, `mic_id`),
INDEX `fk_tbl_Metadata_MIC_1_idx` (`metadata_id` ASC),
INDEX `fk_tbl_Metadata_MIC_2_idx` (`mic_id` ASC),
CONSTRAINT `fk_tbl_Metadata_MIC_1`
FOREIGN KEY (`metadata_id`)
REFERENCES `NGSTAR`.`tbl_Metadata` (`metadata_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tbl_Metadata_MIC_2`
FOREIGN KEY (`mic_id`)
REFERENCES `NGSTAR`.`tbl_MIC` (`mic_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Scheme`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Scheme` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Scheme` (
`scheme_id` INT(11) NOT NULL AUTO_INCREMENT,
`scheme_name` VARCHAR(45) NULL DEFAULT NULL,
`bacterial_species` VARCHAR(75) NULL DEFAULT NULL,
PRIMARY KEY (`scheme_id`),
UNIQUE INDEX `scheme_name_UNIQUE` (`scheme_name` ASC))
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Metadata_IsolateClassification`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Metadata_IsolateClassification` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Metadata_IsolateClassification` (
`metadata_id` INT(11) NOT NULL,
`classification_id` INT(11) NOT NULL,
PRIMARY KEY (`metadata_id`, `classification_id`),
INDEX `fk_tbl_Metadata_IsolateClassification_2_idx` (`classification_id` ASC),
CONSTRAINT `fk_tbl_Metadata_IsolateClassification_1`
FOREIGN KEY (`metadata_id`)
REFERENCES `NGSTAR`.`tbl_Metadata` (`metadata_id`)
ON DELETE CASCADE
ON UPDATE CASCADE,
CONSTRAINT `fk_tbl_Metadata_IsolateClassification_2`
FOREIGN KEY (`classification_id`)
REFERENCES `NGSTAR`.`tbl_IsolateClassification` (`classification_id`)
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_AminoAcidPositions`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_AminoAcidPositions` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_AminoAcidPositions` (
`id` INT NOT NULL AUTO_INCREMENT,
`loci_id` INT NOT NULL,
`amino_acid_position` INT NOT NULL,
`amino_acid_char` VARCHAR(45) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `id_UNIQUE` (`id` ASC),
CONSTRAINT `fk_tbl_AminoAcidPositions_1`
FOREIGN KEY (`loci_id`)
REFERENCES `NGSTAR`.`tbl_Loci` (`loci_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `NGSTAR`.`tbl_Onishi`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `NGSTAR`.`tbl_Onishi` ;
CREATE TABLE IF NOT EXISTS `NGSTAR`.`tbl_Onishi` (
`id` INT NOT NULL AUTO_INCREMENT,
`loci_id` INT NOT NULL,
`onishi_type` VARCHAR(100) NULL,
`mosaic` VARCHAR(45) NOT NULL,
`amino_acid_profile` VARCHAR(83) NULL,
INDEX `loci_id_idx` (`loci_id` ASC),
PRIMARY KEY (`id`),
UNIQUE INDEX `tbl_Onishicol_UNIQUE` (`id` ASC),
CONSTRAINT `loci_id`
FOREIGN KEY (`loci_id`)
REFERENCES `NGSTAR`.`tbl_Loci` (`loci_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
| true |
a1c20b88b151904f2c9d517ae10ade4c2f5a4f77 | SQL | borbuevbeksultan/wallet | /server/src/main/resources/db/migration/V1__zero_migration.sql | UTF-8 | 368 | 3.359375 | 3 | [] | no_license | CREATE TABLE user (
id int AUTO_INCREMENT PRIMARY KEY,
email varchar(255)
);
CREATE TABLE wallet (
id int AUTO_INCREMENT PRIMARY KEY,
user int,
FOREIGN KEY (user) REFERENCES user(id)
);
CREATE TABLE balance (
id int AUTO_INCREMENT PRIMARY KEY,
wallet int,
amount decimal(19, 9),
currency varchar(55),
FOREIGN KEY (wallet) REFERENCES wallet(id)
); | true |
41f050263036a29fcc1779c3e6736a78321d3870 | SQL | javascripto/sql | /04-select-like-not-like-limit.sql | UTF-8 | 1,146 | 4.125 | 4 | [] | no_license | -- SELECT LIKE, NOT LIME, LIMIT, TOP, NUMROW
use db_socios;
-- Buscar pessoas que o nome comeรงe com 'a'
select * from socios where nome like 'a%';
-- Buscar pessoas que o nome NรO comeรงe com 'a'
select * from socios where nome not like 'a%';
-- Buscar pessoas que o nome comeรงe com tenham
-- o nome 'garcia' em qualquer parte do cmapo nome
select * from socios where nome like '%garcia%';
-- Buscar pessoas que tenham o telefone comeรงando em 93 e terminando em 98
select * from socios where telefone like '93%98';
-- Buscar registros em que o telefone comece com 93 e o quarto digito seja um 6
select * from socios where telefone like '93_6%';
-- Selecionar todos registros onde o nome comeรงe
-- com 'ana', ordenados pelo id_socio de forma
-- descendente e limitando a 3 resultados
select * from socios where nome like 'ana %' order by id_socio desc limit 3;
-- Alguns SGBD's nรฃo utilizam o comando limit mas sim os comandos TOP ou NUMROW
-- Fazendo paginaรงรฃo com limit
select * from socios limit 5;
select * from socios limit 0,5;
select * from socios limit 5,5;
select * from socios limit 10,5;
select * from socios limit 15,5;
| true |
3b24ab9749ad0c3e13aaa6222b41cc9ea9ee4d82 | SQL | sangjiexun/limsproduct2 | /limsproduct/src/main/resources/db/migration/V20190507_1.0__proc_insert_attendance.sql | UTF-8 | 6,884 | 3.90625 | 4 | [] | no_license | -- ๅๅ
ฅๅนถๆดๆฐtimetable_attendanceๆฐๆฎ
-- ้ไนไธบ 2019ๅนด5ๆ7ๆฅ
DROP PROCEDURE if exists `proc_insert_attendance`;
DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_insert_attendance`(IN `term_id` int)
BEGIN
DELETE FROM timetable_attendance WHERE timetable_attendance.term_id=term_id AND timetable_attendance.actual_attendance=0 AND timetable_attendance.attendance_machine=0;
INSERT INTO timetable_attendance(user_number,begin_time,end_time,start_class,end_class,weekday,`week`,appointment_id,style,term_id,course_no,created_date,attend_date)
SELECT tab_1.user_number,tab_1.begin_time,tab_1.end_time,tab_1.start_class,tab_1.end_class,tab_1.weekday,tab_1.`week`,
tab_1.appointment_id,tab_1.style,tab_1.term_id,tab_1.course_no,tab_1.created_date,tab_1.date FROM(
SELECT
scs.student_number AS user_number,
CONCAT(sw.date," ",st_start.start_date) AS begin_time,
CONCAT(sw.date," ",st_end.end_date) AS end_time,
tasn.start_class AS start_class,
tasn.end_class AS end_class,
sw.weekday AS weekday,
sw.`week` AS `week`,
'' AS labroom_id,
ta.id AS appointment_id,
ta.timetable_style AS style,
ta.term AS term_id,
sc.course_no AS course_no,
CURRENT_TIMESTAMP AS created_date,
sw.date
FROM timetable_appointment ta
JOIN timetable_appointment_same_number tasn ON tasn.appointment_id=ta.id
JOIN school_week sw ON sw.term_id=ta.term AND sw.weekday=ta.weekday AND sw.`week` BETWEEN tasn.start_week AND tasn.end_week
JOIN system_time st_start ON st_start.section = tasn.start_class
JOIN system_time st_end ON st_end.section = tasn.end_class
JOIN school_course sc ON sc.course_no=ta.course_no
JOIN school_course_detail scd ON scd.course_detail_no=ta.detail_id
JOIN school_course_student scs ON scs.course_detail_no=scd.course_detail_no
WHERE ta.`status`=1 AND ta.term=term_id AND ta.timetable_style<4
UNION
SELECT
tgs.username AS user_number,
CONCAT(sw.date," ",st_start.start_date) AS begin_time,
CONCAT(sw.date," ",st_end.end_date) AS end_time,
tasn.start_class AS start_class,
tasn.end_class AS end_class,
sw.weekday AS weekday,
sw.`week` AS `week`,
'' AS labroom_id,
ta.id AS appointment_id,
ta.timetable_style AS style,
ta.term AS term_id,
sc.course_no AS course_no,
CURRENT_TIMESTAMP AS created_date,
sw.date
FROM timetable_appointment ta
JOIN timetable_appointment_same_number tasn ON tasn.appointment_id=ta.id
JOIN school_week sw ON sw.term_id=ta.term AND sw.weekday=ta.weekday AND sw.`week` BETWEEN tasn.start_week AND tasn.end_week
JOIN system_time st_start ON st_start.section = tasn.start_class
JOIN system_time st_end ON st_end.section = tasn.end_class
JOIN school_course sc ON sc.course_no=ta.course_no
JOIN timetable_appointment_group tag ON tag.appointment_id=ta.id
JOIN timetable_group_students tgs ON tgs.group_id=tag.group_id
WHERE ta.`status`=1 AND ta.term=term_id AND (ta.timetable_style=4 OR ta.timetable_style=6)
UNION
SELECT
tcs.student_number AS user_number,
CONCAT(sw.date," ",st_start.start_date) AS begin_time,
CONCAT(sw.date," ",st_end.end_date) AS end_time,
tasn.start_class AS start_class,
tasn.end_class AS end_class,
sw.weekday AS weekday,
sw.`week` AS `week`,
'' AS labroom_id,
ta.id AS appointment_id,
ta.timetable_style AS style,
ta.term AS term_id,
tsc.course_number AS course_no,
CURRENT_TIMESTAMP AS created_date,
sw.date
FROM timetable_appointment ta
JOIN timetable_appointment_same_number tasn ON tasn.appointment_id=ta.id
JOIN school_week sw ON sw.term_id=ta.term AND sw.weekday=ta.weekday AND sw.`week` BETWEEN tasn.start_week AND tasn.end_week
JOIN system_time st_start ON st_start.section = tasn.start_class
JOIN system_time st_end ON st_end.section = tasn.end_class
JOIN timetable_self_course tsc ON tsc.id=ta.self_course_code
JOIN timetable_course_student tcs ON tcs.course_code_id=tsc.id
WHERE ta.`status`=1 AND ta.term=term_id AND ta.timetable_style=5
UNION
SELECT
tgs.username AS user_number,
CONCAT(sw.date," ",st_start.start_date) AS begin_time,
CONCAT(sw.date," ",st_end.end_date) AS end_time,
tasn.start_class AS start_class,
tasn.end_class AS end_class,
sw.weekday AS weekday,
sw.`week` AS `week`,
'' AS labroom_id,
ta.id AS appointment_id,
ta.timetable_style AS style,
ta.term AS term_id,
tsc.course_number AS course_no,
CURRENT_TIMESTAMP AS created_date,
sw.date
FROM timetable_appointment ta
JOIN timetable_appointment_same_number tasn ON tasn.appointment_id=ta.id
JOIN school_week sw ON sw.term_id=ta.term AND sw.weekday=ta.weekday AND sw.`week` BETWEEN tasn.start_week AND tasn.end_week
JOIN system_time st_start ON st_start.section = tasn.start_class
JOIN system_time st_end ON st_end.section = tasn.end_class
JOIN timetable_self_course tsc ON tsc.id=ta.self_course_code
JOIN timetable_appointment_group tag ON tag.appointment_id=ta.id
JOIN timetable_group_students tgs ON tgs.group_id=tag.group_id
WHERE ta.`status`=1 AND ta.term=term_id AND (ta.timetable_style=4 OR ta.timetable_style=6)
) AS tab_1
LEFT JOIN timetable_attendance attendance ON tab_1.user_number=attendance.user_number
AND tab_1.begin_time=attendance.begin_time AND tab_1.end_time=attendance.end_time
WHERE attendance.id IS NULL;
UPDATE limsproduct.timetable_attendance
JOIN (
SELECT
lvu.username AS username,
ich.cardno AS cardno,
ich.datetime AS datetime,
lra.lab_room_id AS lab_room_id,
tlr.appointment_id AS appointment_id
FROM
limsproduct.view_user lvu
JOIN iot.common_hdwlog ich ON lvu.cardnumber = ich.cardno
JOIN lab_room_agent lra ON ich.hardware_ip = lra.hardware_ip AND lra.hardware_type=547
JOIN timetable_lab_related tlr ON lra.lab_room_id = tlr.lab_id
) AS ltb ON limsproduct.timetable_attendance.appointment_id = ltb.appointment_id
AND limsproduct.timetable_attendance.user_number = ltb.username
SET limsproduct.timetable_attendance.attendance_machine = 1
WHERE
ltb.datetime BETWEEN DATE_SUB(
limsproduct.timetable_attendance.begin_time,
INTERVAL 10 MINUTE
)
AND DATE_ADD(
limsproduct.timetable_attendance.end_time,
INTERVAL 10 MINUTE
);
UPDATE limsproduct.timetable_attendance
JOIN (
SELECT
lvu.username AS username,
ich.cardno AS cardno,
ich.datetime AS datetime,
lra.lab_room_id AS lab_room_id,
tlr.appointment_id AS appointment_id
FROM
limsproduct.view_user lvu
JOIN iot.common_hdwlog ich ON lvu.cardnumber = ich.cardno
JOIN lab_room_agent lra ON ich.hardware_ip = lra.hardware_ip AND lra.hardware_type=547
JOIN timetable_lab_related tlr ON lra.lab_room_id = tlr.lab_id
) AS ltb ON limsproduct.timetable_attendance.appointment_id = ltb.appointment_id
AND limsproduct.timetable_attendance.user_number = ltb.username
SET limsproduct.timetable_attendance.machine_time = ltb.datetime
WHERE
limsproduct.timetable_attendance.attendance_machine = 1;
END;;
DELIMITER ; | true |
8694d7cf6b187e6be32a511f4a1d24eee0a7b6b4 | SQL | jthaarmann/automation-appetite | /rest-services/src/main/resources/db/sql/create-db.sql | UTF-8 | 980 | 3.28125 | 3 | [] | no_license | CREATE TABLE account (
id INT NOT NULL,
name VARCHAR(50) NOT NULL,
description VARCHAR(50) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE DAY (
ID INT NOT NULL,
ABBREVIATION VARCHAR(50) NOT NULL,
NAME VARCHAR(50) NOT NULL,
PRIMARY KEY (id)
);
CREATE TABLE FOOD_GROUP (
NAME VARCHAR(50) NOT NULL,
PRIMARY KEY (NAME)
);
CREATE TABLE FOOD_ITEM (
ID INT NOT NULL,
NAME VARCHAR(50) NOT NULL,
FOOD_GROUP VARCHAR(50) NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE FOOD_PORTION (
ID INT NOT NULL,
ITEM INT NOT NULL,
DAY INT NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE EXERCISE_TYPE (
TYPE_CODE VARCHAR(50) NOT NULL,
NAME VARCHAR(50) NOT NULL,
PRIMARY KEY (TYPE_CODE)
);
CREATE TABLE EXERCISE (
ID INT NOT NULL,
NAME VARCHAR(50) NOT NULL,
TYPE_CODE VARCHAR(50) NOT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE EXERCISE_SESSION (
ID INT NOT NULL,
EXERCISE INT NOT NULL,
DAY INT NOT NULL,
PRIMARY KEY (ID)
); | true |
fcb3a54b57475f65341dfda776ffd6841433f0b1 | SQL | makendensetu/server_side | /prisma/migrations/20210925160940_/migration.sql | UTF-8 | 712 | 2.984375 | 3 | [] | no_license | /*
Warnings:
- The primary key for the `Post` table will be changed. If it partially fails, the table could be left without primary key constraint.
*/
-- RedefineTables
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Post" (
"id" TEXT NOT NULL PRIMARY KEY,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
"lon" REAL NOT NULL,
"lat" REAL NOT NULL,
"imagePath" TEXT NOT NULL
);
INSERT INTO "new_Post" ("createdAt", "id", "imagePath", "lat", "lon", "updatedAt") SELECT "createdAt", "id", "imagePath", "lat", "lon", "updatedAt" FROM "Post";
DROP TABLE "Post";
ALTER TABLE "new_Post" RENAME TO "Post";
PRAGMA foreign_key_check;
PRAGMA foreign_keys=ON;
| true |
5567361880df326caaa391d1187147af705d0ec8 | SQL | carlos-sierra/cscripts | /cs_spch_first_rows.sql | UTF-8 | 2,849 | 2.53125 | 3 | [] | no_license | ----------------------------------------------------------------------------------------
--
-- File name: cs_spch_first_rows.sql
--
-- Purpose: Create a SQL Patch with FIRST_ROWS for given SQL_ID, and drops SQL Profile and SQL Plan Baselines
--
-- Author: Carlos Sierra
--
-- Version: 2023/04/27
--
-- Usage: Connecting into PDB.
--
-- Enter SQL_ID and PLAN_HASH_VALUE when requested.
--
-- Example: $ sqlplus / as sysdba
-- SQL> @cs_spch_first_rows.sql
--
-- Notes: Accesses AWR data thus you must have an Oracle Diagnostics Pack License.
--
-- Developed and tested on 12.1.0.2.
--
---------------------------------------------------------------------------------------
--
@@cs_internal/cs_primary.sql
@@cs_internal/cs_cdb_warn.sql
@@cs_internal/cs_set.sql
@@cs_internal/cs_def.sql
@@cs_internal/cs_file_prefix.sql
--
DEF cs_script_name = 'cs_spch_first_rows';
--
DEF cs_sql_id_col = 'NOPRI';
DEF cs_uncommon_col = 'NOPRI';
DEF cs_delta_col = 'NOPRI';
-- DEF cs_sqlstat_days = '0.25';
-- @@cs_internal/cs_sample_time_boundaries.sql
-- @@cs_internal/cs_snap_id_from_and_to.sql
--
PRO 1. SQL_ID:
DEF cs_sql_id = "&1.";
UNDEF 1;
DEF cs_filter_1 = 'sql_id = ''&&cs_sql_id.''';
DEF cs2_sql_text_piece = '';
--
@@cs_internal/cs_last_snap.sql
--
SELECT '&&cs_file_prefix._&&cs_script_name._&&cs_sql_id.' cs_file_name FROM DUAL;
--
@@cs_internal/cs_signature.sql
--
COL hints_text NEW_V hints_text NOPRI;
SELECT q'[&&hints_text.]'||CASE WHEN '&&cs_kiev_table_name.' IS NOT NULL THEN ' LEADING(@SEL$1 &&cs_kiev_table_name.)' END||q'[ OPT_PARAM('_b_tree_bitmap_plans' 'FALSE') OPT_PARAM('_no_or_expansion' 'TRUE')]' AS hints_text FROM DUAL;
--
@@cs_internal/cs_spool_head.sql
PRO SQL> @&&cs_script_name..sql "&&cs_sql_id."
@@cs_internal/cs_spool_id.sql
@@cs_internal/cs_spool_id_list_sql_id.sql
--
PRO CBO HINTS : "&&hints_text."
--
@@cs_internal/cs_print_sql_text.sql
-- drop existing patch if any
@@cs_internal/cs_spch_internal_drop.sql
--
PRO
PRO Create name: "spch_&&cs_sql_id."
@@cs_internal/cs_spch_internal_create.sql
--
@@cs_internal/cs_spch_internal_list.sql
--
-- drop existing profile if any
@@cs_internal/cs_sprf_internal_stgtab.sql
@@cs_internal/cs_sprf_internal_pack.sql
@@cs_internal/cs_sprf_internal_drop.sql
--
-- drop existing baseline if any
DEF cs_plan_name = '';
@@cs_internal/cs_spbl_internal_stgtab.sql
@@cs_internal/cs_spbl_internal_pack.sql
DECLARE
l_plans INTEGER := 0;
BEGIN
IF '&&cs_sql_handle.' IS NOT NULL THEN
l_plans := DBMS_SPM.drop_sql_plan_baseline(sql_handle => '&&cs_sql_handle.');
END IF;
END;
/
--
DEF cs_scope_1 = '';
@@cs_internal/cs_gv_sql_global.sql
@@cs_internal/cs_gv_sql_stability.sql
--
PRO
PRO SQL> @&&cs_script_name..sql "&&cs_sql_id."
--
@@cs_internal/cs_spool_tail.sql
@@cs_internal/cs_undef.sql
@@cs_internal/cs_reset.sql
--
| true |
ee174fddcc0c256b9cc323a8042f04cad7272ae4 | SQL | smk-141510191/141510191-Ujikomm | /ujikomm.sql | UTF-8 | 14,838 | 2.78125 | 3 | [
"MIT"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.6.4
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Feb 23, 2017 at 08:04 AM
-- Server version: 10.1.19-MariaDB
-- PHP Version: 7.0.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `ujikomm`
--
-- --------------------------------------------------------
--
-- Table structure for table `golongans`
--
CREATE TABLE `golongans` (
`id` int(10) UNSIGNED NOT NULL,
`kode_golongan` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`nama_golongan` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`besaran_uang` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `golongans`
--
INSERT INTO `golongans` (`id`, `kode_golongan`, `nama_golongan`, `besaran_uang`, `created_at`, `updated_at`) VALUES
(1, 'G1', 'GH1', 12000, '2017-02-23 00:48:20', '2017-02-23 00:48:20');
-- --------------------------------------------------------
--
-- Table structure for table `jabatans`
--
CREATE TABLE `jabatans` (
`id` int(10) UNSIGNED NOT NULL,
`kode_jabatan` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`nama_jabatan` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`besaran_uang` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `jabatans`
--
INSERT INTO `jabatans` (`id`, `kode_jabatan`, `nama_jabatan`, `besaran_uang`, `created_at`, `updated_at`) VALUES
(1, 'J1', 'HRD', 1000000, '2017-02-23 00:48:00', '2017-02-23 00:48:00');
-- --------------------------------------------------------
--
-- Table structure for table `kategori_lemburs`
--
CREATE TABLE `kategori_lemburs` (
`id` int(10) UNSIGNED NOT NULL,
`kode_lembur` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`id_jabatan` int(10) UNSIGNED DEFAULT NULL,
`id_golongan` int(10) UNSIGNED DEFAULT NULL,
`besaran_uang` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `kategori_lemburs`
--
INSERT INTO `kategori_lemburs` (`id`, `kode_lembur`, `id_jabatan`, `id_golongan`, `besaran_uang`, `created_at`, `updated_at`) VALUES
(1, 'L11', 1, 1, 1000000, '2017-02-23 00:53:41', '2017-02-23 00:53:50');
-- --------------------------------------------------------
--
-- Table structure for table `lembur_pegawais`
--
CREATE TABLE `lembur_pegawais` (
`id` int(10) UNSIGNED NOT NULL,
`kode_lembur_id` int(10) UNSIGNED DEFAULT NULL,
`id_pegawai` int(10) UNSIGNED DEFAULT NULL,
`jumlah_jam` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `lembur_pegawais`
--
INSERT INTO `lembur_pegawais` (`id`, `kode_lembur_id`, `id_pegawai`, `jumlah_jam`, `created_at`, `updated_at`) VALUES
(1, 1, 1, 2, '2017-02-23 00:55:05', '2017-02-23 00:55:05'),
(2, 1, 1, 2, '2017-02-23 00:56:02', '2017-02-23 00:56:02'),
(3, 1, 1, 2, '2017-02-23 00:56:12', '2017-02-23 00:56:12');
-- --------------------------------------------------------
--
-- Table structure for table `migrations`
--
CREATE TABLE `migrations` (
`id` int(10) UNSIGNED NOT NULL,
`migration` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`batch` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `migrations`
--
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES
(1, '2014_10_12_000000_create_users_table', 1),
(2, '2014_10_12_100000_create_password_resets_table', 1),
(3, '2017_01_30_090545_create_jabatans_table', 1),
(4, '2017_01_30_090558_create_golongans_table', 1),
(5, '2017_01_30_092210_create_tunjangans_table', 1),
(6, '2017_01_30_093930_create_pegawais_table', 1),
(7, '2017_01_30_100549_create_kategori_lemburs_table', 1),
(8, '2017_01_30_101402_create_lembur_pegawais_table', 1),
(9, '2017_01_30_103331_create_tunjangan_pegawais_table', 1),
(10, '2017_01_30_103649_create_penggajians_table', 1);
-- --------------------------------------------------------
--
-- Table structure for table `password_resets`
--
CREATE TABLE `password_resets` (
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`token` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `pegawais`
--
CREATE TABLE `pegawais` (
`id` int(10) UNSIGNED NOT NULL,
`nip` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`id_user` int(10) UNSIGNED DEFAULT NULL,
`id_jabatan` int(10) UNSIGNED DEFAULT NULL,
`id_golongan` int(10) UNSIGNED DEFAULT NULL,
`foto` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `pegawais`
--
INSERT INTO `pegawais` (`id`, `nip`, `id_user`, `id_jabatan`, `id_golongan`, `foto`, `created_at`, `updated_at`) VALUES
(1, '222', 1, 1, 1, 'AG.jpg', '2017-02-23 00:48:52', '2017-02-23 00:48:52');
-- --------------------------------------------------------
--
-- Table structure for table `penggajians`
--
CREATE TABLE `penggajians` (
`id` int(10) UNSIGNED NOT NULL,
`tunjangan_pegawai_id` int(10) UNSIGNED DEFAULT NULL,
`jumlah_jam_lembur` int(11) NOT NULL,
`jumlah_uang_lembur` int(11) NOT NULL,
`gaji_pokok` int(11) NOT NULL,
`tanggal_pengambilan` date NOT NULL,
`status_pengambilan` tinyint(1) NOT NULL DEFAULT '0',
`petugas_penerima` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `tunjangans`
--
CREATE TABLE `tunjangans` (
`id` int(10) UNSIGNED NOT NULL,
`kode_tunjangan` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`id_jabatan` int(10) UNSIGNED DEFAULT NULL,
`id_golongan` int(10) UNSIGNED DEFAULT NULL,
`status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`jumlah_anak` int(11) NOT NULL,
`besaran_uang` int(11) NOT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `tunjangans`
--
INSERT INTO `tunjangans` (`id`, `kode_tunjangan`, `id_jabatan`, `id_golongan`, `status`, `jumlah_anak`, `besaran_uang`, `created_at`, `updated_at`) VALUES
(1, 'T1', 1, 1, 'Menikah', 2, 12000, '2017-02-23 00:54:10', '2017-02-23 00:54:24');
-- --------------------------------------------------------
--
-- Table structure for table `tunjangan_pegawais`
--
CREATE TABLE `tunjangan_pegawais` (
`id` int(10) UNSIGNED NOT NULL,
`kode_tunjangan` int(10) UNSIGNED NOT NULL,
`id_pegawai` int(10) UNSIGNED DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`permission` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `name`, `email`, `password`, `permission`, `remember_token`, `created_at`, `updated_at`) VALUES
(1, 'Dewi', 'dewi@gmail.com', '$2y$10$sJeXGlt2dM2fRyFKTV4QMekQ.nP17GDjbvICou6m/qTBuGuYdPCsK', 'Pegawai', NULL, '2017-02-23 00:48:52', '2017-02-23 00:48:52');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `golongans`
--
ALTER TABLE `golongans`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `golongans_kode_golongan_unique` (`kode_golongan`);
--
-- Indexes for table `jabatans`
--
ALTER TABLE `jabatans`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `jabatans_kode_jabatan_unique` (`kode_jabatan`);
--
-- Indexes for table `kategori_lemburs`
--
ALTER TABLE `kategori_lemburs`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `kategori_lemburs_kode_lembur_unique` (`kode_lembur`),
ADD KEY `kategori_lemburs_id_jabatan_foreign` (`id_jabatan`),
ADD KEY `kategori_lemburs_id_golongan_foreign` (`id_golongan`);
--
-- Indexes for table `lembur_pegawais`
--
ALTER TABLE `lembur_pegawais`
ADD PRIMARY KEY (`id`),
ADD KEY `lembur_pegawais_kode_lembur_id_foreign` (`kode_lembur_id`),
ADD KEY `lembur_pegawais_id_pegawai_foreign` (`id_pegawai`);
--
-- Indexes for table `migrations`
--
ALTER TABLE `migrations`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `password_resets`
--
ALTER TABLE `password_resets`
ADD KEY `password_resets_email_index` (`email`),
ADD KEY `password_resets_token_index` (`token`);
--
-- Indexes for table `pegawais`
--
ALTER TABLE `pegawais`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `pegawais_nip_unique` (`nip`),
ADD KEY `pegawais_id_user_foreign` (`id_user`),
ADD KEY `pegawais_id_jabatan_foreign` (`id_jabatan`),
ADD KEY `pegawais_id_golongan_foreign` (`id_golongan`);
--
-- Indexes for table `penggajians`
--
ALTER TABLE `penggajians`
ADD PRIMARY KEY (`id`),
ADD KEY `penggajians_tunjangan_pegawai_id_foreign` (`tunjangan_pegawai_id`);
--
-- Indexes for table `tunjangans`
--
ALTER TABLE `tunjangans`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `tunjangans_kode_tunjangan_unique` (`kode_tunjangan`),
ADD KEY `tunjangans_id_jabatan_foreign` (`id_jabatan`),
ADD KEY `tunjangans_id_golongan_foreign` (`id_golongan`);
--
-- Indexes for table `tunjangan_pegawais`
--
ALTER TABLE `tunjangan_pegawais`
ADD PRIMARY KEY (`id`),
ADD KEY `tunjangan_pegawais_kode_tunjangan_foreign` (`kode_tunjangan`),
ADD KEY `tunjangan_pegawais_id_pegawai_foreign` (`id_pegawai`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `users_email_unique` (`email`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `golongans`
--
ALTER TABLE `golongans`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `jabatans`
--
ALTER TABLE `jabatans`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `kategori_lemburs`
--
ALTER TABLE `kategori_lemburs`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `lembur_pegawais`
--
ALTER TABLE `lembur_pegawais`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `migrations`
--
ALTER TABLE `migrations`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
--
-- AUTO_INCREMENT for table `pegawais`
--
ALTER TABLE `pegawais`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `penggajians`
--
ALTER TABLE `penggajians`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `tunjangans`
--
ALTER TABLE `tunjangans`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `tunjangan_pegawais`
--
ALTER TABLE `tunjangan_pegawais`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `kategori_lemburs`
--
ALTER TABLE `kategori_lemburs`
ADD CONSTRAINT `kategori_lemburs_id_golongan_foreign` FOREIGN KEY (`id_golongan`) REFERENCES `golongans` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `kategori_lemburs_id_jabatan_foreign` FOREIGN KEY (`id_jabatan`) REFERENCES `jabatans` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `lembur_pegawais`
--
ALTER TABLE `lembur_pegawais`
ADD CONSTRAINT `lembur_pegawais_id_pegawai_foreign` FOREIGN KEY (`id_pegawai`) REFERENCES `pegawais` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `lembur_pegawais_kode_lembur_id_foreign` FOREIGN KEY (`kode_lembur_id`) REFERENCES `kategori_lemburs` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `pegawais`
--
ALTER TABLE `pegawais`
ADD CONSTRAINT `pegawais_id_golongan_foreign` FOREIGN KEY (`id_golongan`) REFERENCES `golongans` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `pegawais_id_jabatan_foreign` FOREIGN KEY (`id_jabatan`) REFERENCES `jabatans` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `pegawais_id_user_foreign` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `penggajians`
--
ALTER TABLE `penggajians`
ADD CONSTRAINT `penggajians_tunjangan_pegawai_id_foreign` FOREIGN KEY (`tunjangan_pegawai_id`) REFERENCES `tunjangan_pegawais` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `tunjangans`
--
ALTER TABLE `tunjangans`
ADD CONSTRAINT `tunjangans_id_golongan_foreign` FOREIGN KEY (`id_golongan`) REFERENCES `golongans` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tunjangans_id_jabatan_foreign` FOREIGN KEY (`id_jabatan`) REFERENCES `jabatans` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Constraints for table `tunjangan_pegawais`
--
ALTER TABLE `tunjangan_pegawais`
ADD CONSTRAINT `tunjangan_pegawais_id_pegawai_foreign` FOREIGN KEY (`id_pegawai`) REFERENCES `pegawais` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tunjangan_pegawais_kode_tunjangan_foreign` FOREIGN KEY (`kode_tunjangan`) REFERENCES `tunjangans` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
0d9de4202553569b52eb5cc96f82cbfee7b810de | SQL | jbballesteros/SQL_Zeuss | /2016/05 - Mayo/BONIFICACIONES2.sql | UTF-8 | 1,176 | 4.4375 | 4 | [] | no_license | SELECT *,CASE WHEN FI.GAL_NIT=0 THEN FI.BONIFICACION ELSE (FI.BONIFICACION/FI.GAL_NIT)*FI.GAL_CODIGO END BONIF
FROM (
SELECT M.nit,T.nombres,TR.nit NIT_REAL,TR.nombres NOMBRE_NIT,T3.nit CODIGO,T3.nombres NOMBRES_CODIGO,
SUM(CASE WHEN MONTH(M.FEC)=5 THEN M.valor ELSE 0 END) BONIFICACION,
P.MAYO GAL_CODIGO,S.MAYO GAL_NIT
FROM movimiento M INNER JOIN terceros T ON (M.nit=T.nit)
INNER JOIN centros C ON (M.centro=C.centro)
INNER JOIN terceros TR ON (T.nit_real=TR.nit)
INNER JOIN terceros T3 ON (TR.nit=T3.nit_real)
LEFT JOIN (
SELECT ZL.nit,
SUM( CASE WHEN ZL.mes=5 THEN ZL.can_ventas-ZL.can_devolu ELSE 0 END) MAYO
FROM Zeuss_Lin_Ventas ZL
WHERE ZL.ano=2016 AND ZL.subgrupo2 IN (2,3,4)
GROUP BY ZL.nit) AS P ON (T3.nit=P.nit)
LEFT JOIN (
SELECT ZL.nit_real,
SUM( CASE WHEN ZL.mes=5 THEN ZL.can_ventas-ZL.can_devolu ELSE 0 END) MAYO
FROM Zeuss_Lin_Ventas ZL
WHERE ZL.ano=2016 AND ZL.subgrupo2 IN (2,3,4)
GROUP BY ZL.nit_real) AS S ON (TR.nit=S.nit_real)
WHERE cuenta ='53053501' AND fec BETWEEN '01/05/2016' AND '31/05/2016' AND P.MAYO IS NOT NULL AND M.nit=TR.nit
GROUP BY M.nit,T.nombres,TR.nit,TR.nombres,T3.nit,T3.nombres,P.MAYO,S.MAYO
) AS FI
order by FI.nit
| true |
741ee3cc3127019766ccd4433e6a00a69a21d0d1 | SQL | rhit-koenignm/csse333_ftc | /api/db_scripts/scripts/functions/12_match_view.sql | UTF-8 | 246 | 3.546875 | 4 | [] | no_license | create or replace view match_info as select * from match m
left join lateral (
select array (
select team_id from match_competitor mc where match_id = m.id
--join team t on t.id = mc.team_id
--where match_id = m.id
) as teams
) t on true; | true |
ea2a31eadef4e4158d2fecbf6d03bdc3dccd03ce | SQL | rgoro/tp_bd | /generadores/add_stored_procedures.sql | UTF-8 | 4,761 | 4.21875 | 4 | [] | no_license | -- TP 1 Bases de Datos 2015 1c
-- Autor: Romรกn Gorojovsky, L.U. 530/02
START TRANSACTION;
USE `elecciones`;
-- Calcula los candidatos que ganaron las elecciones transcurridas en el ultimo anyo
-- La subquery hace el join natural de todas las tablas necesarias, agrupa y ordena
-- Aprovechando esto la query externa toma el primero de cada eleccion, mediante
-- otro GROUP BY, y agrega informacion para hacer el resultado legible.
DELIMITER //
CREATE PROCEDURE `get_ganadores_ultimo_anyo` ()
BEGIN
SELECT ca.titulo, t.nombre, DATE_FORMAT(totales.fecha, "%d/%m/%Y") AS fecha, totales.nombres, totales.apellidos, totales.total_votos FROM (
SELECT e.id_eleccion, e.fecha, e.id_jurisdiccion, ci.nombres, ci.apellidos, COUNT(v.id_voto) AS total_votos
FROM `voto` AS v
INNER JOIN mesa AS m ON m.id_mesa = v.id_mesa
INNER JOIN eleccion e ON e.id_eleccion = m.id_eleccion
INNER JOIN candidato ca ON v.id_boleta = ca.id_boleta AND e.id_eleccion = ca.id_eleccion
INNER JOIN ciudadano ci ON ci.id_ciudadano = ca.id_ciudadano
WHERE e.tipo = "cargo" AND e.fecha <= NOW() AND e.fecha > DATE_SUB(NOW(), INTERVAL 1 YEAR)
GROUP BY e.id_eleccion, ca.id_boleta
ORDER BY e.id_eleccion, total_votos DESC
) AS totales
INNER JOIN cargo AS ca ON ca.id_eleccion = totales.id_eleccion
INNER JOIN territorio AS t ON t.id_territorio = totales.id_jurisdiccion
GROUP BY totales.id_eleccion;
END//
-- Calcula, dado un id de eleccion, los ultimo cinco votantes en llegar a cada centro.
-- Se trata de un join natural de las tablas correspondientes, un ORDER BY y un LIMIT.
CREATE PROCEDURE `get_votantes_sobre_la_hora` (IN id_eleccion INT(11))
BEGIN
SELECT ci.DNI, ci.nombres, ci.apellidos, ve.hora FROM `centro` AS c
INNER JOIN `mesa` AS m ON m.id_centro = c.id_centro
INNER JOIN `vota_en` AS ve ON ve.id_mesa = m.id_mesa
INNER JOIN `ciudadano` AS ci ON ve.id_ciudadano = ci.id_ciudadano
WHERE m.id_eleccion = id_eleccion
ORDER BY hora DESC
LIMIT 5;
END//
-- Calcula los partidos que superaron el 20% en las ultimas cinco elecciones provinciales a gobernador.
-- En este caso se opto por crear tablas temporales con los datos necesarios para el calculo y
-- finalmente presentar la informacion relevante.
CREATE PROCEDURE `get_partidos_sobre_20_porciento` ()
BEGIN
CREATE TEMPORARY TABLE IF NOT EXISTS `votos_totales_eleccion`
SELECT e.id_eleccion, e.id_jurisdiccion, count(v.id_voto) AS total
FROM voto AS v
INNER JOIN mesa AS m ON m.id_mesa = v.id_mesa
INNER JOIN eleccion AS e ON m.id_eleccion = e.id_eleccion
GROUP BY e.id_eleccion;
CREATE TEMPORARY TABLE IF NOT EXISTS `votos_partido_eleccion`
SELECT e.id_eleccion, e.id_jurisdiccion, p.id_partido, COUNT(v.id_voto) AS total
FROM voto AS v
INNER JOIN mesa AS m ON m.id_mesa = v.id_mesa
INNER JOIN eleccion AS e ON m.id_eleccion = e.id_eleccion
INNER JOIN candidato AS ca ON ca.id_boleta = v.id_boleta AND ca.id_eleccion = e.id_eleccion
INNER JOIN partido AS p ON p.id_partido = ca.id_partido
GROUP BY e.id_eleccion, p.id_partido;
-- Es necesaria esta tabla? Creo que podria ser una subquery del SELECT final, pero resulta
-- mas claro asi.
CREATE TEMPORARY TABLE IF NOT EXISTS `porcentaje_partido_eleccion`
SELECT vpe.id_eleccion, vpe.id_partido, vpe.total AS total_partido, vte.total AS total_eleccion, (vpe.total/vte.total)*100 as porcentaje
FROM votos_totales_eleccion AS vte
INNER JOIN votos_partido_eleccion AS vpe ON vpe.id_eleccion = vte.id_eleccion;
-- Esto es necesario porque mysql no soporta limit en subqueries, si no seria una subquery
-- en el SELECT final.
-- El territorio y su nivel son innecesarios, no hay gobernadores que no son de provincia
-- pero los pongo para respetar mas fielmente el enunciado
CREATE TEMPORARY TABLE IF NOT EXISTS `ids_ultimas_cinco_elecciones_gob`
SELECT e.id_eleccion FROM eleccion e
INNER JOIN cargo AS ca ON e.id_eleccion = ca.id_eleccion
INNER JOIN territorio AS t ON t.id_territorio = e.id_jurisdiccion
WHERE ca.titulo = "Gobernador" AND t.nivel = "provincia" AND e.fecha <= NOW()
ORDER BY e.fecha DESC
LIMIT 5;
SELECT e.id_eleccion, DATE_FORMAT(e.fecha, "%d/%m/%Y") AS fecha, t.nombre AS provincia, p.nombre, ppe.total_eleccion AS 'votos emitidos', ppe.total_partido AS 'votos totales', ppe.porcentaje
FROM porcentaje_partido_eleccion AS ppe
INNER JOIN eleccion AS e ON ppe.id_eleccion = e.id_eleccion
INNER JOIN territorio AS t ON t.id_territorio = e.id_jurisdiccion
INNER JOIN partido AS p ON p.id_partido = ppe.id_partido
WHERE ppe.porcentaje > 20
AND ppe.id_eleccion IN (SELECT * FROM ids_ultimas_cinco_elecciones_gob)
ORDER BY e.id_eleccion, p.nombre;
END//
DELIMITER ;
COMMIT;
| true |
ecfdd5ef784d5ae638579458d6d6ca550d58c435 | SQL | Sarcross/finline | /src/main/sql/dbSetup.sql | UTF-8 | 616 | 3.734375 | 4 | [] | no_license | CREATE DATABASE finline;
USE finline;
CREATE TABLE Users(
ID INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (ID)
);
CREATE TABLE Accounts(
ID INT NOT NULL AUTO_INCREMENT,
UserID INT NOT NULL,
Name VARCHAR(255) NOT NULL,
Balance DECIMAL (18, 2) NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (UserID) REFERENCES Users(ID) ON DELETE CASCADE
);
CREATE TABLE Transactions(
ID INT NOT NULL AUTO_INCREMENT,
AccountID INT NOT NULL,
Type CHAR (1) NOT NULL,
Amount DECIMAL (18, 2) NOT NULL,
PRIMARY KEY (ID),
FOREIGN KEY (AccountID) REFERENCES Accounts(ID) ON DELETE CASCADE
);
| true |
7303c0303e8a65b3b2505b9410b201021bf4ef83 | SQL | cdesmarais/WebDB-Test | /WebDB/StoredProcedures/Common/dbo.DNUsersFavoritesMarkAsMigrated.PRC | UTF-8 | 1,004 | 3.75 | 4 | [] | no_license | if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DNUsersFavoritesMarkAsMigrated]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[DNUsersFavoritesMarkAsMigrated]
GO
CREATE Procedure dbo.DNUsersFavoritesMarkAsMigrated(
@GlobalPersonIds nvarchar(4000)
)
AS
SET NOCOUNT ON
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
declare @TempGlobalPerson table
(
GlobalPersonID bigint,
Custid int,
CallerId int
)
insert into @TempGlobalPerson
select _GlobalPersonID, CustID, CallerID
from GlobalPerson gp
inner join fStringsToTab(@GlobalPersonIds, ',') u on u.StringValues = gp._GlobalPersonID
where gp.RegionID = dbo.fGetRegionID()
update Favorites
set Migrated = 1
where CustID in (select CustID from @TempGlobalPerson gp where gp.CustID is not null)
update CallerRestaurants
set Migrated = 1
where CallerID in (select CallerId from @TempGlobalPerson gp where gp.CallerId is not null)
GO
GRANT EXECUTE ON [DNUsersFavoritesMarkAsMigrated] TO ExecuteOnlyRole
GO | true |
b9b7163baa46405a086c7ffe36295b5ee7b15818 | SQL | cckmit/xinfu | /ccms/WebContent/WEB-INF/action/project/fitness/wx/market/index/getnum/ptrest_query.sql | UTF-8 | 209 | 2.90625 | 3 | [] | no_license | select
count(1) as baomingnum
from
cc_market_campaign_enroll e
inner join cc_market_campaign m on m.code=e.campaigncode and m.status=1 and m.campaigntype=3 and m.org_id=${def:org}
where e.org_id=${def:org}
| true |
b949595b17e65aee829c3ac77ff4e796e718f98a | SQL | pyrojd/Pokemon-Team-Builder | /Pokemon Team Builder/SQL/Pokemon Query.sql | UTF-8 | 1,403 | 3.140625 | 3 | [] | no_license | create table Pokemon(
ID INT NOT NULL,
Name varchar(15) NOT NULL,
Type1 varchar(10) NOT NULL,
Type2 varchar(10),
primary key (ID)
);
create table Items(
Item_ID int not null,
Item_Name varchar(50) not null,
Item_Desciption varchar(250) not null,
primary key (Item_ID)
);
create table Moves(
Move_ID int not null,
Move_Name varchar(50) not null,
Move_Type varchar(10) not null,
Move_Cat varchar(10) not null,
Move_PP int not null,
Move_Power varchar(5) not null,
Move_Acc varchar(5) not null,
primary key(Move_ID)
);
create table Natures(
Nature_ID int not null,
Nature_Name varchar(20) not null,
Nature_Inc varchar(20) not null,
Nautre_Dec varchar(20) not null
primary key(Nature_ID)
);
create table Users(
Users_ID int IDENTITY(1,1) not null,
Users_Name varchar(55) not null,
Users_Pass varchar(55) not null,
Time_Logged_in datetime not null,
Time_Logged_out datetime not null,
Users_Status int not null,
Date_Logged_In datetime not null,
Users_Email varchar(55) not null,
primary key(Users_ID)
);
insert into Users
values('admin1','password',GETDATE(),'03/06/2017',1,GETDATE(),'jdw35@students.ptcollege.edu')
insert into Users
values('admin2','password',GETDATE(),'03/06/2017',1,GETDATE(),'rss23@students.ptcollege.edu')
Select * from Users;
drop table Users;
delete from Users;
| true |
400dda582490422d71bb00f8d2c9921f91216429 | SQL | supadhyaya/IB | /transformation/answer_Trans.sql | UTF-8 | 621 | 3.6875 | 4 | [] | no_license |
use socialvoyce;
create table if not exists answer (
votingID integer not null ,
answerText varchar(1000),
answerID char(24),
votes int,
jobDate datetime
);
UPDATE answer INNER JOIN scrubAnswer ON answer.answerID = scrubAnswer.answerID
set answer.votes=scrubAnswer.votes;
insert into answer(
votingID,
answerText,
answerID,
votes,
jobDate
)
select
b.id as votingID,
a.answerText as answerText,
a.answerID as answerID,
a.votes as votes,
sysdate()
from
scrubAnswer a
left join
listVoting b
on
a.votingID=b.votingID
left join
answer f
on b.id=f.votingID
where f.votingID is null and f.answerID is null
;
| true |
833f852b7c3f32321c17b383b76f3fb232053bbf | SQL | luizasenna/PintosQueries | /2018-09 - AD - Notas Baixas.sql | UTF-8 | 7,626 | 3.890625 | 4 | [] | no_license | create temporary table notas_temp_todas
(index PARTICIPANTE(PARTICIPANTE), index CODPESSOA(CODPESSOA))
select
N.CODITEMAVAL AS ITEM,
S.NOME AS NOMECOMPETENCIA,
NOTAAVALIADOR AS NOTAAVALIADOR,
P.CHAPAAVALIADO AS CHAPA,
N.CODAVALIACAO AS AVALIACAO,
V.NOME AS DESCRICAO,
V.DATAABERTURA AS DATA, P.CODPARTICIPANTE, P.CODAVALIACAO,
N.COMENTARIO AS OBS,
date_format(N.created_at, "%d/%m/%Y") AS FEITAEM,
F.NOME AS NOME,
FUN.NOME AS FUNCAO,
F.CODFUNCAO AS CODFUNCAO,
N.CODPARTICIPANTE AS PARTICIPANTE,
LIDER.NOME AS NOMEAVALIADOR,
F.CODPESSOA AS CODPESSOA
from notas AS N
inner join participantes AS P
on N.CODAVALIACAO = P.CODAVALIACAO
and N.CODPARTICIPANTE = P.CODPARTICIPANTE
and N.CODCOLIGADA = P.CODCOLIGADA
inner JOIN competencias AS S ON N.CODITEMAVAL = S.CODCOMPETENCIA
inner JOIN avaliacoes AS V
ON V.CODAVALIACAO = N.CODAVALIACAO
and V.CODCOLIGADA = N.CODCOLIGADA
inner JOIN veravaliacoes AS VAV on V.CODAVALIACAO = VAV.codigoavaliacao
LEFT JOIN funcionarios AS F on F.CODPESSOA = P.CODPESSOA
left JOIN pessoas AS LIDER ON LIDER.CODIGO = F.CODEQUIPE
left JOIN funcoes AS FUN ON FUN.CODIGO = F.CODFUNCAO
where statuslider = 0 and V.DATAABERTURA BETWEEN "2018-01-01" and "2018-09-01"
and F.CODSITUACAO <> "D"
GROUP BY P.CODPESSOA, P.CODAVALIACAO, N.CODITEMAVAL;
CREATE TEMPORARY TABLE notasPessoaTodas
select
AVALIACAO,
todasAsNotas.CHAPA AS CHAPA,
CODPARTICIPANTE,
DESCRICAO,
PARTICIPANTE,
todasAsNotas.NOMEAVALIADOR as NOMEAVALIADOR,
todasAsNotas.NOME,
todasAsNotas.FUNCAO,
todasAsNotas.CODFUNCAO,
todasAsNotas.CODPESSOA AS CODPESSOA,
sum(IF(NOTAAVALIADOR <> 0 ,NOTAAVALIADOR,0)) AS NOTA,
count(IF(NOTAAVALIADOR <> 0,NOTAAVALIADOR,0)) AS QTDE,
(sum(IF(NOTAAVALIADOR <> 0 ,NOTAAVALIADOR,0))/count(IF(NOTAAVALIADOR <> 0,NOTAAVALIADOR,0))) AS MEDIA
from notas_temp_todas as todasAsNotas
left join assiduidade AS AE
on AE.codpessoa = todasAsNotas.CODPESSOA
AND AE.codavaliacao = todasAsNotas.AVALIACAO
left join vercargos as VC
on VC.codcargo = todasAsNotas.CODFUNCAO
GROUP BY AVALIACAO, CODPESSOA
HAVING (NOTA/QTDE) <=7
ORDER BY AVALIACAO
select if() from notasPessoaTodas order by CODPESSOA;
CREATE TEMPORARY TABLE notasPessoaTodas
select
AVALIACAO,
todasAsNotas.CHAPA AS CHAPA,
CODPARTICIPANTE,
DESCRICAO,
PARTICIPANTE,
todasAsNotas.NOMEAVALIADOR as NOMEAVALIADOR,
todasAsNotas.NOME,
todasAsNotas.FUNCAO,
todasAsNotas.CODFUNCAO,
todasAsNotas.CODPESSOA AS CODPESSOA,
MAX(IF(ITEM = "01", NOTAAVALIADOR, null)) AS NOTA1,
MAX(IF(ITEM = "02", NOTAAVALIADOR, null)) AS NOTA2,
CASE
WHEN (AE.atraso) BETWEEN 0 AND 2 THEN 10
WHEN (AE.atraso) BETWEEN 2.01 AND 4 THEN 3
WHEN (AE.atraso) BETWEEN 4.01 AND 8 THEN 1
WHEN (AE.atraso) BETWEEN 8.1 AND 20 THEN 0
ELSE 0 END
AS NOTA3,
MAX(IF(ITEM = "04" AND c4 = 0, NOTAAVALIADOR, null)) AS NOTA4,
MAX(IF(ITEM = "05" AND c5 = 0, NOTAAVALIADOR, null)) AS NOTA5,
MAX(IF(ITEM = "06" AND c6 = 0, NOTAAVALIADOR, null)) AS NOTA6,
MAX(IF(ITEM = "07" AND c7 = 0, NOTAAVALIADOR, null)) AS NOTA7,
MAX(IF(ITEM = "08" AND c8 = 0, NOTAAVALIADOR, null)) AS NOTA8,
MAX(IF(ITEM = "09" AND c9 = 0, NOTAAVALIADOR, null)) AS NOTA9,
MAX(IF(ITEM = "10" AND c10 = 0, NOTAAVALIADOR, null)) AS NOTA10,
MAX(IF(ITEM = "12" AND c12 = 0, NOTAAVALIADOR, null)) AS NOTA12,
MAX(IF(ITEM = "13" AND c13 = 0, NOTAAVALIADOR, null)) AS NOTA13,
MAX(IF(ITEM = "14" AND c14 = 0, NOTAAVALIADOR, null)) AS NOTA14,
MAX(IF(ITEM = "15" AND c15 = 0, NOTAAVALIADOR, null)) AS NOTA15
from notas_temp_todas as todasAsNotas
left join assiduidade AS AE
on AE.codpessoa = todasAsNotas.CODPESSOA
AND AE.codavaliacao = todasAsNotas.AVALIACAO
left join vercargos as VC
on VC.codcargo = todasAsNotas.CODFUNCAO
GROUP BY AVALIACAO, CODPESSOA
ORDER BY AVALIACAO;
select * from notasPessoaTodas group by CODPARTICIPANTE order by CODPESSOA;
select
notasbaixas.CODPESSOA,
f.NOME as NOME,
FUNCAO,
f.DATAADMISSAO AS DATAADMISSAO,
MEDIA as MEDIA,
CASE(f.CODFILIAL)
WHEN 1 THEN "PINTOS MAGAZINE"
WHEN 3 THEN "PINTOS RIVERSIDE"
WHEN 5 THEN "PINTOS RIO BRANCO"
WHEN 6 THEN "PINTOS CD1"
WHEN 8 THEN "PINTOS CALรADOS"
WHEN 9 THEN "PINTOS FREI SERAFIM"
WHEN 10 THEN "PINTOS CD2"
WHEN 11 THEN "PINTOS SHOPPING"
WHEN 12 THEN "PINTOS RIO POTY" END AS LOJA,
f.CODSECAO AS CODSECAO,
s.DESCRICAO as SECAO,
AVALIADOR
FROM notasbaixas
left join funcionarios as f on f.CODPESSOA = notasbaixas.CODPESSOA
inner join avaliacoes as av
on av.CODAVALIACAO = AVALIACAO
LEFT JOIN secoes as s on s.CODIGO = f.CODSECAO
WHERE av.DATAABERTURA BETWEEN "2018-01-01" and "2018-09-01"
AND MEDIA < 8
AND f.CODSITUACAO <> "D"
group by notasbaixas.CODPESSOA order by AVALIADOR, MEDIA desc | true |
3d73264bf99f8e1c669c09c9912eee887c78f24b | SQL | DEvans3/CodeSharingWebsite | /SQL Scripts/setup.sql | UTF-8 | 1,233 | 3.703125 | 4 | [] | no_license | DROP DATABASE IF EXISTS webserverdatabase;
CREATE DATABASE webserverdatabase;
use webserverdatabase;
CREATE TABLE users (
id int NOT NULL AUTO_INCREMENT,
uname varchar(20) UNIQUE NOT NULL,
passwd varchar(64) NOT NULL,
email varchar(64) UNIQUE NOT NULL,
ts timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
CREATE TABLE questions (
id int NOT NULL AUTO_INCREMENT,
title varchar(100) NOT NULL,
body varchar(1000) NOT NULL,
author int NOT NULL,
rating int DEFAULT 0,
ts timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY (author) references users(id)
);
CREATE TABLE answers (
id int NOT NULL AUTO_INCREMENT,
question int NOT NULL,
body varchar(1000) NOT NULL,
codeBody varchar(1000) NOT NULL,
rating int DEFAULT 0,
author int NOT NULL,
ts timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id),
FOREIGN KEY (question) REFERENCES questions(id),
FOREIGN KEY (author) references users(id)
);
CREATE TABLE rates (
answer int NOT NULL,
rater int NOT NULL,
up boolean NOT NULL,
FOREIGN KEY (answer) REFERENCES answers(id),
FOREIGN KEY (rater) REFERENCES users(id)
); | true |
8dbb54c3151d68ddd3078808b93b77bcb9775b29 | SQL | 1Chava/unicourse | /base.sql | UTF-8 | 7,868 | 3.21875 | 3 | [] | no_license | -- MySQL dump 10.13 Distrib 5.7.21, for Win32 (AMD64)
--
-- Host: localhost Database: unicourse
-- ------------------------------------------------------
-- Server version 5.7.21-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `curso`
--
DROP TABLE IF EXISTS `curso`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `curso` (
`idCurso` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) DEFAULT NULL,
PRIMARY KEY (`idCurso`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `curso`
--
LOCK TABLES `curso` WRITE;
/*!40000 ALTER TABLE `curso` DISABLE KEYS */;
INSERT INTO `curso` VALUES (1,'mate'),(2,'fisica'),(3,'ingles');
/*!40000 ALTER TABLE `curso` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `curso_has_usuario`
--
DROP TABLE IF EXISTS `curso_has_usuario`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `curso_has_usuario` (
`Curso_idCurso` int(11) NOT NULL,
`Usuario_idUsuarios` int(11) NOT NULL,
PRIMARY KEY (`Curso_idCurso`,`Usuario_idUsuarios`),
KEY `fk_Curso_has_Usuario_Usuario1_idx` (`Usuario_idUsuarios`),
KEY `fk_Curso_has_Usuario_Curso1_idx` (`Curso_idCurso`),
CONSTRAINT `fk_Curso_has_Usuario_Curso1` FOREIGN KEY (`Curso_idCurso`) REFERENCES `curso` (`idCurso`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Curso_has_Usuario_Usuario1` FOREIGN KEY (`Usuario_idUsuarios`) REFERENCES `usuario` (`idUsuarios`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `curso_has_usuario`
--
LOCK TABLES `curso_has_usuario` WRITE;
/*!40000 ALTER TABLE `curso_has_usuario` DISABLE KEYS */;
/*!40000 ALTER TABLE `curso_has_usuario` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `examen`
--
DROP TABLE IF EXISTS `examen`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `examen` (
`idexamen` int(11) NOT NULL AUTO_INCREMENT,
`calificacion` int(11) DEFAULT NULL,
PRIMARY KEY (`idexamen`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `examen`
--
LOCK TABLES `examen` WRITE;
/*!40000 ALTER TABLE `examen` DISABLE KEYS */;
INSERT INTO `examen` VALUES (1,NULL),(2,NULL),(3,NULL);
/*!40000 ALTER TABLE `examen` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `pregunta`
--
DROP TABLE IF EXISTS `pregunta`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pregunta` (
`idPregunta` int(11) NOT NULL AUTO_INCREMENT,
`texto` varchar(300) DEFAULT NULL,
`examen_idexamen` int(11) NOT NULL,
`RespuestaCorrecta` int(11) NOT NULL,
PRIMARY KEY (`idPregunta`,`examen_idexamen`,`RespuestaCorrecta`),
KEY `fk_Pregunta_examen1_idx` (`examen_idexamen`),
KEY `fk_Pregunta_Respuesta1_idx` (`RespuestaCorrecta`),
CONSTRAINT `fk_Pregunta_Respuesta1` FOREIGN KEY (`RespuestaCorrecta`) REFERENCES `respuesta` (`idRespuesta`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Pregunta_examen1` FOREIGN KEY (`examen_idexamen`) REFERENCES `examen` (`idexamen`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `pregunta`
--
LOCK TABLES `pregunta` WRITE;
/*!40000 ALTER TABLE `pregunta` DISABLE KEYS */;
/*!40000 ALTER TABLE `pregunta` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `respuesta`
--
DROP TABLE IF EXISTS `respuesta`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `respuesta` (
`idRespuesta` int(11) NOT NULL AUTO_INCREMENT,
`texto` varchar(300) DEFAULT NULL,
`Pregunta_idPregunta` int(11) NOT NULL,
PRIMARY KEY (`idRespuesta`,`Pregunta_idPregunta`),
KEY `fk_Respuesta_Pregunta1_idx` (`Pregunta_idPregunta`),
CONSTRAINT `fk_Respuesta_Pregunta1` FOREIGN KEY (`Pregunta_idPregunta`) REFERENCES `pregunta` (`idPregunta`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `respuesta`
--
LOCK TABLES `respuesta` WRITE;
/*!40000 ALTER TABLE `respuesta` DISABLE KEYS */;
/*!40000 ALTER TABLE `respuesta` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `tema`
--
DROP TABLE IF EXISTS `tema`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tema` (
`idTema` int(11) NOT NULL AUTO_INCREMENT,
`nombre` varchar(45) DEFAULT NULL,
`Curso_idCurso` int(11) NOT NULL,
`examen_idexamen` int(11) NOT NULL,
PRIMARY KEY (`idTema`,`Curso_idCurso`,`examen_idexamen`),
KEY `fk_Tema_Curso1_idx` (`Curso_idCurso`),
KEY `fk_Tema_examen1_idx` (`examen_idexamen`),
CONSTRAINT `fk_Tema_Curso1` FOREIGN KEY (`Curso_idCurso`) REFERENCES `curso` (`idCurso`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Tema_examen1` FOREIGN KEY (`examen_idexamen`) REFERENCES `examen` (`idexamen`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `tema`
--
LOCK TABLES `tema` WRITE;
/*!40000 ALTER TABLE `tema` DISABLE KEYS */;
INSERT INTO `tema` VALUES (1,'trigo',1,2),(2,'tiro',2,3),(3,'spikin',3,1);
/*!40000 ALTER TABLE `tema` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `usuario`
--
DROP TABLE IF EXISTS `usuario`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `usuario` (
`idUsuarios` int(11) NOT NULL AUTO_INCREMENT,
`email` varchar(45) NOT NULL,
`nombre` varchar(45) NOT NULL,
`apellidoPaterno` varchar(45) NOT NULL,
`apellidoMaterno` varchar(45) NOT NULL,
`username` varchar(45) NOT NULL,
`password` varchar(45) NOT NULL,
PRIMARY KEY (`idUsuarios`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `usuario`
--
LOCK TABLES `usuario` WRITE;
/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
INSERT INTO `usuario` VALUES (1,'prueba@prueba.com','pruebita','pruebona','pruebada','admin','admin'),(2,'pruebando@prueba.com','juan','juanez','juanez','root','root'),(3,'pepe@pepe.pepe','pepe','pepe','pepe','pepe','pepe');
/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-06-03 3:08:55
| true |
450e1beac3cc3158349fa1b7b51908ad50058a2c | SQL | MahdiyarTaghavi/miniature-system | /IMDB Create Tables.sql | UTF-8 | 4,987 | 3.8125 | 4 | [] | no_license | create table "user"
(
uid INTEGER NOT NULL,
name CHARACTER VARYING(30),
photo oid,
primary key (uid)
)
create table "login"
(
uid INTEGER NOT NULL,
username CHARACTER VARYING(30),
password CHARACTER VARYING(30),
primary key (uid),
foreign key (uid) REFERENCES "user" (uid)
)
create table "visit"
(
uid INTEGER NOT NULL,
mid INTEGER NOT NULL,
sid integer not null,
date date,
primary key (uid, date),
foreign key (uid) REFERENCES "user" (uid),
foreign key (mid) REFERENCES "movies" (mid),
foreign key (sid) references "series" (sid)
)
create table "comment"
(
uid INTEGER NOT NULL,
mid INTEGER NOT NULL,
cid INTEGER NOT NULL,
reply INTEGER NOT NULL,
comment CHARACTER VARYING(4000),
primary key (uid, mid, cid),
foreign key (uid) REFERENCES "user" (uid),
foreign key (mid) REFERENCES "movies" (mid)
)
create table "rate"
(
uid INTEGER NOT NULL,
mid INTEGER NOT NULL,
rate float check ( rate >= 1 and rate <= 10),
primary key (uid, mid),
foreign key (uid) REFERENCES "user" (uid),
foreign key (mid) REFERENCES "movies" (mid)
)
create table "watchlist"
(
uid INTEGER NOT NULL,
wid INTEGER NOT NULL,
username CHARACTER VARYING(30),
primary key (uid,wid),
foreign key (uid) REFERENCES "user" (uid)
)
create table "detail"
(
mid INTEGER NOT NULL,
uid INTEGER NOT NULL,
wid INTEGER NOT NULL,
primary key (mid,wid),
foreign key (uid,wid) REFERENCES "watchlist" (uid,wid),
foreign key (mid) REFERENCES "movies" (mid)
)
create table "movies"
(
mid INTEGER NOT NULL,
name CHARACTER VARYING(30),
rate float check ( rate >= 1 and rate <= 10),
year date,
duration float,
companyid integer not null,
primary key (mid),
foreign key (companyid) references "companies" (cid)
)
insert into "movies" values(0, 'null_value', 1,'2000-01-01' , 1.5, 0)
create table "series"
(
sid INTEGER NOT NULL,
name CHARACTER VARYING(30),
rate float check ( rate >= 1 and rate <= 10),
year date,
noOFepisodes INTEGER,
networkid integer not null,
primary key (sid),
foreign key (networkid) references "network" (nid)
)
insert into "series" values(0, 'null_value', 1, '2000-01-01', 0, 0)
create table "M&S"
(
mid integer,
sid integer,
name character varying(30),
primary key (mid, sid),
foreign key (mid) REFERENCES "movies" (mid),
foreign key (sid) REFERENCES "series" (sid)
)
create table "companies"
(
cid integer not null,
name CHARACTER VARYING(30),
year date,
description character varying(2000),
primary key (cid)
)
insert into "companies" values(0)
create table "boxoffice"
(
mid INTEGER NOT NULL,
date date,
sale float,
primary key (mid, date),
foreign key (mid) REFERENCES "movies" (mid)
)
create table "top250movies"
(
mid INTEGER NOT NULL,
name CHARACTER VARYING(30),
rate float,
year date,
primary key (mid),
foreign key (mid) REFERENCES "movies" (mid)
)
create table "top250series"
(
sid INTEGER NOT NULL,
rate float,
name CHARACTER VARYING(30),
year date,
primary key (sid),
foreign key (sid) REFERENCES "series" (sid)
)
create table "shows"
(
sid INTEGER NOT NULL,
nid INTEGER NOT NULL,
name CHARACTER VARYING(30),
primary key (sid),
foreign key (nid) references "network" (nid)
)
create table "network"
(
nid INTEGER NOT NULL,
name CHARACTER VARYING(30),
year date,
description character varying(2000),
primary key (nid)
)
insert into "network" values(0)
create table "cast"
(
pid INTEGER NOT NULL,
mid INTEGER NOT NULL,
role CHARACTER VARYING(30),
primary key (pid, mid, role),
foreign key (mid) REFERENCES "movies" (mid),
foreign key (pid) references "person" (pid),
check (role in ('Director', 'Producer', 'Actor', 'Composer', 'Editor'))
)
create table "photo"
(
photo_id integer not null,
mid integer not null,
photo oid,
primary key (photo_id, mid),
foreign key (mid) references "movies" (mid)
)
create table "person"
(
pid INTEGER NOT NULL,
name CHARACTER VARYING(30),
birthdate date,
primary key (pid)
)
create table "winner"
(
pid integer not null,
mid integer not null,
role CHARACTER VARYING(30),
festival_name CHARACTER VARYING(30),
event_name CHARACTER VARYING(30),
award_name CHARACTER VARYING(30),
date date,
primary key (pid, mid, festival_name, award_name, date),
foreign key (pid, mid, role) references "cast" (pid, mid, role),
foreign key (festival_name, award_name) references "award" (festival_name, name),
foreign key (event_name, date) references "event" (name, date)
)
create table "award"
(
festival_name CHARACTER VARYING(30),
name CHARACTER VARYING(30),
primary key (festival_name, name),
foreign key (festival_name) references "festival" (name)
)
create table "festival"
(
name CHARACTER VARYING(30),
description CHARACTER VARYING(4000),
primary key (name)
)
create table "event"
(
name CHARACTER VARYING(30),
date date,
place character varying(40),
primary key (name, date),
foreign key (name) references "festival" (name)
)
| true |
635babbbb821ee4cb654e8140c8ba8683d989fee | SQL | silence-do-good/stress-test-Postgres-and-MySQL | /dump/low/day18/select2200.sql | UTF-8 | 178 | 2.640625 | 3 | [] | no_license |
SELECT timeStamp, temperature FROM ThermometerOBSERVATION o
WHERE timestamp>'2017-11-17T22:00:00Z' AND timestamp<'2017-11-18T22:00:00Z' AND temperature>=11 AND temperature<=33
| true |
af3a7ce8f981fd42a353f53c7386b05b42884570 | SQL | ramachandrann/message-db | /demo-db.sql | UTF-8 | 2,364 | 3.40625 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 5.7.17-log - MySQL Community Server (GPL)
-- Server OS: Win64
-- HeidiSQL Version: 9.3.0.4984
-- --------------------------------------------------------
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping database structure for demo
DROP DATABASE IF EXISTS `demo`;
CREATE DATABASE IF NOT EXISTS `demo` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `demo`;
-- Dumping structure for table demo.message
DROP TABLE IF EXISTS `message`;
CREATE TABLE IF NOT EXISTS `message` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`text` varchar(50) NOT NULL,
`hasRead` char(1) NOT NULL,
`userId` int(11) NOT NULL,
`createdOn` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `fk_message_user` (`userId`),
CONSTRAINT `fk-message-user` FOREIGN KEY (`userId`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
-- Dumping data for table demo.message: ~3 rows (approximately)
/*!40000 ALTER TABLE `message` DISABLE KEYS */;
INSERT INTO `message` (`id`, `text`, `hasRead`, `userId`, `createdOn`) VALUES
(16, 'Form A is invalid.', 'N', 1, '2017-02-06 10:48:29'),
(17, 'Form A needs additional attachments', 'N', 1, '2017-02-06 10:54:19'),
(18, 'Form B submitted.', 'N', 1, '2017-02-06 11:20:50');
/*!40000 ALTER TABLE `message` ENABLE KEYS */;
-- Dumping structure for table demo.user
DROP TABLE IF EXISTS `user`;
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
-- Dumping data for table demo.user: ~2 rows (approximately)
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
INSERT INTO `user` (`id`, `name`) VALUES
(1, 'GOPAL'),
(2, 'TOM');
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
| true |
47dd8610b81ee5761ecc9f8664a38e3220ffe13e | SQL | wabp/dba | /oracle/abf/wfanalyze.sql | UTF-8 | 217,047 | 2.90625 | 3 | [] | no_license | REM HEADER
REM $Header: workflow_analyzer.sql v4.06 BBURBAGE $
REM
REM MODIFICATION LOG:
REM
REM BBURBAGE
REM
REM Consolidated script to diagnose the current status and footprint of workflow on an environment.
REM This script can be run on 11.5.x or higher.
REM
REM workflow_analyzer.sql
REM
REM This script was created to collect all the required information to understand what impact workflow
REM embedded in Oracle Applications has on an EBS instance.
REM
REM
REM How to run it?
REM
REM sqlplus apps/<password> @workflow_analyzer.sql
REM
REM
REM Output file
REM
REM wf_analyzer_<SID>_<HOST_NAME>.html
REM
REM
REM Created: May 16th, 2011
REM Last Updated: July 10th, 2012
REM
REM
REM CHANGE HISTORY:
REM 1.00 16-MAY-2011 bburbage Creation from design
REM 1.01 04-JUN-2011 bburbage Adjustments to include more queries
REM 3.00 11-JUN-2011 bburbage Change output to html
REM 3.01 16-JUN-2011 bburbage Adding patches, adding more recommendations
REM 3.02 08-JUL-2011 bburbage Adding WF_ADMIN_ROLE search and enhancements
REM 3.03 21-JUL-2011 bburbage Added Profiles check, and database parameter settings
REM aq_tm_processes and job_queue_processes
REM 3.06 07-JUL-2011 bburbage Enhanced Java Mailer to loop thru custom mailer if exist
REM Modified the Concurrent Requests test to include scheduled requests
REM as well as requests that have run.
REM 4.00 19-SEP-2011 bburbage Prepare script for initial external release
REM 4.01 06-DEC-2011 bburbage Adding Feedback Section
REM Adding Change History
REM 4.02 07-DEC-2011 bburbage Corrected some miscellaneous verbage and color coding
REM 4.03 28-DEC-2011 bburbage Created table for TOC.
REM Added SQL Script buttons to display queries
REM Added exception logic for no rows found in large historical activities
REM 4.04 12-JAN-2012 bburbage Added logic to stablize Footprint graph code
REM Added SYSADMIN User Setup Analysis
REM 4.05 28-FEB-2012 bburbage Miscellaneous syntax corrections
REM Added Note 1425053.1 on How To schedule WF_Analyzer as Concurrent Request.
REM to the script output and to the Note 1369938.1
REM Added R12.2 to WF Patch Checklist
REM Modified the WF Footprint graph and Runtime Tables
REM Added graph for WF Error Notifications
REM Removed the spool naming format to allow for Concurrent Request Functionality
REM Added spool naming instructions in Note 1369938.1 for running script manually
REM 4.06 21-APR-2012 bburbage Miscellaneous syntax corrections
REM 18-JUN-2012 bburbage Fine tuned the compile date and time to run calculations
REM
set arraysize 1
set heading off
set feedback off
set echo off
set verify off
SET CONCAT ON
SET CONCAT .
SET ESCAPE OFF
SET ESCAPE '\'
set lines 120
set pages 9999
set serveroutput on size 100000
variable st_time varchar2(100);
variable et_time varchar2(100);
begin
select to_char(sysdate,'hh24:mi:ss') into :st_time from dual;
end;
/
REM COLUMN host_name NOPRINT NEW_VALUE hostname
REM SELECT host_name from v$instance;
REM COLUMN instance_name NOPRINT NEW_VALUE instancename
REM SELECT instance_name from v$instance;
REM COLUMN sysdate NOPRINT NEW_VALUE when
REM select to_char(sysdate, 'YYYY-Mon-DD') "sysdate" from dual;
REM SPOOL wf_analyzer_&&hostname._&&instancename._&&when..html
VARIABLE TEST VARCHAR2(240);
VARIABLE WFCMTPHY NUMBER;
VARIABLE WFDIGPHY NUMBER;
VARIABLE WFITMPHY NUMBER;
VARIABLE WIASPHY NUMBER;
VARIABLE WIASHPHY NUMBER;
VARIABLE WFATTRPHY NUMBER;
VARIABLE WFNTFPHY NUMBER;
VARIABLE WFCMTPHY2 NUMBER;
VARIABLE WFDIGPHY2 NUMBER;
VARIABLE WFITMPHY2 NUMBER;
VARIABLE WIASPHY2 NUMBER;
VARIABLE WIASHPHY2 NUMBER;
VARIABLE WFATTRPHY2 NUMBER;
VARIABLE WFNTFPHY2 NUMBER;
VARIABLE ERRORNTFCNT NUMBER;
VARIABLE NTFERR_CNT NUMBER;
VARIABLE ECXERR_CNT NUMBER;
VARIABLE OMERR_CNT NUMBER;
VARIABLE POERR_CNT NUMBER;
VARIABLE WFERR_CNT NUMBER;
VARIABLE ECXRATE NUMBER;
VARIABLE OMRATE NUMBER;
VARIABLE PORATE NUMBER;
VARIABLE WFRATE NUMBER;
VARIABLE ADMIN_EMAIL VARCHAR2(40);
VARIABLE NTF_PREF VARCHAR2(10);
VARIABLE GSM VARCHAR2(1);
VARIABLE WF_ADMIN_ROLE VARCHAR2(320);
VARIABLE ITEM_CNT NUMBER;
VARIABLE ITEM_OPEN NUMBER;
VARIABLE OLDEST_ITEM NUMBER;
VARIABLE SID VARCHAR2(20);
VARIABLE HOST VARCHAR2(30);
VARIABLE APPS_REL VARCHAR2(10);
VARIABLE WF_ADMIN_DISPLAY VARCHAR2(360);
VARIABLE EMAIL VARCHAR2(320);
VARIABLE EMAIL_OVERRIDE VARCHAR2(320);
VARIABLE NTF_PREF VARCHAR2(8);
VARIABLE MAILER_ENABLED VARCHAR2(10);
VARIABLE MAILER_STATUS VARCHAR2(30);
VARIABLE CORRID VARCHAR2(240);
VARIABLE COMPONENT_NAME VARCHAR2(80);
VARIABLE CONTAINER_NAME VARCHAR2(240);
VARIABLE STARTUP_MODE VARCHAR2(30);
VARIABLE TOTAL_ERROR NUMBER;
VARIABLE OPEN_ERROR NUMBER;
VARIABLE CLOSED_ERROR NUMBER;
VARIABLE LOGICAL_TOTALS VARCHAR2(22);
VARIABLE PHYSICAL_TOTALS VARCHAR2(22);
VARIABLE DIFF_TOTALS VARCHAR2(22);
VARIABLE NINETY_TOTALS VARCHAR2(22);
VARIABLE RATE NUMBER;
VARIABLE NINETY_CNT NUMBER;
VARIABLE HIST_CNT NUMBER;
VARIABLE HIST_DAYS NUMBER;
VARIABLE HIST_DAILY NUMBER;
VARIABLE MAILER_CNT NUMBER;
VARIABLE HIST_END VARCHAR2(22);
VARIABLE HIST_BEGIN VARCHAR2(22);
VARIABLE SYSDATE VARCHAR2(22);
VARIABLE HIST_RECENT VARCHAR2(22);
VARIABLE HASROWS NUMBER;
VARIABLE HIST_ITEM VARCHAR2(8);
VARIABLE HIST_KEY VARCHAR2(240);
VARIABLE WFADMIN_NAME VARCHAR2(320);
VARIABLE WFADMIN_DISPLAY_NAME VARCHAR2(360);
VARIABLE WFADMIN_ORIG_SYSTEM VARCHAR2(30);
VARIABLE WFADMIN_STATUS VARCHAR2(8);
VARIABLE WF_ADMINS_CNT NUMBER;
VARIABLE QMON NUMBER;
VARIABLE DB_VER VARCHAR2(10);
declare
test varchar2(240);
wfcmtphy number;
wfdigphy number;
wfitmphy number;
wiasphy number;
wiashphy number;
wfattrphy number;
wfntfphy number;
wfcmtphy2 number;
wfdigphy2 number;
wfitmphy2 number;
wiasphy2 number;
wiashphy2 number;
wfattrphy2 number;
wfntfphy2 number;
errorntfcnt number;
ntferr_cnt number;
ecxerr_cnt number;
omerr_cnt number;
poerr_cnt number;
wferr_cnt number;
ecxrate number;
omrate number;
porate number;
wfrate number;
admin_email varchar2(40);
ntf_pref varchar2(10);
gsm varchar2(1);
item_cnt number;
item_open number;
oldest_item number;
sid varchar2(20);
host varchar2(30);
apps_rel varchar2(10);
wf_admin_display varchar2(360);
email varchar2(320);
email_override varchar2(320);
ntf_pref varchar2(8);
mailer_enabled varchar2(10);
mailer_status varchar2(30);
corrid varchar2(240);
component_name varchar2(80);
container_name varchar2(240);
startup_mode varchar2(30);
total_error number;
open_error number;
closed_error number;
wf_admin_role varchar2(320);
logical_totals varchar2(22);
physical_totals varchar2(22);
diff_totals varchar2(22);
ninety_totals varchar2(22);
rate number;
ninety_cnt number;
hist_cnt number;
hist_days number;
hist_daily number;
mailer_cnt number;
hist_end varchar2(22);
hist_begin varchar2(22);
hist_recent varchar2(22);
sysdate varchar2(22);
hasrows number;
hist_item varchar2(8);
hist_key varchar2(240);
wf_admins_cnt number;
wfadmin_name varchar2(320);
wfadmin_display_name varchar2(360);
wfadmin_orig_system varchar2(30);
wfadmin_status varchar2(8);
qmon number;
mycheck number;
db_ver varchar2(10);
begin
select wf_core.translate('WF_ADMIN_ROLE') into :wf_admin_role from dual;
end;
/
alter session set NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
prompt <HTML>
prompt <HEAD>
prompt <TITLE>Workflow Analyzer</TITLE>
prompt <STYLE TYPE="text/css">
prompt <!-- TD {font-size: 10pt; font-family: calibri; font-style: normal} -->
prompt </STYLE>
prompt </HEAD>
prompt <BODY>
prompt <TABLE border="1" cellspacing="0" cellpadding="10">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF"><TD bordercolor="#DEE6EF"><font face="Calibri">
prompt <B><font size="+2">Workflow Analyzer for
select UPPER(instance_name) from v$instance;
prompt <B><font size="+2"> on
select UPPER(host_name) from v$instance;
prompt </font></B></TD></TR>
prompt </TABLE><BR>
prompt <img width="758" height="81" title="Support URL" src="https://support.oracle.com/oip/faces/secure/km/DownloadAttachment.jspx?attachid=432.1:BANNER2" /></a>
prompt <br>
prompt <font size="-1"><i><b>WF Analyzer v4.06 compiled on :
select to_char(sysdate, 'Dy Month DD, YYYY') from dual;
prompt at
select to_char(sysdate, ' hh24:mi:ss') from dual;
prompt </b></i></font><BR><BR>
prompt This Workflow Analyzer script reviews the current Workflow Footprint, analyzes runtime tables, profiles, settings,
prompt and configurations for the overall workflow environment, providing helpful feedback and recommendations on Best Practices for any areas for concern on your system.
prompt <BR>
prompt ________________________________________________________________________________________________<BR>
prompt <table width="95%" border="0">
prompt <tr>
prompt <td colspan="2" height="46">
prompt <p><a name="top"><b><font size="+2">Table of Contents</font></b></a> </p>
prompt </td>
prompt </tr>
prompt <tr>
prompt <td width="50%">
prompt <p><a href="#section1"><b><font size="+1">Workflow Analzyer Overview</font></b></a>
prompt <br>
prompt <blockquote> <a href="#wfadv111"> - E-Business Suite Version</a><br>
prompt <a href="#wfadv112"> - Workflow Database Parameter Settings</a></blockquote>
prompt <a href="#section2"><b><font size="+1">Workflow Administration</font></b></a>
prompt <br>
prompt <blockquote> <a href="#wfadv121"> - Verify the Workflow Administrator Role</a><br>
prompt <a href="#sysadmin"> - SYSADMIN User Setup for Error Notifications</a><br>
prompt <a href="#wfadv122"> - SYSADMIN WorkList Access</a><br>
prompt <a href="#wfrouting"> - SYSADMIN Notification Routing Rules</a><br>
prompt <a href="#wfadv123"> - Verify AutoClose_FYI Setting</a><br>
prompt <a href="#ebsprofile"> - E-Business Suite Profile Settings</a><br>
prompt <a href="#wfprofile"> - Workflow Profile Settings</a><br>
prompt <a href="#wfadv124"> - Verify Error Messages</a><br>
prompt <a href="#wfstuck"> - Verify #STUCK Activities</a><br>
prompt <a href="#wfadv125"> - Totals for Notification Preferences</a><br>
prompt <a href="#wfadv126"> - Check the Status of Workflow Services</a><br>
prompt </blockquote>
prompt <a href="#section3"><b><font size="+1">Workflow Footprint</font></b></a>
prompt <br>
prompt <blockquote> <a href="#wfadv131"> - Volume of Workflow Runtime Data Tables</a><br>
prompt <a href="#wfadv132"> - Verify Closed and Purgeable TEMP Items</a><br>
prompt <a href="#wfsummry"> - SUMMARY Of Workflow Processes By Item Type</a><br>
prompt <a href="#wfadv133"> - Check the Volume of Open and Closed Items Annually</a><br>
prompt <a href="#wfadv134"> - Average Volume of Opened Items in the past 6 Months,
prompt Monthly, and Daily</a><br>
prompt <a href="#wfadv135"> - Total OPEN Items Started Over 90 Days Ago</a><br>
prompt <a href="#wfadv136"> - Check Top 30 Large Item Activity Status History
prompt Items</a></blockquote>
prompt </td>
prompt <td width="50%"><a href="#section4"><b><font size="+1">Workflow Concurrent
prompt Programs</font></b></a> <br>
prompt <blockquote> <a href="#wfadv141"> - Verify Concurrent Programs Scheduled
prompt to Run</a><br>
prompt <a href="#wfadv142"> - Verify Workflow Background Processes that ran</a><br>
prompt <a href="#wfadv143"> - Verify Status of the Workflow Background Engine
prompt Deferred Queue Table</a><br>
prompt <a href="#wfadv144"> - Verify Workflow Purge Concurrent Programs</a><br>
prompt <a href="#wfadv145"> - Verify Workflow Control Queue Cleanup Programs</a></blockquote>
prompt <a href="#section5"><b><font size="+1">Workflow Notification Mailer</font></b></a>
prompt <br>
prompt <blockquote> <a href="#wfadv151"> - Check the status of the Workflow Services</a><br>
prompt <a href="#wfadv152"> - Check the status of the Workflow Notification Mailer(s)</a><br>
prompt <a href="#wfadv153"> - Check Status of WF_NOTIFICATIONS Table</a><br>
prompt <a href="#wfadv154"> - Check Status of WF_NOTIFICATION_OUT Table</a><br>
prompt <a href="#wfadv155"> - Check for Orphaned Notifications</a></blockquote>
prompt <a href="#section6"><b><font size="+1">Workflow Patch Levels</font></b></a>
prompt <br>
prompt <blockquote> <a href="#wfadv161"> - Applied ATG Patches</a><br>
prompt <a href="#atgrups"> - Known 1-Off Patches on top of ATG Rollups</a><br>
prompt <a href="#wfadv162"> - Verify Status of Workflow Log Levels</a><br>
prompt <a href="#wfadv163"> - Verify Workflow Services Log Locations</a><br>
prompt </blockquote>
prompt <a href="#section7"><b><font size="+1">References</font></b></a>
prompt <blockquote></blockquote>
prompt </td>
prompt </tr>
prompt </table>
prompt ________________________________________________________________________________________________<BR><BR>
REM ****************************************************************************************
REM ******* Section 1 : Workflow Analyzer Overview *******
REM ****************************************************************************************
prompt <a name="section1"></a><B><font size="+2">Workflow Analyzer Overview</font></B><BR><BR>
begin
select upper(instance_name) into :sid from v$instance;
select host_name into :host from fnd_product_groups, v$instance;
select release_name into :apps_rel from fnd_product_groups, v$instance;
select e.status into :mailer_enabled
from wf_events e, WF_EVENT_SUBSCRIPTIONS s
where e.GUID=s.EVENT_FILTER_GUID
and s.DESCRIPTION like '%WF_NOTIFICATION_OUT%'
and e.name = 'oracle.apps.wf.notification.send.group';
select count(notification_id) into :total_error
from WF_NOTIFICATIONS
where message_type like '%ERROR%';
select count(notification_id) into :open_error
from WF_NOTIFICATIONS
where message_type like '%ERROR%'
and end_date is null;
select count(notification_id) into :closed_error
from WF_NOTIFICATIONS
where message_type like '%ERROR%'
and end_date is not null;
select count(item_key) into :item_cnt from wf_items;
select count(item_key) into :item_open from wf_items where end_date is null;
select round(sysdate-(min(begin_date)),0) into :oldest_item from wf_items;
if (:oldest_item > 1095) THEN
dbms_output.put_line('<b>Workflow Runtime Data Table Gauge</b><BR>');
dbms_output.put('<img src="http://chart.apis.google.com/chart?chxl=0:|critical|bad|good');
dbms_output.put('\&chxt=y');
dbms_output.put('\&chs=300x150');
dbms_output.put('\&cht=gm');
dbms_output.put('\&chd=t:10');
dbms_output.put('\&chl=Excessive" width="300" height="150" alt="" />');
dbms_output.put_line('<BR><BR>');
dbms_output.put_line('<table border="1" name="RedBox" cellpadding="10" bordercolor="#CC0033" bgcolor="#CC6666" cellspacing="0">');
dbms_output.put_line('<tbody><font face="Calibri"><tr><td> ');
dbms_output.put_line(' <p><font size="+2">Your overall Workflow HealthCheck Status is in need of Immediate Review!</font><BR> ');
dbms_output.put_line(' The WF_ITEMS Table has obsolete workflow runtime data that is older than 3 years.<BR><BR></p>');
dbms_output.put_line(' </td></tr></tbody> ');
dbms_output.put_line('</table><BR>');
else if (:oldest_item > 365) THEN
dbms_output.put_line('<b>Workflow Runtime Data Table Gauge</b><BR>');
dbms_output.put('<img src="http://chart.apis.google.com/chart?chxl=0:|critical|bad|good');
dbms_output.put('\&chxt=y');
dbms_output.put('\&chs=300x150');
dbms_output.put('\&cht=gm');
dbms_output.put('\&chd=t:50');
dbms_output.put('\&chl=Poor" width="300" height="150" alt="" />');
dbms_output.put_line('<BR><BR>');
dbms_output.put_line('<table border="1" name="OrangeBox" cellpadding="10" bordercolor="#FF9900" bgcolor="#FFCC66" cellspacing="0">');
dbms_output.put_line('<tbody><font face="Calibri"><tr><td> ');
dbms_output.put_line(' <p><font size="+2">Your overall Workflow HealthCheck Status is in need of Review!</font><BR> ');
dbms_output.put_line(' The WF_ITEMS Table has obsolete workflow runtime data that is older than 1 year but less than 3 years.<BR><BR></p>');
dbms_output.put_line(' </td></tr></tbody> ');
dbms_output.put_line('</table><BR>');
else
dbms_output.put_line('<b>Workflow Runtime Data Table Gauge</b><BR>');
dbms_output.put('<img src="http://chart.apis.google.com/chart?chxl=0:|critical|bad|good');
dbms_output.put('\&chxt=y');
dbms_output.put('\&chs=300x150');
dbms_output.put('\&cht=gm');
dbms_output.put('\&chd=t:90');
dbms_output.put('\&chl=Healthy" width="300" height="150" alt="" />');
dbms_output.put_line('<BR><BR>');
dbms_output.put_line('<table border="1" name="GreenBox" cellpadding="10" bordercolor="#666600" bgcolor="#99FF99" cellspacing="0">');
dbms_output.put_line('<tbody><font face="Calibri"><tr><td> ');
dbms_output.put_line(' <p><font size="+2">Your overall Workflow HealthCheck Status is Healthy!</font><BR> ');
dbms_output.put_line(' The WF_ITEMS Table has workflow runtime data that is less than 1 year old.<BR><BR></p>');
dbms_output.put_line(' </td></tr></tbody> ');
dbms_output.put_line('</table><BR>');
end if;
end if;
if (:item_cnt > 100) THEN
dbms_output.put_line('We reviewed all ' || to_char(:item_cnt,'999,999,999,999') || ' rows in WF_ITEMS Table for Oracle Applications Release ' || :apps_rel || ' instance called ' || :sid || ' on ' || :host || '<BR>');
dbms_output.put_line('Currently ' || (round(:item_open/:item_cnt, 2)*100) || '% (' || to_char(:item_open,'999,999,999,999') || ') of WF_ITEMS are OPEN, while ' || (round((:item_cnt-:item_open)/:item_cnt, 2)*100) || '% (' || to_char((:item_cnt-:item_open),'999,999,999,999') || ') are CLOSED items but still exist in the runtime tables.<BR><BR>');
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note:</B> Once a Workflow is closed, its runtime data that is stored in Workflow Runtime Tables (WF_*) becomes obsolete.<BR>');
dbms_output.put_line('All the pertinent data is stored in the functional tables (FND_*, PO_*, AP_*, HR_*, OE_*, etc), like who approved what, for how much, for who, etc...)<br>');
dbms_output.put_line('Remember that each row in WF_ITEMS is associated to 100s or 1000s of rows in the other WF runtime tables, ');
dbms_output.put_line('so it is important to purge this obsolete runtime data regularly.</p>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
else
dbms_output.put_line('There are less than 100 items in the WF_ITEMS table.<BR><BR>');
end if;
end;
/
REM
REM ******* Ebusiness Suite Version *******
REM
prompt <script type="text/javascript"> function displayRows1sql1(){var row = document.getElementById("s1sql1");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=4 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv111"></a>
prompt <B>E-Business Suite Version</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows1sql1()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s1sql1" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="5" height="60">
prompt <blockquote><p align="left">
prompt select vi.instance_name, fpg.release_name, vi.host_name, vi.startup_time, vi.version <br>
prompt from fnd_product_groups fpg, v$instance vi<br>
prompt where fpg.APPLICATIONS_SYSTEM_NAME = vi.INSTANCE_NAME;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>SID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>RELEASE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>HOSTNAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STARTED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DATABASE</B></TD>
select
'<TR><TD>'||instance_name||'</TD>'||chr(10)||
'<TD>'||release_name||'</TD>'||chr(10)||
'<TD>'||host_name||'</TD>'||chr(10)||
'<TD>'||startup_time||'</TD>'||chr(10)||
'<TD>'||version||'</TD></TR>'
from fnd_product_groups, v$instance
where APPLICATIONS_SYSTEM_NAME = INSTANCE_NAME;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Workflow Database Parameter Settings *******
REM
prompt <script type="text/javascript"> function displayRows1sql2(){var row = document.getElementById("s1sql2");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=1 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv112"></a>
prompt <B>Workflow Database Parameter Settings</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows1sql2()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s1sql2" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="2" height="45">
prompt <blockquote><p align="left">
prompt select name, value<br>
prompt from v$parameter<br>
prompt where upper(name) in ('AQ_TM_PROCESSES','JOB_QUEUE_PROCESSES','JOB_QUEUE_INTERVAL',<br>
prompt 'UTL_FILE_DIR','NLS_LANGUAGE', 'NLS_TERRITORY', 'CPU_COUNT',<br>
prompt 'PARALLEL_THREADS_PER_CPU');</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>VALUE</B></TD>
select
'<TR><TD>'||name||'</TD>'||chr(10)||
'<TD>'||value||'</TD></TR>'
from v$parameter
where upper(name) in ('AQ_TM_PROCESSES','JOB_QUEUE_PROCESSES','JOB_QUEUE_INTERVAL','UTL_FILE_DIR','NLS_LANGUAGE', 'NLS_TERRITORY', 'CPU_COUNT','PARALLEL_THREADS_PER_CPU');
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
begin
select version into :db_ver from v$instance;
if (:db_ver like '8.%') or (:db_ver like '9.%') then
:db_ver := '0'||:db_ver;
end if;
if (:db_ver < '11.1') then
select value into :qmon from v$parameter where upper(name) = 'AQ_TM_PROCESSES';
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note: JOB_QUEUE_PROCESSES for pre-11gR1 (11.1) databases:</B><BR>');
dbms_output.put_line('Oracle Workflow requires job queue processes to handle propagation of Business Event System event messages by AQs.<BR>');
dbms_output.put_line('<B>The recommended minimum number of JOB_QUEUE_PROCESSES for Oracle Workflow is 10.<BR> ');
dbms_output.put_line('The maximum number of JOB_QUEUE_PROCESSES is :<BR> - 36 in Oracle8i<BR> - 1,000 in Oracle9i Database and higher, so set the value of JOB_QUEUE_PROCESSES accordingly.</B><BR>');
dbms_output.put_line('The ideal setting for JOB_QUEUE_PROCESSES should be set to the maximum number of jobs that would ever be run concurrently on a system PLUS a few more.</B><BR><BR>');
dbms_output.put_line('To determine the proper amount of JOB_QUEUE_PROCESSES for Oracle Workflow, follow the queries outlined in<BR> ');
dbms_output.put_line('<a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=578831.1" target="_blank">Note 578831.1</a>');
dbms_output.put_line('- How to determine the correct setting for JOB_QUEUE_PROCESSES.<br></p>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
elsif (:db_ver >= '11.1') then
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note: Significance of the JOB_QUEUE_PROCESSES for 11gR1+ (11.1) databases:</B><BR><BR>');
dbms_output.put_line('Starting from 11gR1, The init.ora parameter job_queue_processes does NOT need to be set for AQ propagations.');
dbms_output.put_line('AQ propagation is now likewise handled by DBMS_SCHEDULER jobs rather than DBMS_JOBS. ');
dbms_output.put_line('Reason: propagation takes advantage of the event based scheduling features of DBMS_SCHEDULER for better scalability. ');
dbms_output.put_line('If the value of the JOB_QUEUE_PROCESSES database initialization parameter is zero, then that parameter does not influence ');
dbms_output.put_line('the number of Oracle Scheduler jobs that can run concurrently. ');
dbms_output.put_line('However, if the value is non-zero, it effectively becomes the maximum number of Scheduler jobs and job queue jobs than can run concurrently. ');
dbms_output.put_line('If a non-zero value is set, it should be large enough to accommodate a Scheduler job for each Messaging Gateway agent to be started.<BR><BR>');
dbms_output.put_line('<B>Oracle Workflow recommends to UNSET the JOB_QUEUE_PROCESSES parameter as per DB recommendations to enable the scheduling features of DBMS_SCHEDULER for better scalability.</B><BR><BR>');
dbms_output.put_line('To update the JOB_QUEUE_PROCESSES database parameter file (init.ora) file:<BR><BR>');
dbms_output.put_line('<i>job_queue_processes=10</i><BR><BR>');
dbms_output.put_line('or set dynamically via<BR><BR>');
dbms_output.put_line('<i>alter system set job_queue_processes=10;</i><BR><BR>Remember that after bouncing the DB, dynamic changes are lost, and the DB parameter file settings are used.<BR>');
dbms_output.put_line('To determine the proper setting of JOB_QUEUE_PROCESSES for Oracle Workflow, follow the queries outlined in <BR>');
dbms_output.put_line('<a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=578831.1" target="_blank">Note 578831.1</a>');
dbms_output.put_line('- How to determine the correct setting for JOB_QUEUE_PROCESSES.<br></p>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
else
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note: To determine the proper amount of JOB_QUEUE_PROCESSES for Oracle Workflow</B><BR>');
dbms_output.put_line('Follow the queries outlined in ');
dbms_output.put_line('<a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=578831.1" target="_blank">Note 578831.1</a>');
dbms_output.put_line('- How to determine the correct setting for JOB_QUEUE_PROCESSES.<br></p>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
end if;
end;
/
begin
select version into :db_ver from v$instance;
if (:db_ver like '8.%') or (:db_ver like '9.%') then
:db_ver := '0'||:db_ver;
end if;
if (:db_ver < '10.1') then
select value into :qmon from v$parameter where upper(name) = 'AQ_TM_PROCESSES';
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note: AQ_TM_PROCESSES for pre-10gR1 (10.1) databases:</B><BR>');
dbms_output.put_line('The Oracle Streams AQ time manager process is called the Queue MONitor (QMON), a background process controlled by parameter AQ_TM_PROCESSES.<BR>');
dbms_output.put_line('QMON processes are associated with the mechanisms for message expiration, retry, delay, maintaining queue statistics, removing PROCESSED messages ');
dbms_output.put_line('from a queue table and updating the dequeue IOT as necessary. QMON plays a part in both permanent and buffered message processing.<BR>');
dbms_output.put_line('If a qmon process should fail, this should not cause the instance to fail. This is also the case with job queue processes.<BR>');
dbms_output.put_line('QMON itself operates on queues but does not use a database queue for its own processing of tasks and time based operations, so it can ');
dbms_output.put_line('be envisaged as a number of discrete tasks which are run by Queue Monitor processes or servers.');
dbms_output.put_line('The AQ_TM_PROCESSES parameter is set in the (init.ora) database parameter file, and by default is set to 1.<br>');
dbms_output.put_line('This value allows Advanced Queuing to start 1 AQ background process for Queue Monitoring, which is ');
dbms_output.put_line('usually sufficient for simple E-Business Suite instances. <BR><B>However, this setting can be increased (dynamically) to improve queue maintenance performance.</B></p>');
dbms_output.put_line('If this parameter is set to a non-zero value X, Oracle creates that number of QMNX processes starting from ora_qmn0_SID (where SID is the identifier of the database) ');
dbms_output.put_line('up to ora_qmnX_SID ; if the parameter is not specified or is set to 0, then the QMON processes are not created. ');
dbms_output.put_line('There can be a maximum of 10 QMON processes running on a single instance. For example the parameter can be set in the init.ora as follows :<BR><BR>');
dbms_output.put_line('<i>aq_tm_processes=3</i><BR><BR>');
dbms_output.put_line('or set dynamically via<BR><BR>');
dbms_output.put_line('<i>alter system set aq_tm_processes=3;</i><BR><BR>Remember that after bouncing the DB, dynamic changes are lost, and the DB parameter file settings are used.<BR>');
dbms_output.put_line('It is recommended to NOT DISABLE the Queue Monitor processes by setting aq_tm_processes=0 on a permanent basis. As can be seen above, ');
dbms_output.put_line('disabling will stop all related processing in relation to tasks outlined. This will likely have a significant affect on operation of queues - PROCESSED ');
dbms_output.put_line('messages will not be removed and any time related, TM actions will not succeed, AQ objects will grow in size.<BR><BR>');
dbms_output.put_line('To update the AQ_TM_PROCESSES database parameter, follow the steps outlined in <BR>');
dbms_output.put_line('<a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=305662.1#aref1" target="_blank">Note 305662.1</a>');
dbms_output.put_line('- Master Note for AQ Queue Monitor Process (QMON).<br></p>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
elsif (:db_ver >= '10.1') then
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note: Significance of the AQ_TM_PROCESSES for 10gR1+ (10.1) databases:</B><BR><BR>');
dbms_output.put_line('Starting from 10gR1, Queue Monitoring can utilize a feature called "auto-tune".<br>');
dbms_output.put_line('That means Queue Monitoring does not need AQ_TM_PROCESSES to be defined,');
dbms_output.put_line('it is instead able to adapt to the number of AQ background processes to the system load.<br>');
dbms_output.put_line('However, if you do specify a value, then that value is taken into account but the number of processes can still be auto-tuned and so the number of ');
dbms_output.put_line('running qXXX processes can be different from what was specified by AQ_TM_PROCESSES.<BR><BR>');
dbms_output.put_line('<B>Oracle Workflow recommends to UNSET the AQ_TM_PROCESSES parameter as per DB recommendations to enable auto-tune feature.</B><BR><BR>');
dbms_output.put_line('Note: For more information refer to <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=746313.1" target="_blank">Note 746313.1</a>');
dbms_output.put_line('- What should be the Correct Setting for Parameter AQ_TM_PROCESSES in E-Business Suite Instance?<br></p>');
dbms_output.put_line('It should be noted that if AQ_TM_PROCESSES is explicitly specified then the process(es) started will only maintain persistent messages. ');
dbms_output.put_line('For example if aq_tm_processes=1 then at least one queue monitor slave process will be dedicated to maintaining persistent messages. ');
dbms_output.put_line('Other process can still be automatically started to maintain buffered messages. Up to and including version 11.1 if you explicitly set aq_tm_processes = 10 ');
dbms_output.put_line('then there will be no processes available to maintain buffered messages. This should be borne in mind in environments which use Streams replication ');
dbms_output.put_line('and from 10.2 onwards user enqueued buffered messages.<BR><BR>');
dbms_output.put_line('It is also recommended to NOT DISABLE the Queue Monitor processes by setting aq_tm_processes=0 on a permanent basis. As can be seen above, ');
dbms_output.put_line('disabling will stop all related processing in relation to tasks outlined. This will likely have a significant affect on operation of queues - PROCESSED ');
dbms_output.put_line('messages will not be removed and any time related, TM actions will not succeed, AQ objects will grow in size.<BR>');
dbms_output.put_line('<p><B>Note: There is a known issue viewing the true value of AQ_TM_PROCESSES for 10gR2+ (10.2) from the v$parameters table.</B><BR>');
dbms_output.put_line('Review the details in <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=428441.1" target="_blank">Note 428441.1</a>');
dbms_output.put_line('- Warning: Aq_tm_processes Is Set To 0" Message in Alert Log After Upgrade to 10.2.0.3 or Higher.</p>');
dbms_output.put_line('To check whether AQ_TM_PROCESSES Auto-Tuning is enabled, follow the steps outlined in<BR> ');
dbms_output.put_line('<a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=305662.1#aref7" target="_blank">Note 305662.1</a>');
dbms_output.put_line('- Master Note for AQ Queue Monitor Process (QMON) under Section : Significance of the AQ_TM_PROCESSES Parameter in 10.1 onwards<br></p>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
else
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note:</B> For more information refer to <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=746313.1" target="_blank">Note 746313.1</a>');
dbms_output.put_line('- What should be the Correct Setting for Parameter AQ_TM_PROCESSES in E-Business Suite Instance?<br></p>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
end if;
end;
/
REM
REM ******* This is just a Note *******
REM
prompt <table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody>
prompt <tr>
prompt <td>
prompt <p>For more information refer to <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=453137.1" target="_blank">
prompt Note 453137.1</a> - Oracle Workflow Best Practices Release 12 and Release 11i<br>
prompt </td>
prompt </tr>
prompt </tbody>
prompt </table><BR><BR>
REM ****************************************************************************************
REM ******* Section 2 : Workflow Administration *******
REM ****************************************************************************************
prompt <a name="section2"></a><B><font size="+2">Workflow Administration</font></B><BR><BR>
REM
REM ******* Verify the Workflow Administrator Role *******
REM
declare
wfadminUsers varchar2(320);
cursor wf_adminIDs IS
select name
from wf_roles
where name in (select user_name from WF_USER_ROLE_ASSIGNMENTS where role_name = (select wf_core.translate('WF_ADMIN_ROLE') from dual));
begin
select wf_core.translate('WF_ADMIN_ROLE') into :wf_admin_role from dual;
select nvl(max(rownum), 0) into :wf_admins_cnt
from wf_roles
where name in (select user_name from WF_USER_ROLE_ASSIGNMENTS where role_name = (select wf_core.translate('WF_ADMIN_ROLE') from dual));
if ((:wf_admin_role like 'FND_RESP%') and (:wf_admins_cnt = 0)) then
dbms_output.put_line('<a name="wfadv121"></a><B><U>Workflow Administrator Role</B></U><BR>');
dbms_output.put_line('There are no Users assigned to this Responsibility, so noone has Workflow Administrator Role permissions on this instance.<BR>');
dbms_output.put_line('Please assign someone this responsibility.<BR><BR> ');
elsif ((:wf_admin_role like 'FND_RESP%') and (:wf_admins_cnt = 1)) then
dbms_output.put_line('<a name="wfadv121"></a><B><U>Workflow Administrator Role</B></U><BR>');
dbms_output.put_line('There is only one User assigned to this Responsibility, so they alone have Workflow Administrator Role permissions on this instance.<BR>');
dbms_output.put_line('Please assign more people to this responsibility.<BR><BR> ');
elsif ((:wf_admin_role like 'FND_RESP%') and (:wf_admins_cnt > 1)) then
select r.display_name into :wf_admin_display
from wf_roles r, wf_resources res
where res.name = 'WF_ADMIN_ROLE'
and res.language = 'US'
and res.text = r.NAME ;
select notification_preference into :ntf_pref
from wf_local_roles r, wf_resources res
where res.name = 'WF_ADMIN_ROLE'
and res.language = 'US'
and res.text = r.NAME ;
select decode(email_address, '','No Email Specified', email_address) into :email
from wf_roles r, wf_resources res
where res.name = 'WF_ADMIN_ROLE'
and res.language = 'US'
and res.text = r.NAME ;
dbms_output.put_line('<a name="wfadv121"></a><B><U>Workflow Administrator Role</B></U><BR>');
dbms_output.put_line('The Workflow Administrator role (WF_ADMIN_ROLE) for ' || :sid || ' is set to a Responsibility (' || :wf_admin_role || ') also known as ' || :wf_admin_display || '.<BR>' );
dbms_output.put_line('This role ' || :wf_admin_role || ' has a Notification Preference of ' || :ntf_pref || ', and email address is set to ' || :email || '.<BR>');
dbms_output.put_line('There are mutiple Users assigned to this Responsibility, all having Workflow Administrator Role permissions on this instance.<BR>');
dbms_output.put_line('Please verify this list of users assigned this responsibility is accurate.<BR><BR>');
dbms_output.put_line('<TABLE border="1" cellspacing="0" cellpadding="2">');
dbms_output.put_line('<TR bgcolor="#DEE6EF" bordercolor="#DEE6EF"><TD COLSPAN=4 bordercolor="#DEE6EF"><font face="Calibri">');
dbms_output.put_line('<a name="wfadmins"></a><B>Roles with Workflow Administrator Role Permissions</B></font></TD></TR>');
dbms_output.put_line('<TR>');
dbms_output.put_line('<TD BGCOLOR=#DEE6EF><font face="Calibri"><B>NAME</B></font></TD>');
dbms_output.put_line('<TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DISPLAY_NAME</B></font></TD>');
dbms_output.put_line('<TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ORIG_SYSTEM</B></font></TD>');
dbms_output.put_line('<TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></font></TD>');
OPEN wf_adminIDs;
LOOP
Fetch wf_adminIDs INTO wfadminUsers;
EXIT WHEN wf_adminIDs%NOTFOUND;
select name into :wfadmin_name
from wf_roles
where name = wfadminUsers;
select display_name into :wfadmin_display_name
from wf_roles
where name = wfadminUsers;
select orig_system into :wfadmin_orig_system
from wf_roles
where name = wfadminUsers;
select status into :wfadmin_status
from wf_roles
where name = wfadminUsers;
dbms_output.put_line('<TR><TD>'||:wfadmin_name||'</TD>');
dbms_output.put_line('<TD>'||:wfadmin_display_name||'</TD>');
dbms_output.put_line('<TD>'||:wfadmin_orig_system||'</TD>');
dbms_output.put_line('<TD>'||:wfadmin_status||'</TD></TR>');
END LOOP;
CLOSE wf_adminIDs;
dbms_output.put_line('</TABLE><P><P>');
dbms_output.put_line('<A href="#top"><font size="-1">Back to Top</font></A><BR><BR>');
elsif (:wf_admin_role = '*') then
:wf_admin_display := 'Asterisk';
:ntf_pref := 'not set';
:email := 'not set when Asterisk';
dbms_output.put_line('<a name="wfadv121"></a><B><U>Workflow Administrator Role</B></U><BR>');
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bordercolor="#CC0033" bgcolor="#CC6666" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Warning:</B>The Workflow Administrator role (WF_ADMIN_ROLE) for ' || :sid || ' is set to an Asterisk which allows EVERYONE access to Workflow Administrator Role permissions.<BR>');
dbms_output.put_line('This is not recommended for Production instances, but may be ok for Testing. <BR>Remember that the Workflow Administrator Role has permissions to full access of all workflows and notifications.<BR><BR>');
dbms_output.put_line(' <p><B>Note:</B> For more information refer to <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=453137.1" target="_blank">Note 453137.1</a>');
dbms_output.put_line('- Oracle Workflow Best Practices Release 12 and Release 11i<br></p>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
else
select r.display_name into :wf_admin_display
from wf_roles r, wf_resources res
where res.name = 'WF_ADMIN_ROLE'
and res.language = 'US'
and res.text = r.NAME ;
select notification_preference into :ntf_pref
from wf_local_roles r, wf_resources res
where res.name = 'WF_ADMIN_ROLE'
and res.language = 'US'
and res.text = r.NAME ;
select decode(email_address, '','No Email Specified', email_address) into :email
from wf_roles r, wf_resources res
where res.name = 'WF_ADMIN_ROLE'
and res.language = 'US'
and res.text = r.NAME ;
dbms_output.put_line('<a name="wfadv121"></a><B><U>Workflow Administrator Role</B></U><BR>');
dbms_output.put_line('The Workflow Administrator role (WF_ADMIN_ROLE) for ' || :sid || ' is set to a single Applications Username or role (' || :wf_admin_role || ') also known as ' || :wf_admin_display || '.<BR>' );
dbms_output.put_line('This role ' || :wf_admin_role || ' has a Notification Preference of ' || :ntf_pref || ', and email address is set to ' || :email || '.<BR>' );
dbms_output.put_line('On this instance, you must log into Oracle Applications as ' || :wf_admin_role || ' to utilize the Workflow Administrator Role permissions and control any and all workflows.<BR><BR>');
dbms_output.put_line('<B>Note:</B> For more information refer to <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=453137.1" target="_blank">Note 453137.1</a>');
dbms_output.put_line('- Oracle Workflow Best Practices Release 12 and Release 11i<br><br>');
end if;
end;
/
prompt <a name="sysadmin"></a><B><U>SYSADMIN User Setup for Error Notifications</B></U><BR>
begin
select notification_preference into :ntf_pref
from wf_roles
where name = 'SYSADMIN';
select nvl(email_address,'NOTSET') into :admin_email
from wf_roles
where name = 'SYSADMIN';
select count(notification_id) into :errorntfcnt
from wf_notifications
where recipient_role = 'SYSADMIN'
and message_type like '%ERROR%';
end;
/
begin
if (:ntf_pref = 'DISABLED') then
dbms_output.put_line('<table border="1" name="Error" cellpadding="10" bgcolor="#CC6666" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Error<BR>');
dbms_output.put_line('The SYSADMIN User e-mail is DISABLED!</B><BR>');
dbms_output.put_line('The SYSADMIN User is the default recipient for several types of notifications such as Workflow error notifications.<br> ');
dbms_output.put_line('Currently there are '||to_char((:errorntfcnt),'999,999,999,999')||' Error Notifications assigned to the SYSADMIN user. <br><br>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('Please specify how you want to receive these notifications by defining the notification preference and e-mail address for the SYSADMIN User.<BR>');
dbms_output.put_line('First correct the SYSADMIN User e-mail_address and change the notification_preference from DISABLED to a valid setting.<BR><BR>');
dbms_output.put_line('Please review System Administration Setup Tasks in the <a href="http://docs.oracle.com/cd/B25516_18/current/acrobat/115sacg.zip"');
dbms_output.put_line('target="_blank">Oracle Applications System Administrators Guide</a>, for information on how to change these settings.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
elsif (:ntf_pref = 'QUERY') then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Warning</B><BR>');
dbms_output.put_line('The SYSADMIN User appears to be setup to <b>not receive</b> email notifications!<br>');
dbms_output.put_line('<br>This is fine.<br>');
dbms_output.put_line('<B>However</b>, this means SYSADMIN can only access notifications through the Oracle Workflow Worklist Web page. <br>');
dbms_output.put_line('Please verify that the SYSADMIN User is actively processing the '||to_char((:errorntfcnt),'999,999,999,999')||' Error Notifications that are currently assigned to this user. <br><br>');
dbms_output.put_line('Please review System Administration Setup Tasks in the <a href="http://docs.oracle.com/cd/B25516_18/current/acrobat/115sacg.zip"');
dbms_output.put_line('target="_blank">Oracle Applications System Administrators Guide</a>, for information on how to change these settings if needed.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
elsif ((:admin_email = 'NOTSET') and (:ntf_pref <> 'QUERY')) then
dbms_output.put_line('<table border="1" name="Error" cellpadding="10" bgcolor="#CC6666" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Error<BR>');
dbms_output.put_line('The SYSADMIN User has not been setup correctly. SYSADMIN e-mail address is not set, but the notification preference is set to send emails.</B><BR>');
dbms_output.put_line('Currently there are '||to_char((:errorntfcnt),'999,999,999,999')||' Error Notifications assigned to the SYSADMIN user. <br><br>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('In Oracle Applications, you must particularly check the notification preference and e-mail address for the SYSADMIN User. <BR>');
dbms_output.put_line('The SYSADMIN User is the default recipient for several types of notifications such as Workflow error notifications. ');
dbms_output.put_line('You need to specify how you want to receive these notifications by defining the notification preference and e-mail address for the User: SYSADMIN.<BR>');
dbms_output.put_line('By default, the SYSADMIN User has a notification preference to receive e-mail notifications. <BR>To enable Oracle Workflow to send e-mail to this user, ');
dbms_output.put_line('navigate to the Users window in Oracle Applications and assign SYSADMIN an e-mail address that is fully qualified with a valid domain.<br> ');
dbms_output.put_line('However, if you want to access notifications only through the Oracle Workflow Worklist Web page, ');
dbms_output.put_line('then you should change the notification preference for SYSADMIN to "Do not send me mail" in the Preferences page. In this case you do not need to define an e-mail address. <br><br>');
dbms_output.put_line('Please review System Administration Setup Tasks in the <a href="http://docs.oracle.com/cd/B25516_18/current/acrobat/115sacg.zip"');
dbms_output.put_line('target="_blank">Oracle Applications System Administrators Guide</a>, for more information.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
elsif ((:admin_email <> 'NOTSET') and (:ntf_pref <> 'QUERY')) then
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note:</B> The SYSADMIN User appears to be setup to receive email notifications.<br>');
dbms_output.put_line('Please verify that the email_address ('||:admin_email||') is a valid email address and can recieve emails successully.<br>');
dbms_output.put_line('Also, please verify that the SYSADMIN User is actively processing the '||to_char((:errorntfcnt),'999,999,999,999')||' Error Notifications that are currently assigned to this user. <br><br>');
dbms_output.put_line('Please review System Administration Setup Tasks in the <a href="http://docs.oracle.com/cd/B25516_18/current/acrobat/115sacg.zip"');
dbms_output.put_line('target="_blank">Oracle Applications System Administrators Guide</a>, for more information.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
else
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note:</B> It is unclear what the SYSADMIN User e-mail address is set to.<br>');
dbms_output.put_line('Please verify that the SYSADMIN User is actively processing the '||to_char((:errorntfcnt),'999,999,999,999')||' Error Notifications that are currently assigned to this user. <br><br>');
dbms_output.put_line('Please review System Administration Setup Tasks in the <a href="http://docs.oracle.com/cd/B25516_18/current/acrobat/115sacg.zip"');
dbms_output.put_line('target="_blank">Oracle Applications System Administrators Guide</a>, for information on how to setup these tasks.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
end if;
end;
/
begin
select nvl(max(rownum), 0) into :ntferr_cnt
from wf_notifications n
where n.message_type like '%ERROR%';
select nvl(max(rownum), 0) into :ecxerr_cnt
from wf_notifications n
where n.message_type = 'ECXERROR';
select nvl(max(rownum), 0) into :omerr_cnt
from wf_notifications n
where n.message_type = 'OMERROR';
select nvl(max(rownum), 0) into :poerr_cnt
from wf_notifications n
where n.message_type = 'POERROR';
select nvl(max(rownum), 0) into :wferr_cnt
from wf_notifications n
where n.message_type = 'WFERROR';
select round(:ecxerr_cnt/:ntferr_cnt,2)*100 into :ecxrate from dual;
select round(:omerr_cnt/:ntferr_cnt,2)*100 into :omrate from dual;
select round(:poerr_cnt/:ntferr_cnt,2)*100 into :porate from dual;
select round(:wferr_cnt/:ntferr_cnt,2)*100 into :wfrate from dual;
dbms_output.put_line('<BR><B><U>Show the status of the Workflow Error Notifications for this instance</B></U><BR>');
if (:ntferr_cnt = 0) then
dbms_output.put_line('There are no Notification Error Messages for this instance.<BR>');
dbms_output.put_line('You deserve a whole cake.<BR><BR> ');
elsif (:ntferr_cnt < 100) then
dbms_output.put_line('There are less that 100 Error Notifications found on this instance.<BR>');
dbms_output.put_line('Keep up the good work.... You deserve a piece of pie. <BR><BR> ');
else
dbms_output.put('<blockquote><img src="https://chart.googleapis.com/chart?');
dbms_output.put('chs=500x200');
dbms_output.put('\&chd=t:'||:wfrate||','||:porate||','||:omrate||','||:ecxrate||'\&cht=p3');
dbms_output.put('\&chtt=Workflow+Error+Notifications+by+Type');
dbms_output.put('\&chl=WFERROR|POERROR|OMERROR|ECXERROR');
dbms_output.put('\&chdl='||:wferr_cnt||'|'||:poerr_cnt||'|'||:omerr_cnt||'|'||:ecxerr_cnt||'"><BR>');
dbms_output.put_line('Item Types</blockquote>');
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<B>Attention</B><BR>');
dbms_output.put_line('There are '||to_char(:ntferr_cnt,'999,999,999,999')||' Error Notifications of type (ECXERROR,OMERROR,POERROR,WFERROR) found on this instance.<BR>');
dbms_output.put_line('Please review the following table to better understand the volume and status for these Error Notifications. <BR><BR>');
dbms_output.put_line('Also review : <br><a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1448095.1" target="_blank">');
dbms_output.put_line('Note 1448095.1</a> - How to handle or reassign System : Error (WFERROR) Notifications that default to SYSADMIN.<br>');
dbms_output.put_line('<a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=760386.1" target="_blank">');
dbms_output.put_line('Note 760386.1</a> - How to enable Bulk Notification Response Processing for Workflow in 11i and R12, for more details on ways to do this.');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
end if;
end;
/
prompt <script type="text/javascript"> function displayRows2sql3(){var row = document.getElementById("s2sql3");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=7 bordercolor="#DEE6EF"><font face="Calibri">
prompt <B>Summary of Error Message Recipients (WFERROR, POERROR, OMERROR, ECXERROR)</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql3()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql3" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="8" height="85">
prompt <blockquote><p align="left">
prompt select r.name, r.display_name, r.status, r.notification_preference, r.email_address, n.message_type,<br>
prompt count(n.notification_id) COUNT, decode(to_char(n.end_date), null, 'OPEN', 'CLOSED') OPEN<br>
prompt from wf_roles r, wf_notifications n<br>
prompt where r.name in (select distinct n.recipient_role from wf_notifications where n.message_type like '%ERROR')<br>
prompt and r.name = n.recipient_role<br>
prompt group by r.name, r.display_name, r.status, r.notification_preference, r.email_address, n.message_type, decode(to_char(n.end_date), null, 'OPEN', 'CLOSED')<br>
prompt order by count(n.notification_id) desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DISPLAY_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PREFERENCE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>EMAIL</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>OPEN</B></TD>
select
'<TR><TD>'||r.name||'</TD>'||chr(10)||
'<TD>'||r.display_name||'</TD>'||chr(10)||
'<TD>'||r.status||'</TD>'||chr(10)||
'<TD>'||r.notification_preference||'</TD>'||chr(10)||
'<TD>'||r.email_address||'</TD>'||chr(10)||
'<TD>'||n.message_type||'</TD>'||chr(10)||
'<TD>'||to_char(count(n.notification_id),'999,999,999,999')||'</TD>'||chr(10)||
'<TD><div align="center">'||decode(to_char(n.end_date), null, 'OPEN', 'CLOSED')||'</div></TD></TR>'
from wf_roles r, wf_notifications n
where r.name in (select distinct n.recipient_role from wf_notifications where n.message_type like '%ERROR')
and r.name = n.recipient_role
group by r.name, r.display_name, r.status, r.notification_preference, r.email_address, n.message_type, decode(to_char(n.end_date), null, 'OPEN', 'CLOSED')
order by count(n.notification_id) desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
prompt <a name="wfadv122"></a><B><U>Worklist Access</B></U><BR>
prompt The Oracle Workflow Advanced Worklist allows you to grant access to your worklist to another user. <BR>
prompt That user can then act as your proxy to handle the notifications in your list on your behalf.
prompt You can either grant a user access for a specific period or allow the user.s access to continue indefinitely.
prompt The worklist access feature lets you allow another user to handle your notifications
prompt without giving that user access to any other privileges or responsibilities that you have in Oracle Applications.<BR>
prompt <BR>
prompt To access other worklists granted to you, simply switch the Advanced Worklist to display the user.s notifications instead of your own.<BR>
prompt When viewing another user.s worklist, you can perform the following actions:<BR>
prompt - View the details of the user.s notifications.<BR>
prompt - Respond to notifications that require a response.<BR>
prompt - Close notifications that do not require a response.<BR>
prompt - Reassign notifications to a different user.<BR><BR>
prompt Below we verify who has been granted WorkList Access to the SYSADMIN Role in order to respond to error notifications.
prompt <BR><BR>
REM
REM ******* WorkList Access for SYSADMIN *******
REM
prompt <script type="text/javascript"> function displayRows2sql2(){var row = document.getElementById("s2sql2");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=5 bordercolor="#DEE6EF"><font face="Calibri">
prompt <B>SYSADMIN WorkList Access</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql2()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql2" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="6" height="85">
prompt <blockquote><p align="left">
prompt select parameter1, grantee_key, start_date,<br>
prompt end_date, parameter2, instance_pk1_value<br>
prompt FROM fnd_grants<br>
prompt WHERE program_name = 'WORKFLOW_UI'<br>
prompt AND parameter1 = 'SYSADMIN';</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>GRANTOR</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>GRANTEE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>START DATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>END DATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ACCESSIBLE ITEMS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MESSAGE</B></TD>
select
'<TR><TD>'||parameter1||'</TD>'||chr(10)||
'<TD>'||grantee_key||'</TD>'||chr(10)||
'<TD>'||start_date||'</TD>'||chr(10)||
'<TD>'||end_date||'</TD>'||chr(10)||
'<TD>'||parameter2||'</TD>'||chr(10)||
'<TD>'||instance_pk1_value||'</TD></TR>'
FROM fnd_grants
WHERE program_name = 'WORKFLOW_UI'
AND parameter1 = 'SYSADMIN';
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Routing Rules for SYSADMIN *******
REM
prompt <a name="wfrouting"></a><B><U>SYSADMIN Notification Routing Rules</B></U><BR>
prompt The Oracle Workflow Advanced Worklist allows you to grant access to your worklist to another user. <BR>
prompt That user can then act as your proxy to handle the notifications in your list on your behalf.
prompt You can either grant a user access for a specific period or allow the user.s access to continue indefinitely.
prompt The worklist access feature lets you allow another user to handle your notifications
prompt without giving that user access to any other privileges or responsibilities that you have in Oracle Applications.<BR>
prompt <BR>
prompt To access other worklists granted to you, simply switch the Advanced Worklist to display the user.s notifications instead of your own.<BR>
prompt When viewing another user.s worklist, you can perform the following actions:<BR>
prompt - View the details of the user.s notifications.<BR>
prompt - Respond to notifications that require a response.<BR>
prompt - Close notifications that do not require a response.<BR>
prompt - Reassign notifications to a different user.<BR><BR>
prompt Below we verify who has been granted WorkList Access to the SYSADMIN Role in order to respond to error notifications.
prompt <BR><BR>
prompt <script type="text/javascript"> function displayRows2sql2a(){var row = document.getElementById("s2sql2a");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri">
prompt <B>SYSADMIN Notification Routing Rules</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql2a()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql2a" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="10" height="85">
prompt <blockquote><p align="left">
prompt SELECT wrr.RULE_ID, wrr.ROLE, r.DESCRIPTION, wrr.ACTION, <br>
prompt wrr.ACTION_ARGUMENT "TO", wrr.MESSAGE_TYPE, wrr.MESSAGE_NAME, <br>
prompt wrr.BEGIN_DATE, wrr.END_DATE, wrr.RULE_COMMENT<br>
prompt FROM WF_ROUTING_RULES wrr, wf_roles r<br>
prompt WHERE wrr.ROLE = r.NAME<br>
prompt and wrr.role = 'SYSADMIN';</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>RULE_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ROLE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DESCRIPTION</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ACTION</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TO</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MESSAGE_TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MESSAGE_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>BEGIN_DATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>END_DATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>RULE_COMMENT</B></TD>
select
'<TR><TD>'||wrr.RULE_ID||'</TD>'||chr(10)||
'<TD>'||wrr.ROLE||'</TD>'||chr(10)||
'<TD>'||r.DESCRIPTION||'</TD>'||chr(10)||
'<TD>'||wrr.ACTION||'</TD>'||chr(10)||
'<TD>'||wrr.ACTION_ARGUMENT||'</TD>'||chr(10)||
'<TD>'||wrr.MESSAGE_TYPE||'</TD>'||chr(10)||
'<TD>'||wrr.MESSAGE_NAME||'</TD>'||chr(10)||
'<TD>'||wrr.BEGIN_DATE||'</TD>'||chr(10)||
'<TD>'||wrr.END_DATE||'</TD>'||chr(10)||
'<TD>'||wrr.RULE_COMMENT||'</TD></TR>'
FROM WF_ROUTING_RULES wrr, wf_roles r
WHERE wrr.ROLE = r.NAME
and wrr.role = 'SYSADMIN';
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Verify AutoClose_FYI Setting *******
REM
prompt <script type="text/javascript"> function displayRows2sql3(){var row = document.getElementById("s2sql3");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=2 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv123"></a>
prompt <B>Verify AutoClose_FYI Setting</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql3()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql3" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="3" height="85">
prompt <blockquote><p align="left">
prompt select SC.COMPONENT_NAME, v.PARAMETER_DISPLAY_NAME, v.PARAMETER_VALUE<br>
prompt from FND_SVC_COMP_PARAM_VALS_V v, FND_SVC_COMPONENTS SC<br>
prompt where v.COMPONENT_ID=sc.COMPONENT_ID <br>
prompt and v.parameter_name = 'AUTOCLOSE_FYI'<br>
prompt order by sc.COMPONENT_ID;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPONENT</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PARAMETER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>VALUE</B></TD>
select
'<TR><TD>'||SC.COMPONENT_NAME||'</TD>'||chr(10)||
'<TD>'||v.PARAMETER_DISPLAY_NAME||'</TD>'||chr(10)||
'<TD><div align="center">'||v.PARAMETER_VALUE||'</div></TD></TR>'
from FND_SVC_COMP_PARAM_VALS_V v, FND_SVC_COMPONENTS SC
where v.COMPONENT_ID=sc.COMPONENT_ID
and v.parameter_name = 'AUTOCLOSE_FYI'
order by sc.COMPONENT_ID;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* E-Business Suite Profile Settings *******
REM
prompt <script type="text/javascript"> function displayRows2sql4(){var row = document.getElementById("s2sql4");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=4 bordercolor="#DEE6EF"><font face="Calibri"><a name="ebsprofile"></a>
prompt <B>E-Business Suite Profile Settings</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql4()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql4" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="5" height="125">
prompt <blockquote><p align="left">
prompt select t.PROFILE_OPTION_ID, t.PROFILE_OPTION_NAME, z.USER_PROFILE_OPTION_NAME,<br>
prompt v.PROFILE_OPTION_VALUE, z.DESCRIPTION<br>
prompt from fnd_profile_options t, fnd_profile_option_values v, fnd_profile_options_tl z<br>
prompt where (v.PROFILE_OPTION_ID (+) = t.PROFILE_OPTION_ID)<br>
prompt and (v.level_id = 10001)<br>
prompt and (z.PROFILE_OPTION_NAME = t.PROFILE_OPTION_NAME)<br>
prompt and (t.PROFILE_OPTION_NAME in ('CONC_GSM_ENABLED','WF_VALIDATE_NTF_ACCESS','GUEST_USER_PWD',<br>
prompt 'AFLOG_ENABLED','AFLOG_FILENAME','AFLOG_LEVEL','AFLOG_BUFFER_MODE','AFLOG_MODULE','FND_FWK_COMPATIBILITY_MODE',<br>
prompt 'FND_VALIDATION_LEVEL','FND_MIGRATED_TO_JRAD','AMPOOL_ENABLED',<br>
prompt 'FND_NTF_REASSIGN_MODE','WF_ROUTE_RULE_ALLOW_ALL'))<br>
prompt order by z.USER_PROFILE_OPTION_NAME;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROFILE_OPTION_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROFILE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>VALUE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DESCRIPTION</B></TD>
select
'<TR><TD>'||t.PROFILE_OPTION_ID||'</TD>'||chr(10)||
'<TD>'||t.PROFILE_OPTION_NAME||'</TD>'||chr(10)||
'<TD>'||z.USER_PROFILE_OPTION_NAME||'</TD>'||chr(10)||
'<TD>'||v.PROFILE_OPTION_VALUE||'</TD>'||chr(10)||
'<TD>'||z.DESCRIPTION||'</TD></TR>'
from fnd_profile_options t, fnd_profile_option_values v, fnd_profile_options_tl z
where (v.PROFILE_OPTION_ID (+) = t.PROFILE_OPTION_ID)
and (v.level_id = 10001)
and (z.PROFILE_OPTION_NAME = t.PROFILE_OPTION_NAME)
and (t.PROFILE_OPTION_NAME in ('CONC_GSM_ENABLED','WF_VALIDATE_NTF_ACCESS','GUEST_USER_PWD','AFLOG_ENABLED','AFLOG_FILENAME','AFLOG_LEVEL','AFLOG_BUFFER_MODE','AFLOG_MODULE','FND_FWK_COMPATIBILITY_MODE',
'FND_VALIDATION_LEVEL','FND_MIGRATED_TO_JRAD','AMPOOL_ENABLED',
'FND_NTF_REASSIGN_MODE','WF_ROUTE_RULE_ALLOW_ALL'))
order by z.USER_PROFILE_OPTION_NAME;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
begin
select v.PROFILE_OPTION_VALUE into :gsm
from fnd_profile_option_values v, fnd_profile_options p
where v.PROFILE_OPTION_ID = p.PROFILE_OPTION_ID
and p.PROFILE_OPTION_NAME = 'CONC_GSM_ENABLED'
and sysdate BETWEEN p.start_date_active
and NVL(p.end_date_active, sysdate);
if (:gsm = 'Y') then
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note: Profile "Concurrent:GSM Enabled" is enabled as expected.</B><BR>');
dbms_output.put_line('The profile "Concurrent:GSM Enabled" is currently set to Y to allow GSM to enable running workflows.<BR>');
dbms_output.put_line('This is expected as GSM must be enabled in order to process workflow.<BR>');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1191400.1#mozTocId991385"');
dbms_output.put_line('target="_blank">Note 1191400.1</a> - Troubleshooting Oracle Workflow Java Notification Mailer, for more information.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
elsif (:gsm = 'N') then
dbms_output.put_line('<table border="1" name="Error" cellpadding="10" bgcolor="#CC6666" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Error<BR>');
dbms_output.put_line('The EBS profile "Concurrent:GSM Enabled" is not enabled.</B><BR>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('Please enable profile "Concurrent:GSM Enabled" to Y to allow GSM to enable running workflows.<BR>');
dbms_output.put_line('GSM must be enabled to process workflow.<BR>');
dbms_output.put_line('Once GSM has started, verify Workflow Services started via OAM.<BR>');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1191400.1#mozTocId991385"');
dbms_output.put_line('target="_blank">Note 1191400.1</a> - Troubleshooting Oracle Workflow Java Notification Mailer, for more information.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
else
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line(' <p><B>Note:</B> It is unclear what EBS profile "Concurrent:GSM Enabled" is set to.');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1191400.1#mozTocId991385"');
dbms_output.put_line('target="_blank">Note 1191400.1</a> - Troubleshooting Oracle Workflow Java Notification Mailer, for more information.<BR>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
end if;
end;
/
REM
REM ******* Workflow Profile Settings *******
REM
prompt <script type="text/javascript"> function displayRows2sql5(){var row = document.getElementById("s2sql5");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=3 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfprofile"></a>
prompt <B>Workflow Profile Settings</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql5()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql5" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="4" height="85">
prompt <blockquote><p align="left">
prompt select t.PROFILE_OPTION_ID, t.PROFILE_OPTION_NAME, z.USER_PROFILE_OPTION_NAME,<br>
prompt nvl(v.PROFILE_OPTION_VALUE,'NOT SET - Replace with specific Web Server URL (non-virtual) if using load balancers')<br>
prompt from fnd_profile_options t, fnd_profile_option_values v, fnd_profile_options_tl z<br>
prompt where (v.PROFILE_OPTION_ID (+) = t.PROFILE_OPTION_ID)<br>
prompt and ((v.level_id = 10001) or (v.level_id is null))<br>
prompt and (z.PROFILE_OPTION_NAME = t.PROFILE_OPTION_NAME)<br>
prompt and (t.PROFILE_OPTION_NAME in ('APPS_FRAMEWORK_AGENT','WF_MAIL_WEB_AGENT'));</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROFILE_OPTION_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROFILE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>VALUE</B></TD>
select
'<TR><TD>'||t.PROFILE_OPTION_ID||'</TD>'||chr(10)||
'<TD>'||t.PROFILE_OPTION_NAME||'</TD>'||chr(10)||
'<TD>'||z.USER_PROFILE_OPTION_NAME||'</TD>'||chr(10)||
'<TD>'||nvl(v.PROFILE_OPTION_VALUE,'NOT SET - Replace with specific Web Server URL (non-virtual) if using load balancers')||'</TD></TR>'
from fnd_profile_options t, fnd_profile_option_values v, fnd_profile_options_tl z
where (v.PROFILE_OPTION_ID (+) = t.PROFILE_OPTION_ID)
and ((v.level_id = 10001) or (v.level_id is null))
and (z.PROFILE_OPTION_NAME = t.PROFILE_OPTION_NAME)
and (t.PROFILE_OPTION_NAME in ('APPS_FRAMEWORK_AGENT','WF_MAIL_WEB_AGENT'));
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Verify Error Messages *******
REM
prompt <script type="text/javascript"> function displayRows2sql6(){var row = document.getElementById("s2sql6");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv124"></a>
prompt <B>Verify Error Messages</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql6()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql6" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="10" height="165">
prompt <blockquote><p align="left">
prompt select n.message_type, n.MESSAGE_NAME, nvl(to_char(n.end_date, 'YYYY'),'OPEN') OPENED,<br>
prompt -- nvl(to_char(n.end_date, 'YYYY-MM'),'OPEN') OPENED, <br>
prompt n.STATUS, n.recipient_role, r.STATUS, r.ORIG_SYSTEM, r.notification_preference NTF_PREF,<br>
prompt r.email_address, count(n.notification_id) COUNT<br>
prompt from wf_notifications n, wf_roles r<br>
prompt where n.recipient_role = r.name<br>
prompt and n.message_type like '%ERROR%'<br>
prompt group by n.message_type, n.MESSAGE_NAME, nvl(to_char(n.end_date, 'YYYY'),'OPEN'), n.STATUS,<br>
prompt n.recipient_role, r.STATUS, r.ORIG_SYSTEM, r.notification_preference, r.email_address<br>
prompt order by nvl(to_char(n.end_date, 'YYYY'),'OPEN'), count(n.notification_id) desc, n.recipient_role;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ITEM TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MESSAGE_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>CLOSED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>NTF_STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>RECIPIENT</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ORIG_SYSTEM</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>EMAIL PREF</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>EMAIL ADDRESS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||n.message_type||'</TD>'||chr(10)||
'<TD>'||n.MESSAGE_NAME||'</TD>'||chr(10)||
'<TD>'||nvl(to_char(n.end_date, 'YYYY'),'OPEN')||'</TD>'||chr(10)||
'<TD>'||n.STATUS||'</TD>'||chr(10)||
'<TD>'||n.recipient_role||'</TD>'||chr(10)||
'<TD>'||r.STATUS||'</TD>'||chr(10)||
'<TD>'||r.ORIG_SYSTEM||'</TD>'||chr(10)||
'<TD>'||r.notification_preference||'</TD>'||chr(10)||
'<TD>'||r.email_address||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(n.notification_id),'999,999,999,999')||'</div></TD></TR>'
from wf_notifications n, wf_roles r
where n.recipient_role = r.name
and n.message_type like '%ERROR%'
group by n.message_type, n.MESSAGE_NAME, nvl(to_char(n.end_date, 'YYYY'),'OPEN'), n.STATUS,
n.recipient_role, r.STATUS, r.ORIG_SYSTEM, r.notification_preference, r.email_address
order by nvl(to_char(n.end_date, 'YYYY'),'OPEN'), count(n.notification_id) desc, n.recipient_role;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
begin
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Warning</B><BR>');
dbms_output.put_line('There are ' || to_char(:total_error,'999,999,999,999') || ' Error Notifications, ');
dbms_output.put_line('where ' || to_char(:open_error,'999,999,999,999') || ' (' || (round(:open_error/:total_error,2)*100) || '%) are still OPEN, and '|| to_char(:closed_error,'999,999,999,999') || ' are closed.<BR><BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR><BR>');
end;
/
REM
REM ******* Verify #STUCK Activities *******
REM
prompt <script type="text/javascript"> function displayRows2sql7(){var row = document.getElementById("s2sql7");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=4 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfstuck"></a>
prompt <B>Verify #STUCK Activities</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql7()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql7" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="5" height="85">
prompt <blockquote><p align="left">
prompt SELECT p.PROCESS_ITEM_TYPE, p.ACTIVITY_NAME, s.ACTIVITY_STATUS,<br>
prompt s.ACTIVITY_RESULT_CODE, count(s.ITEM_KEY)<br>
prompt FROM wf_item_activity_statuses s,wf_process_activities p<br>
prompt WHERE p.instance_id = s.process_activity<br>
prompt AND activity_status = 'ERROR'<br>
prompt AND activity_result_code = '#STUCK'<br>
prompt GROUP BY p.PROCESS_ITEM_TYPE, p.ACTIVITY_NAME, s.ACTIVITY_STATUS, s.ACTIVITY_RESULT_CODE<br>
prompt ORDER BY p.PROCESS_ITEM_TYPE, count(s.ITEM_KEY) desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ITEM TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ACTIVITY</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ACTIVITY_RESULT_CODE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||p.PROCESS_ITEM_TYPE||'</TD>'||chr(10)||
'<TD>'||p.ACTIVITY_NAME||'</TD>'||chr(10)||
'<TD>'||s.ACTIVITY_STATUS||'</TD>'||chr(10)||
'<TD>'||s.ACTIVITY_RESULT_CODE||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(s.ITEM_KEY),'999,999,999,999')||'</div></TD></TR>'
FROM wf_item_activity_statuses s,wf_process_activities p
WHERE p.instance_id = s.process_activity
and activity_status = 'ERROR'
AND activity_result_code = '#STUCK'
group by p.PROCESS_ITEM_TYPE, p.ACTIVITY_NAME, s.ACTIVITY_STATUS, s.ACTIVITY_RESULT_CODE
order by p.PROCESS_ITEM_TYPE, count(s.ITEM_KEY) desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
prompt <table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody><tr><td>
prompt <B>Note: Clarification on STUCK Activities:</B><BR><BR>
prompt A process is identified as stuck when it has a status of ACTIVE, but cannot progress any further.
prompt Stuck activities do not have a clear pattern as cause but mainly they are caused by flaws in the WF definition like improper transition definitions.
prompt For example, a process could become stuck in the following situations:<BR>
prompt - A thread within a process leads to an activity that is not defined as an End activity
prompt but has no other activity modeled after it, and no other activity is active.<BR>
prompt - A process with only one thread loops back, but the pivot activity of the loop has
prompt the On Revisit property set to Ignore.<BR>
prompt - An activity returns a result for which no eligible transition exists. <BR>
prompt For instance, if the function for a function activity returns an unexpected result value, and no default transition is modeled after that activity, the process cannot continue.
prompt <BR><BR>
prompt <B>COMMON MISCONCEPTION :</B> Running the Worklfow Background Process for STUCK activities fixes STUCK workflows.<BR>Not true.<BR>
prompt Running the concurrent request "Workflow Background Process" with Stuck=Yes only identifies these activities that cannot progress.
prompt The workflow engine changes the status of a stuck process to ERROR:#STUCK and executes the error process defined for it.
prompt This error process sends a notification to SYSADMIN to alert them of this issue, which they need to resolve.
prompt The query to determine these activities is very expensive as it joins 3 WF runtime tables and one WF design table.
prompt This is why the Workflow Background Engine should run seperately when load is not high and only once a week or month.<BR>
prompt <p>For more information refer to <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=453137.1"
prompt target="_blank">Note 453137.1</a> - Oracle Workflow Best Practices Release 12 and Release 11i<br>
prompt </td></tr></tbody></table><BR><BR>
REM
REM ******* Totals for Notification Preferences *******
REM
prompt <script type="text/javascript"> function displayRows2sql8a(){var row = document.getElementById("s2sql8a");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=1 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv125"></a>
prompt <B>Totals for Notification Preferences</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql8a()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql8a" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="2" height="50">
prompt <blockquote><p align="left">
prompt select notification_preference, count(name)<br>
prompt from wf_local_roles<br>
prompt group by notification_preference;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>NOTIFICATION PREFERENCE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||notification_preference||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(name),'999,999,999,999')||'</div></TD></TR>'
from wf_local_roles
group by notification_preference;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Totals for Notification Preferences *******
REM
prompt <script type="text/javascript"> function displayRows2sql8b(){var row = document.getElementById("s2sql8b");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=1 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv125"></a>
prompt <B>Totals for User Notification Preferences</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql8b()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql8b" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="2" height="50">
prompt <blockquote><p align="left">
prompt select notification_preference, count(name)<br>
prompt from wf_local_roles<br>
prompt where name not like 'FND_RESP%'<br>
prompt group by notification_preference;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>NOTIFICATION PREFERENCE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||notification_preference||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(name),'999,999,999,999')||'</div></TD></TR>'
from wf_local_roles
where name not like 'FND_RESP%'
group by notification_preference;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Check the Status of Workflow Services *******
REM
prompt <script type="text/javascript"> function displayRows2sql9(){var row = document.getElementById("s2sql9");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv126"></a>
prompt <B>Check the Status of Workflow Services</B></font></TD>
prompt <TD COLSPAN=2 bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows2sql9()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s2sql9" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="11" height="130">
prompt <blockquote><p align="left">
prompt select fcq.USER_CONCURRENT_QUEUE_NAME, fsc.COMPONENT_NAME,<br>
prompt DECODE(fcp.OS_PROCESS_ID,NULL,'Not Running',fcp.OS_PROCESS_ID), fcq.MAX_PROCESSES,<br>
prompt fcq.RUNNING_PROCESSES, v.PARAMETER_VALUE, fcq.ENABLED_FLAG, fsc.COMPONENT_ID,<br>
prompt fsc.CORRELATION_ID, fsc.STARTUP_MODE, fsc.COMPONENT_STATUS<br>
prompt from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs, <br>
prompt APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v<br>
prompt where v.COMPONENT_ID=fsc.COMPONENT_ID<br>
prompt and fcq.MANAGER_TYPE = fcs.SERVICE_ID <br>
prompt and fcs.SERVICE_HANDLE = 'FNDCPGSC' <br>
prompt and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)<br>
prompt and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)<br>
prompt and fcq.application_id = fcp.queue_application_id(+) <br>
prompt and fcp.process_status_code(+) = 'A'<br>
prompt and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'<br>
prompt order by fcp.OS_PROCESS_ID, fsc.STARTUP_MODE;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>CONTAINER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPONENT</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROCID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TARGET</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ACTUAL</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>#THREADS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ENABLED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPONENT_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>CORRELATION_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STARTUP_MODE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
select
'<TR><TD>'||fcq.USER_CONCURRENT_QUEUE_NAME||'</TD>'||chr(10)||
'<TD>'||fsc.COMPONENT_NAME||'</TD>'||chr(10)||
'<TD>'||DECODE(fcp.OS_PROCESS_ID,NULL,'Not Running',fcp.OS_PROCESS_ID)||'</TD>'||chr(10)||
'<TD>'||fcq.MAX_PROCESSES||'</TD>'||chr(10)||
'<TD>'||fcq.RUNNING_PROCESSES||'</TD>'||chr(10)||
'<TD>'||v.PARAMETER_VALUE||'</TD>'||chr(10)||
'<TD>'||fcq.ENABLED_FLAG||'</TD>'||chr(10)||
'<TD>'||fsc.COMPONENT_ID||'</TD>'||chr(10)||
'<TD>'||fsc.CORRELATION_ID||'</TD>'||chr(10)||
'<TD>'||fsc.STARTUP_MODE||'</TD>'||chr(10)||
'<TD>'||fsc.COMPONENT_STATUS||'</TD></TR>'
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
order by fcp.OS_PROCESS_ID, fsc.STARTUP_MODE;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* This is just a Note *******
REM
prompt <table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody>
prompt <tr>
prompt <td>
prompt <p>Note: For more information refer to <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=760386.1" target="_blank">
prompt Note 760386.1</a> - How to enable Bulk Notification Response Processing for Workflow in 11i and R12<br>
prompt </td>
prompt </tr>
prompt </tbody>
prompt </table><BR><BR>
REM ****************************************************************************************
REM ******* Section 3 : Workflow Footprint *******
REM ****************************************************************************************
prompt <a name="section3"></a><B><font size="+2">Workflow Footprint</font></B><BR><BR>
REM
REM ******* Check the Actual Table Size for Workflow *******
REM
begin
select round((blocks*8192/1024/1024),2) into :wfcmtphy
from dba_tables
where table_name = 'WF_COMMENTS'
and owner = 'APPLSYS';
select round((blocks*8192/1024/1024),2) into :wfdigphy
from dba_tables
where table_name = 'WF_DIG_SIGS'
and owner = 'APPLSYS';
select round((blocks*8192/1024/1024),2) into :wfitmphy
from dba_tables
where table_name = 'WF_ITEMS'
and owner = 'APPLSYS';
select round((blocks*8192/1024/1024),2) into :wiasphy
from dba_tables
where table_name = 'WF_ITEM_ACTIVITY_STATUSES'
and owner = 'APPLSYS';
select round((blocks*8192/1024/1024),2) into :wiashphy
from dba_tables
where table_name = 'WF_ITEM_ACTIVITY_STATUSES_H'
and owner = 'APPLSYS';
select round((blocks*8192/1024/1024),2) into :wfattrphy
from dba_tables
where table_name = 'WF_ITEM_ATTRIBUTE_VALUES'
and owner = 'APPLSYS';
select round((blocks*8192/1024/1024),2) into :wfntfphy
from dba_tables
where table_name = 'WF_NOTIFICATIONS'
and owner = 'APPLSYS';
select round((num_rows*AVG_ROW_LEN)/1024/1024,2) into :wfcmtphy2
from dba_tables
where table_name = 'WF_COMMENTS'
and owner = 'APPLSYS';
select round((num_rows*AVG_ROW_LEN)/1024/1024,2) into :wfdigphy2
from dba_tables
where table_name = 'WF_DIG_SIGS'
and owner = 'APPLSYS';
select round((num_rows*AVG_ROW_LEN)/1024/1024,2) into :wfitmphy2
from dba_tables
where table_name = 'WF_ITEMS'
and owner = 'APPLSYS';
select round((num_rows*AVG_ROW_LEN)/1024/1024,2) into :wiasphy2
from dba_tables
where table_name = 'WF_ITEM_ACTIVITY_STATUSES'
and owner = 'APPLSYS';
select round((num_rows*AVG_ROW_LEN)/1024/1024,2) into :wiashphy2
from dba_tables
where table_name = 'WF_ITEM_ACTIVITY_STATUSES_H'
and owner = 'APPLSYS';
select round((num_rows*AVG_ROW_LEN)/1024/1024,2) into :wfattrphy2
from dba_tables
where table_name = 'WF_ITEM_ATTRIBUTE_VALUES'
and owner = 'APPLSYS';
select round((num_rows*AVG_ROW_LEN)/1024/1024,2) into :wfntfphy2
from dba_tables
where table_name = 'WF_NOTIFICATIONS'
and owner = 'APPLSYS';
end;
/
prompt <img src="http://chart.apis.google.com/chart?chxl=0:|WF_NOTIFICATIONS|WF_ITEM_ATTRIBUTE_VALUES|WF_ITEM_ACTIVITY_STATUSES_H|WF_ITEM_ACTIVITY_STATUSES|WF_ITEMS|WF_DIG_SIGS|WF_COMMENTS\&chdl=Physical_Data|Logical_Data\&chxs=0,676767,11.5,0,lt,676767\&chxtc=0,5\&chxt=y,x\&chds=a\&chs=600x425\&chma=0,0,0,5\&chbh=20,5,10\&cht=bhg
begin
select '\&chd=t:'||:wfcmtphy||','||:wfdigphy||','||:wfitmphy||','||:wiasphy||','||:wiashphy||','||:wfattrphy||','||:wfntfphy||'\|'||:wfdigphy2||','||:wfitmphy2||','||:wiasphy2||','||:wiashphy2||','||:wfattrphy2||','||:wfntfphy2 into :test from dual;
dbms_output.put('\&chco=A2C180,3D7930');
dbms_output.put(''||:test||'');
dbms_output.put('\&chtt=Workflow+Runtime+Data+Tables" />');
dbms_output.put_line('<br><br>');
end;
/
begin
select sum(LOGICAL_TOTAL) into :logical_totals from (
select round(blocks*8192/1024/1024) as "LOGICAL_TOTAL"
from dba_tables
where table_name in ('WF_ITEMS','WF_ITEM_ACTIVITY_STATUSES','WF_ITEM_ACTIVITY_STATUSES_H',
'WF_ITEM_ATTRIBUTE_VALUES','WF_NOTIFICATIONS','WF_COMMENTS','WF_DIG_SIGS')
and owner = 'APPLSYS' );
select sum(PHYSICAL_TOTAL) into :physical_totals from (
select round((num_rows*AVG_ROW_LEN)/1024/1024) as "PHYSICAL_TOTAL"
from dba_tables
where table_name in ('WF_ITEMS','WF_ITEM_ACTIVITY_STATUSES','WF_ITEM_ACTIVITY_STATUSES_H',
'WF_ITEM_ATTRIBUTE_VALUES','WF_NOTIFICATIONS','WF_COMMENTS','WF_DIG_SIGS')
and owner = 'APPLSYS' );
select sum(TOTAL_DIFF) into :diff_totals from (
select round((blocks*8192/1024/1024)-(num_rows*AVG_ROW_LEN)/1024/1024) as "TOTAL_DIFF"
from dba_tables
where table_name in ('WF_ITEMS','WF_ITEM_ACTIVITY_STATUSES','WF_ITEM_ACTIVITY_STATUSES_H',
'WF_ITEM_ATTRIBUTE_VALUES','WF_NOTIFICATIONS','WF_COMMENTS','WF_DIG_SIGS')
and owner = 'APPLSYS' );
select ROUND(:diff_totals/:logical_totals,2)*100 into :rate from dual;
select sum(COUNT) into :ninety_totals from (
select
to_char(wi.begin_date, 'YYYY') BEGAN,
to_char(count(wi.item_key)) COUNT
from wf_items wi, wf_item_types wit, wf_item_types_tl witt
where wi.ITEM_TYPE=wit.NAME and wi.end_date is null
and wit.NAME=witt.NAME and witt.LANGUAGE = 'US' and wi.begin_date < sysdate-90
group by to_char(wi.begin_date, 'YYYY')
order by to_char(wi.begin_date, 'YYYY'));
if (:rate>29) then
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<B>Warning</B><BR>');
dbms_output.put_line('The Workflow Runtime Tables logical space which is used for all full-table scans is ' || :rate || '% greater than the physical or actual tablespace being used.<BR>');
dbms_output.put_line('It is recommended to have a DBA resize these tables to reset the HighWater Mark.<BR>');
dbms_output.put_line('There are several ways to coalesce, drop, recreate these workflow runtime tables.<BR><BR> ');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=388672.1" target="_blank">Note 388672.1</a> - How to Reorganize Workflow Tables, for more details on ways to do this.');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
else
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<B>Attention</B><BR>');
dbms_output.put_line('The Workflow Runtime Tables logical space which is used for all full-table scans is only at ' || :rate || '% greater than the physical or actual tablespace being used.<BR>');
dbms_output.put_line('It is recommended at levels above 30% to resize these tables to maintain or reset the table HighWater Mark for optimum performance.<br> Please have a DBA monitor these tables going forward to ensure they are being maintained at optimal levels.<BR><BR>');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=388672.1" target="_blank">Note 388672.1</a> - How to Reorganize Workflow Tables, on how to manage workflow runtime tablespaces for optimal performance.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
end if;
end;
/
prompt <script type="text/javascript"> function displayRows3sql1(){var row = document.getElementById("s3sql1");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=3 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv131"></a>
prompt <B>Volume of Workflow Runtime Data Tables (in MegaBytes)</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows3sql1()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s3sql1" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="4" height="130">
prompt <blockquote><p align="left">
prompt select table_name, <br>
prompt round(blocks*8192/1024/1024) "MB Logical", <br>
prompt round((num_rows*AVG_ROW_LEN)/1024/1024) "MB Physical", <br>
prompt round((blocks*8192/1024/1024) - <br>
prompt (num_rows*AVG_ROW_LEN)/1024/1024) "MB Difference"<br>
prompt from dba_tables <br>
prompt where table_name in ('WF_ITEMS','WF_ITEM_ACTIVITY_STATUSES',<br>
prompt 'WF_ITEM_ACTIVITY_STATUSES_H','WF_ITEM_ATTRIBUTE_VALUES',<br>
prompt 'WF_NOTIFICATIONS','WF_COMMENTS','WF_DIG_SIGS')<br>
prompt and owner = 'APPLSYS'<br>
prompt order by table_name;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>Workflow Table Name</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>Logical Table Size</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>Physical Table Data</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>Difference</B></TD></TR>
select
'<TR><TD>'||table_name||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(round(blocks*8192/1024/1024),'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD><div align="right">'||to_char(round((num_rows*AVG_ROW_LEN)/1024/1024),'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD><div align="right">'||to_char(round((blocks*8192/1024/1024)-(num_rows*AVG_ROW_LEN)/1024/1024),'999,999,999,999')||'</div></TD></TR>'
from dba_tables
where table_name in ('WF_ITEMS','WF_ITEM_ACTIVITY_STATUSES','WF_ITEM_ACTIVITY_STATUSES_H',
'WF_ITEM_ATTRIBUTE_VALUES','WF_NOTIFICATIONS','WF_COMMENTS','WF_DIG_SIGS')
and owner='APPLSYS'
order by table_name;
prompt <TR><TD BGCOLOR=#DEE6EF align="right"><font face="Calibri"><B>TOTALS</B></TD>
prompt <TD BGCOLOR=#DEE6EF align="right"><font face="Calibri">
print :logical_totals
prompt </TD>
prompt <TD BGCOLOR=#DEE6EF align="right"><font face="Calibri">
print :physical_totals
prompt </TD>
prompt <TD BGCOLOR=#DEE6EF align="right"><font face="Calibri">
print :diff_totals
prompt </TD></TD></TR>
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Verify Closed and Purgeable TEMP Items *******
REM
prompt <script type="text/javascript"> function displayRows3sql2(){var row = document.getElementById("s3sql2");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=4 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv132"></a>
prompt <B>Verify Closed and Purgeable TEMP Items</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows3sql2()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s3sql2" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="5" height="130">
prompt <blockquote><p align="left">
prompt select COUNT(A.ITEM_KEY), WF_PURGE.GETPURGEABLECOUNT(A.ITEM_TYPE),<br>
prompt A.ITEM_TYPE, b.DISPLAY_NAME, b.PERSISTENCE_DAYS<br>
prompt FROM WF_ITEMS A, WF_ITEM_TYPES_VL B<br>
prompt WHERE A.ITEM_TYPE = B.NAME<br>
prompt and b.PERSISTENCE_TYPE = 'TEMP'<br>
prompt and a.END_DATE is not null<br>
prompt GROUP BY A.ITEM_TYPE, b.DISPLAY_NAME, b.PERSISTENCE_DAYS<br>
prompt order by 1 desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>CLOSED ITEMS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PURGEABLE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ITEM TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DISPLAY NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PERSISTENCE DAYS</B></TD>
select
'<TR><TD><div align="right">'||to_char(COUNT(A.ITEM_KEY),'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD><div align="left">'||to_char(WF_PURGE.GETPURGEABLECOUNT(A.ITEM_TYPE),'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD>'||A.ITEM_TYPE||'</TD>'||chr(10)||
'<TD>'||b.DISPLAY_NAME||'</TD>'||chr(10)||
'<TD>'||b.PERSISTENCE_DAYS||'</TD></TR>'
FROM WF_ITEMS A, WF_ITEM_TYPES_VL B
WHERE A.ITEM_TYPE = B.NAME
and b.PERSISTENCE_TYPE = 'TEMP'
and a.END_DATE is not null
GROUP BY A.ITEM_TYPE, b.DISPLAY_NAME, b.PERSISTENCE_DAYS
order by 1 desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
prompt <table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody><tr><td>
prompt If there are closed items that are not purgeable, then it may be because an associated child process is still open.<BR>
prompt To verify all the workflow processes (item_keys) that are associated to a single workflow, run the bde_wf_process_tree.sql<BR>
prompt script found in <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1378954.1" target="_blank">Document 1378954.1</a> - bde_wf_process_tree.sql - For analyzing the Root Parent, Children, Grandchildren Associations of a Single Workflow Process<BR>
prompt </p></td></tr></tbody></table><BR>
prompt <table border="1" name="Notebox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody><tr><td>
prompt Post 11i.ATG.rup4+ are 3 new Concurrent Programs designed to gather Workflow Statistics that is displayed in Oracle Manager Workflow Metrics screens.<BR>
prompt These Concurrent Programs are set to run automatically every 24 hrs by default to refresh these workflow runtime table statistics.<BR>
prompt <B> - Workflow Agent Activity Statistics (FNDWFAASTATCC)</B> - Gathers statistics for the Agent Activity graph in the Workflow System status page and for the agent activity list in the Agent Activity page.<BR>
prompt <B> - Workflow Mailer Statistics (FNDWFMLRSTATCC)</B> - Gathers statistics for the throughput graph in the Notification Mailer Throughput page.<BR>
prompt <B> - Workflow Work Items Statistics (FNDWFWITSTATCC)</B> - Gathers statistics for the Work Items graph in the Workflow System status page, for
prompt the Completed Work Items list in the Workflow Purge page, and for the work item lists in the Active Work Items, Deferred Work Items, Suspended Work Items, and Errored Work Items pages.<BR>
prompt If the list above does not match the list below, then please run these Workflow Statistics requests again.<BR>
prompt </p></td></tr></tbody></table><BR><BR>
REM
REM ******* WF_ITEM_TYPES *******
REM
prompt <script type="text/javascript"> function displayRows3sql3(){var row = document.getElementById("s3sql3");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfsummry"></a>
prompt <B>SUMMARY Of Workflow Processes By Item Type</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows3sql3()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s3sql3" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="10" height="150">
prompt <blockquote><p align="left">
prompt select NUM_ACTIVE, NUM_COMPLETE, NUM_PURGEABLE, WIT.NAME, DISPLAY_NAME, <br>
prompt PERSISTENCE_TYPE, PERSISTENCE_DAYS, NUM_ERROR, NUM_DEFER, NUM_SUSPEND<br>
prompt from wf_item_types wit, wf_item_types_tl wtl<br>
prompt where wit.name like ('%')<br>
prompt AND wtl.name = wit.name<br>
prompt AND wtl.language = userenv('LANG')<br>
prompt AND wit.NUM_ACTIVE is not NULL<br>
prompt AND wit.NUM_ACTIVE <>0 <br>
prompt order by PERSISTENCE_TYPE, NUM_COMPLETE desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ACTIVE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPLETED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PURGEABLE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ITEM_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DISPLAY_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PERSISTENCE_TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PERSISTENCE_DAYS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ERRORED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DEFERRED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>SUSPENDED</B></TD>
select
'<TR><TD><div align="right">'||to_char(NUM_ACTIVE,'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD><div align="right">'||to_char(NUM_COMPLETE,'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD><div align="left">'||to_char(NUM_PURGEABLE,'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD><div align="left">'||WIT.NAME||'</div></TD>'||chr(10)||
'<TD><div align="left">'||DISPLAY_NAME||'</div></TD>'||chr(10)||
'<TD><div align="center">'||PERSISTENCE_TYPE||'</div></TD>'||chr(10)||
'<TD><div align="center">'||PERSISTENCE_DAYS||'</div></TD>'||chr(10)||
'<TD><div align="right">'||to_char(NUM_ERROR,'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD><div align="right">'||to_char(NUM_DEFER,'999,999,999,999')||'</div></TD>'||chr(10)||
'<TD><div align="right">'||to_char(NUM_SUSPEND,'999,999,999,999')||'</div></TD></TR>'
from wf_item_types wit, wf_item_types_tl wtl
where wit.name like ('%')
AND wtl.name = wit.name
AND wtl.language = userenv('LANG')
AND wit.NUM_ACTIVE is not NULL
AND wit.NUM_ACTIVE <>0
order by PERSISTENCE_TYPE, NUM_COMPLETE desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Check the Volume of Open and Closed Items Annually *******
REM
prompt <script type="text/javascript"> function displayRows3sql4(){var row = document.getElementById("s3sql4");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=5 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv133"></a>
prompt <B>Check the Volume of Open and Closed Items Annually</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows3sql4()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s3sql4" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="6" height="135">
prompt <blockquote><p align="left">
prompt select wi.item_type, witt.DISPLAY_NAME, wit.PERSISTENCE_TYPE,<br>
prompt nvl(wit.PERSISTENCE_DAYS,0), nvl(to_char(wi.end_date, 'YYYY'),'OPEN'), count(wi.item_key)<br>
prompt from wf_items wi, wf_item_types wit, wf_item_types_tl witt where wi.ITEM_TYPE=wit.NAME <br>
prompt and wit.NAME=witt.NAME and witt.LANGUAGE = 'US'<br>
prompt group by wi.item_type, witt.DISPLAY_NAME, wit.PERSISTENCE_TYPE, <br>
prompt wit.PERSISTENCE_DAYS, to_char(wi.end_date, 'YYYY')<br>
prompt order by wit.PERSISTENCE_TYPE asc, nvl(to_char(wi.end_date, 'YYYY'),'OPEN') asc, count(wi.item_key) desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ITEM_TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DISPLAY_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PERSISTENCE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>P_DAYS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>CLOSED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||wi.item_type||'</TD>'||chr(10)||
'<TD>'||witt.DISPLAY_NAME||'</TD>'||chr(10)||
'<TD>'||wit.PERSISTENCE_TYPE||'</TD>'||chr(10)||
'<TD>'||nvl(wit.PERSISTENCE_DAYS,0)||'</TD>'||chr(10)||
'<TD>'||nvl(to_char(wi.end_date, 'YYYY'),'OPEN')||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(wi.item_key),'999,999,999,999')||'</div></TD></TR>'
from wf_items wi, wf_item_types wit, wf_item_types_tl witt where wi.ITEM_TYPE=wit.NAME and wit.NAME=witt.NAME and witt.LANGUAGE = 'US'
group by wi.item_type, witt.DISPLAY_NAME, wit.PERSISTENCE_TYPE,
wit.PERSISTENCE_DAYS, to_char(wi.end_date, 'YYYY')
order by wit.PERSISTENCE_TYPE asc, nvl(to_char(wi.end_date, 'YYYY'),'OPEN') asc, count(wi.item_key) desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Average Volume of Opened Items in the past 6 Months, Monthly, & Daily *******
REM
prompt <script type="text/javascript"> function displayRows3sql5(){var row = document.getElementById("s3sql5");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=3 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv134"></a>
prompt <B>Average Volume of Opened Items in the past 6 Months, Monthly, and Daily</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows3sql5()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s3sql5" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="4" height="85">
prompt <blockquote><p align="left">
prompt select item_type, count(item_key), <br>
prompt to_char(round(count(item_key)/6,0),'999,999,999,999'), to_char(round(count(item_key)/180,0),'999,999,999,999')<br>
prompt from wf_items<br>
prompt where begin_date > sysdate-180<br>
prompt group by item_type<br>
prompt order by count(item_key) desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ITEM_TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>6_MONTHS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MONTHLY</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>DAILY</B></TD>
select
'<TR><TD>'||item_type||'</TD>'||chr(10)||
'<TD>'||to_char(count(item_key),'999,999,999,999')||'</TD>'||chr(10)||
'<TD>'||to_char(round(count(item_key)/6,0),'999,999,999,999')||'</TD>'||chr(10)||
'<TD>'||to_char(round(count(item_key)/180,0),'999,999,999,999')||'</TD></TR>'
from wf_items
where begin_date > sysdate-180
group by item_type
order by count(item_key) desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Opened Over 90 Days Ago *******
REM
prompt <script type="text/javascript"> function displayRows3sql6(){var row = document.getElementById("s3sql6");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=1 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv135"></a>
prompt <B>Total OPEN Items Started Over 90 Days Ago</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows3sql6()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s3sql6" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="2" height="55">
prompt <blockquote><p align="left">
prompt select to_char(wi.begin_date, 'YYYY'), count(wi.item_key)<br>
prompt from wf_items wi, wf_item_types wit, wf_item_types_tl witt<br>
prompt where wi.ITEM_TYPE=wit.NAME and wi.end_date is null <br>
prompt and wit.NAME=witt.NAME and witt.LANGUAGE = 'US' and wi.begin_date < sysdate-90 <br>
prompt group by to_char(wi.begin_date, 'YYYY') <br>
prompt order by to_char(wi.begin_date, 'YYYY');</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>OPENED</B></font></TD>
prompt <TD BGCOLOR=#DEE6EF><div align="right"><font face="Calibri"><B>COUNT</B></font></div></TD>
select
'<TR><TD>'||to_char(wi.begin_date, 'YYYY')||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(wi.item_key),'999,999,999,999')||'</div></TD></TR>'
from wf_items wi, wf_item_types wit, wf_item_types_tl witt
where wi.ITEM_TYPE=wit.NAME and wi.end_date is null
and wit.NAME=witt.NAME and witt.LANGUAGE = 'US' and wi.begin_date < sysdate-90
group by to_char(wi.begin_date, 'YYYY')
order by to_char(wi.begin_date, 'YYYY');
prompt <TR><TD BGCOLOR=#DEE6EF align="right"><font face="Calibri"><B>TOTALS</B></TD>
prompt <TD BGCOLOR=#DEE6EF align="right"><font face="Calibri">
print :ninety_totals
prompt </TD></TR>
prompt </TABLE><P><P>
begin
select sum(COUNT) into :ninety_cnt from (
select to_char(wi.begin_date, 'YYYY') TOTAL_OPENED, count(wi.item_key) COUNT
from wf_items wi, wf_item_types wit, wf_item_types_tl witt
where wi.ITEM_TYPE=wit.NAME and wi.end_date is null
and wit.NAME=witt.NAME and witt.LANGUAGE = 'US' and wi.begin_date < (sysdate-90)
group by to_char(wi.begin_date, 'YYYY') );
if (:ninety_cnt = 0) then
dbms_output.put_line('There are no OPEN items that were started over 90 days ago.<BR>');
else if (:ninety_cnt > 0) then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Warning</B><BR>');
dbms_output.put_line('There are ' || to_char(:ninety_cnt,'999,999,999,999') || ' OPEN item_types in WF_ITEMS table that were started over 90 days ago.<BR>');
dbms_output.put_line('Remember that once a Workflow is closed, its runtime data which is stored in Workflow Runtime Tables (WF_*) becomes obsolete.<BR>');
dbms_output.put_line('All pertinent information is stored in the functional tables (FND_*, PO_*, AP_*, HR_*, OE_*, etc), like who approved what, for how much, for whom, etc...)');
dbms_output.put_line('and that each single row in WF_ITEMS can represent 100s or 1000s of rows in the subsequent Workflow Runtime tables, ');
dbms_output.put_line('so it is important to close these open workflows once completed so they can be purged.<BR>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('Ask the Question: How long should these workflows take to complete?<BR>');
dbms_output.put_line('30 Days... 60 Days... 6 months... 1 Year?<BR>');
dbms_output.put_line('There may be valid business reasons why these OPEN items still exist after 90 days so that should be taken into consideration.<BR>');
dbms_output.put_line('However, if this is not the case, then once a workflow item is closed then all the runtime data associated to completing this workflow is now obsolete and should be purged to make room for new workflows.<BR>');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=144806.1" target="_blank">Note 144806.1</a> - A Detailed Approach To Purging Oracle Workflow Runtime Data ');
dbms_output.put_line('for details on how to drill down to discover the reason why these OLD items are still open, and ways to close them so they can be purged.');
dbms_output.put_line('</p></td></tr></tbody></table><BR><BR>');
end if;
end if;
end;
/
prompt <table border="1" name="Notebox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody><tr><td>
prompt It is normal for Workflow to use WAITS and other looping acitivities to process delayed responses and other criteria.<BR>
prompt Each revisit of a node replaces the previous data with the current activities status and stores the old activity information into a activities history table.<BR>
prompt Looking at this history table (WF_ITEM_ACTIVITY_STATUSES_H) can help to identify possible long running workflows that appear to be stuck in a loop over a long time, or a poorly designed workflow that is looping excessively and can cause performance issues.<BR>
prompt </p></td></tr></tbody></table><BR>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Check Top 30 Large Item Activity Status History Items *******
REM
prompt <script type="text/javascript"> function displayRows3sql7(){var row = document.getElementById("s3sql7");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=5 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv136"></a>
prompt <B>Check Top 30 Large Item Activity Status History Items</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows3sql7()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s3sql7" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="6" height="125">
prompt <blockquote><p align="left">
prompt SELECT sta.item_type, sta.item_key, COUNT(*),<br>
prompt TO_CHAR(wfi.begin_date, 'YYYY-MM-DD'), TO_CHAR(wfi.end_date, 'YYYY-MM-DD'), wfi.user_key<br>
prompt FROM wf_item_activity_statuses_h sta, <br>
prompt wf_items wfi WHERE sta.item_type = wfi.item_type AND sta.item_key = wfi.item_key AND wfi.item_type LIKE '%' <br>
prompt GROUP BY sta.item_type, sta.item_key, wfi.USER_KEY, TO_CHAR(wfi.begin_date, 'YYYY-MM-DD'), <br>
prompt TO_CHAR(wfi.end_date, 'YYYY-MM-DD') <br>
prompt HAVING COUNT(*) > 500 <br>
prompt ORDER BY COUNT(*) DESC);</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri">ITEM_TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri">ITEM_KEY</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri">COUNT</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri">BEGIN_DATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri">END_DATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri">DESCRIPTION</B></TD>
SELECT * FROM (SELECT
'<TR><TD>'||sta.item_type||'</TD>'||chr(10)||
'<TD>'||sta.item_key||'</TD>'||chr(10)||
'<TD>'||to_char(COUNT(*),'999,999,999,999')||'</TD>'||chr(10)||
'<TD>'||TO_CHAR(wfi.begin_date, 'YYYY-MM-DD')||'</TD>'||chr(10)||
'<TD>'||TO_CHAR(wfi.end_date, 'YYYY-MM-DD')||'</TD>'||chr(10)||
'<TD>'||wfi.user_key||'</TD></TR>'
FROM wf_item_activity_statuses_h sta,
wf_items wfi WHERE sta.item_type = wfi.item_type AND sta.item_key = wfi.item_key AND wfi.item_type LIKE '%'
GROUP BY sta.item_type, sta.item_key, wfi.USER_KEY, TO_CHAR(wfi.begin_date, 'YYYY-MM-DD'), TO_CHAR(wfi.end_date, 'YYYY-MM-DD')
HAVING COUNT(*) > 500
ORDER BY COUNT(*) DESC)
WHERE ROWNUM < 31;
prompt</TABLE><P><P>
begin
SELECT count(*) into :hasrows FROM (SELECT sta.item_type
FROM wf_item_activity_statuses_h sta,
wf_items wfi WHERE sta.item_type = wfi.item_type AND sta.item_key = wfi.item_key AND wfi.item_type LIKE '%'
GROUP BY sta.item_type, sta.item_key, wfi.USER_KEY, TO_CHAR(wfi.begin_date, 'YYYY-MM-DD'), TO_CHAR(wfi.end_date, 'YYYY-MM-DD')
HAVING COUNT(*) > 500
ORDER BY COUNT(*) DESC);
if (:hasrows>0) then
dbms_output.put_line('<table border="1" name="Success" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('Rows are found in the HISTORY table');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
SELECT * into :hist_item FROM (SELECT sta.item_type
FROM wf_item_activity_statuses_h sta,
wf_items wfi WHERE sta.item_type = wfi.item_type AND sta.item_key = wfi.item_key AND wfi.item_type LIKE '%'
GROUP BY sta.item_type, sta.item_key, wfi.USER_KEY, TO_CHAR(wfi.begin_date, 'YYYY-MM-DD'), TO_CHAR(wfi.end_date, 'YYYY-MM-DD')
HAVING COUNT(*) > 500
ORDER BY COUNT(*) DESC)
WHERE ROWNUM = 1;
select * into :hist_key from (SELECT sta.item_key
FROM wf_item_activity_statuses_h sta,
wf_items wfi WHERE sta.item_type = wfi.item_type AND sta.item_key = wfi.item_key AND wfi.item_type LIKE '%'
GROUP BY sta.item_type, sta.item_key, wfi.USER_KEY, TO_CHAR(wfi.begin_date, 'YYYY-MM-DD'), TO_CHAR(wfi.end_date, 'YYYY-MM-DD')
HAVING COUNT(*) > 500
ORDER BY COUNT(*) DESC)
WHERE ROWNUM = 1;
SELECT * into :hist_end
FROM (SELECT end_date from wf_items where item_type = :hist_item and item_key = :hist_key);
SELECT * into :hist_cnt FROM (SELECT count(sta.item_key)
FROM wf_item_activity_statuses_h sta,
wf_items wfi WHERE sta.item_type = wfi.item_type AND sta.item_key = wfi.item_key AND wfi.item_type LIKE '%'
GROUP BY sta.item_type, sta.item_key, wfi.USER_KEY, TO_CHAR(wfi.begin_date, 'YYYY-MM-DD'), TO_CHAR(wfi.end_date, 'YYYY-MM-DD')
HAVING COUNT(*) > 500
ORDER BY COUNT(*) DESC)
WHERE ROWNUM = 1;
SELECT * into :hist_begin
FROM (SELECT to_char(begin_date, 'Mon DD, YYYY') from wf_items where item_type = :hist_item and item_key = :hist_key);
select * into :hist_recent
FROM (SELECT to_char(max(begin_date),'Mon DD, YYYY') from wf_item_activity_statuses_h
where item_type = :hist_item and item_key = :hist_key);
select sysdate into :sysdate from dual;
select * into :hist_days
from (select round(sysdate-begin_date,0) from wf_items where item_type = :hist_item and item_key = :hist_key);
select ROUND((:hist_cnt/:hist_days),0) into :hist_daily from dual;
if (:hist_end is null) then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('Currently, the largest single activity found in the history table is for <br> item_type : ' || :hist_item || '<br> item_key : ' || :hist_key || '<BR><BR> ');
dbms_output.put_line('<B>Warning</B><BR>');
dbms_output.put_line('This workflow process is still open, so this may be a problem. It was started back on ' || :hist_begin || ', and has ');
dbms_output.put_line('most recently looped thru its process on ' || :hist_recent || '.<BR>');
else
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('Currently, the largest single activity found in the history table is for Item_Type ' || :hist_item || ' and item_key ' || :hist_key || '<BR><BR> ');
dbms_output.put_line('<B>Warning</B><BR>');
dbms_output.put_line('This process has been closed since ' || :hist_end || '.<BR>');
end if;
dbms_output.put_line('So far this one activity for item_type ' || :hist_item || ' and item_key ' || :hist_key || ' has looped ' || to_char(:hist_cnt,'999,999,999,999') || ' times since it started in ' || :hist_begin || '.<BR>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('This is a good place to start, as this single activity has been looping for ' || to_char(:hist_days,'999,999') || ' days, which is about ' || to_char(:hist_daily,'999,999') || ' times a day.<BR>');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=144806.1" target="_blank">');
dbms_output.put_line('Note 144806.1</a> - A Detailed Approach To Purging Oracle Workflow Runtime Data on how to drill down and discover how to purge this workflow data.<br>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
elsif (:hasrows=0) then
dbms_output.put_line('<table border="1" name="GoodJob" cellpadding="10" bordercolor="#C1A90D" bgcolor="#D7E8B0" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<B>Well Done !!</B><BR><BR>');
dbms_output.put_line('There are NO ROWS found in the HISTORY table (wf_item_activity_statuses_h) that have over 500 rows associated to the same item_key.<BR>');
dbms_output.put_line('This is a good result, which means there is no major looping issues at this time.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
end if;
end;
/
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM ****************************************************************************************
REM ******* Section 4 : Workflow Concurrent Programs *******
REM ****************************************************************************************
prompt <a name="section4"></a><B><font size="+2">Workflow Concurrent Programs</font></B><BR><BR>
REM
REM ******* Verify Concurrent Programs Scheduled to Run *******
REM
prompt <p>Oracle Workflow requires several Concurrent Programs to be run to process, progress, cleanup, and purge workflow related information.<BR>
prompt This section verifies these required Workflow Concurrent Programs are scheduled as recommended. <BR>
prompt Note: This section is only looking at the scheduled jobs in FND_CONCURRENT_REQUESTS table. <BR>
prompt Jobs scheduled using other tools (DBMS_JOBS, CONSUB, or PL/SQL, etc) are not reflected here, so keep this in mind.<br>
prompt The following table displays Concurrent requests that HAVE run, regardless of how they were scheduled (DBMS_JOBS, CONSUB, or PL/SQL, etc)<BR>
prompt Keep in mind how often the Concurrent Requests Data is being purged.</p>
prompt <script type="text/javascript"> function displayRows4sql1(){var row = document.getElementById("s4sql1");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv141"></a>
prompt <B>Verify Workflow Concurrent Programs Scheduled to Run</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows4sql1()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s4sql1" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="10" height="185">
prompt <blockquote><p align="left">
prompt select r.REQUEST_ID, u.user_name, r.PHASE_CODE, r.ACTUAL_START_DATE,<br>
prompt c.CONCURRENT_PROGRAM_NAME, p.USER_CONCURRENT_PROGRAM_NAME, r.ARGUMENT_TEXT, <br>
prompt r.RESUBMIT_INTERVAL, r.RESUBMIT_INTERVAL_UNIT_CODE, r.RESUBMIT_END_DATE<br>
prompt FROM fnd_concurrent_requests r, FND_CONCURRENT_PROGRAMS_TL p, fnd_concurrent_programs c, fnd_user u <br>
prompt WHERE r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID and r.requested_by = u.user_id <br>
prompt and p.CONCURRENT_PROGRAM_ID = c.CONCURRENT_PROGRAM_ID <br>
prompt and c.CONCURRENT_PROGRAM_NAME in ('FNDWFBG','FNDWFPR','FNDWFRET','JTFRSWSN','FNDWFSYNCUR','FNDWFLSC', <br>
prompt 'FNDWFLIC','FNDWFDSURV','FNDCPPUR','FNDWFBES_CONTROL_QUEUE_CLEANUP','FNDWFAASTATCC','FNDWFMLRSTATCC','FNDWFWITSTATCC') <br>
prompt AND p.LANGUAGE = 'US' <br>
prompt and r.ACTUAL_COMPLETION_DATE is null and r.PHASE_CODE in ('P','R')<br>
prompt order by c.CONCURRENT_PROGRAM_NAME;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>REQUEST_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>REQUESTED_BY</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PHASE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STARTED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>INTERNAL NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROGRAM_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ARGUMENTS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>EVERY</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>SO_OFTEN</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>RESUBMIT_END_DATE</B></TD>
select
'<TR><TD>'||r.REQUEST_ID||'</TD>'||chr(10)||
'<TD>'||u.user_name||'</TD>'||chr(10)||
'<TD>'||r.PHASE_CODE||'</TD>'||chr(10)||
'<TD>'||r.ACTUAL_START_DATE||'</TD>'||chr(10)||
'<TD>'||c.CONCURRENT_PROGRAM_NAME||'</TD>'||chr(10)||
'<TD>'||p.USER_CONCURRENT_PROGRAM_NAME||'</TD>'||chr(10)||
'<TD>'||r.ARGUMENT_TEXT||'</TD>'||chr(10)||
'<TD>'||r.RESUBMIT_INTERVAL||'</TD>'||chr(10)||
'<TD>'||r.RESUBMIT_INTERVAL_UNIT_CODE||'</TD>'||chr(10)||
'<TD>'||r.RESUBMIT_END_DATE||'</TD></TR>'
FROM fnd_concurrent_requests r, FND_CONCURRENT_PROGRAMS_TL p, fnd_concurrent_programs c, fnd_user u
WHERE r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID and r.requested_by = u.user_id
and p.CONCURRENT_PROGRAM_ID = c.CONCURRENT_PROGRAM_ID
and c.CONCURRENT_PROGRAM_NAME in ('FNDWFBG','FNDWFPR','FNDWFRET','JTFRSWSN','FNDWFSYNCUR','FNDWFLSC',
'FNDWFLIC','FNDWFDSURV','FNDCPPUR','FNDWFBES_CONTROL_QUEUE_CLEANUP','FNDWFAASTATCC','FNDWFMLRSTATCC','FNDWFWITSTATCC')
AND p.LANGUAGE = 'US'
and r.ACTUAL_COMPLETION_DATE is null and r.PHASE_CODE in ('P','R')
order by c.CONCURRENT_PROGRAM_NAME;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Verify Workflow Background Processes Scheduled to Run *******
REM
prompt <table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody>
prompt <tr>
prompt <td>
prompt <p>The Workflow Administrator's Guide requires that there is at least one background engine that can process deferred activities, check for timed out activities, and identify stuck processes.<BR>
prompt At a minimum, there needs to be at least one background process that can handle both deferred and timed out activities in order to progress workflows.<BR>
prompt However, for performance reasons Oracle recommends running three separate background engines at different intervals.<BR>
prompt - Run a Background Process to handle only DEFERRED activities every 5 to 60 minutes.<BR>
prompt - Run a Background Process to handle only TIMED OUT activities every 1 to 24 hours as needed.<BR>
prompt - Run a Background Process to identify STUCK processes once a week to once a month, when the load on the system is low.<BR><BR>
prompt Please see <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=186361.1" target="_blank">Note 186361.1</a> - Workflow Background Process Performance Troubleshooting Guide for more information</p>
prompt </td>
prompt </tr>
prompt </tbody>
prompt </table><BR><BR>
prompt <script type="text/javascript"> function displayRows4sql2(){var row = document.getElementById("s4sql2");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv142"></a>
prompt <B>Verify Workflow Background Processes that ran</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows4sql2()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s4sql2" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="10" height="350">
prompt <blockquote><p align="left">
prompt select r.REQUEST_ID, u.user_name, p.USER_CONCURRENT_PROGRAM_NAME,<br>
prompt DECODE(r.STATUS_CODE, 'A','Waiting','B','B=Resuming','C','C=Normal',<br>
prompt 'D','D=Cancelled','E','E=Error','G','G=Warning',<br>
prompt 'H','H=On Hold','I','I=Normal','M','M=No Manager',<br>
prompt 'P','P=Scheduled','Q','Q=Standby','R','R=Normal',<br>
prompt 'S','S=Suspended','T','T=Terminating','U','U=Disabled',<br>
prompt 'W','W=Paused','X','X=Terminated','Z','Z=Waiting'),<br>
prompt DECODE(r.PHASE_CODE, 'C','Completed','I','I=Inactive','P','P=Pending','R','R=Running'),<br>
prompt r.ACTUAL_START_DATE,r.ACTUAL_COMPLETION_DATE,<br>
prompt ROUND((r.actual_completion_date - r.actual_start_date)*1440, 2),<br>
prompt FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)||':hrs '||<br>
prompt FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-<br>
prompt FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)||':Mins '||<br>
prompt ROUND((((r.actual_completion_date-r.actual_start_date)*24*60*60)-<br>
prompt FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600-<br>
prompt (FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-<br>
prompt FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)*60)))||':Secs', <br>
prompt r.ARGUMENT_TEXT<br>
prompt FROM fnd_concurrent_requests r, FND_CONCURRENT_PROGRAMS_TL p, fnd_concurrent_programs c, fnd_user u <br>
prompt WHERE r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID and r.requested_by = u.user_id <br>
prompt and p.CONCURRENT_PROGRAM_ID = c.CONCURRENT_PROGRAM_ID <br>
prompt and c.CONCURRENT_PROGRAM_NAME = 'FNDWFBG' <br>
prompt AND p.LANGUAGE = 'US' <br>
prompt and r.ACTUAL_COMPLETION_DATE is null and r.PHASE_CODE in ('P','R')<br>
prompt order by r.ACTUAL_START_DATE;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>REQUEST_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>USER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROGRAM</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PHASE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STARTED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPLETED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TOTAL_MINS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TIME_TO_RUN</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ARGUMENTS</B></TD>
select
'<TR><TD>'||r.REQUEST_ID||'</TD>'||chr(10)||
'<TD>'||u.user_name||'</TD>'||chr(10)||
'<TD>'||p.USER_CONCURRENT_PROGRAM_NAME||'</TD>'||chr(10)||
'<TD>'||DECODE(r.STATUS_CODE, 'A','Waiting','B','B=Resuming','C','C=Normal',
'D','D=Cancelled','E','E=Error','G','G=Warning',
'H','H=On Hold','I','I=Normal','M','M=No Manager',
'P','P=Scheduled','Q','Q=Standby','R','R=Normal',
'S','S=Suspended','T','T=Terminating','U','U=Disabled',
'W','W=Paused','X','X=Terminated','Z','Z=Waiting')||'</TD>'||chr(10)||
'<TD>'||DECODE(r.PHASE_CODE, 'C','Completed','I','I=Inactive','P','P=Pending','R','R=Running')||'</TD>'||chr(10)||
'<TD>'||r.ACTUAL_START_DATE||'</TD>'||chr(10)||
'<TD>'||r.ACTUAL_COMPLETION_DATE||'</TD>'||chr(10)||
'<TD>'||ROUND((r.actual_completion_date - r.actual_start_date)*1440, 2)||'</TD>'||chr(10)||
'<TD>'||FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)||':hrs '||
FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)||':Mins '||
ROUND((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600-(FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)*60)))||':Secs'||'</TD>'||chr(10)||
'<TD>'||r.ARGUMENT_TEXT||'</TD></TR>'
FROM fnd_concurrent_requests r, FND_CONCURRENT_PROGRAMS_TL p, fnd_concurrent_programs c, fnd_user u
WHERE r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID and r.requested_by = u.user_id
and p.CONCURRENT_PROGRAM_ID = c.CONCURRENT_PROGRAM_ID
and c.CONCURRENT_PROGRAM_NAME = 'FNDWFBG'
AND p.LANGUAGE = 'US'
and r.ACTUAL_COMPLETION_DATE is null
order by r.ACTUAL_START_DATE;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Verify Status of the Workflow Background Engine Deferred Queue Table *******
REM
prompt <script type="text/javascript"> function displayRows4sql3(){var row = document.getElementById("s4sql3");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=2 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv143"></a>
prompt <B>Verify Status of the Workflow Background Engine Deferred Queue Table</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows4sql3()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s4sql3" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="3" height="60">
prompt <blockquote><p align="left">
prompt select corr_id, msg_state, count(*)<br>
prompt from applsys.aq$wf_deferred_table_m<br>
prompt group by corr_id, msg_state<br>
prompt order by msg_state, count(*) desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>CORR_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||corr_id||'</TD>'||chr(10)||
'<TD>'||msg_state||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(*),'999,999,999,999')||'</div></TD></TR>'
from applsys.aq$wf_deferred_table_m
group by corr_id, msg_state
order by msg_state, count(*) desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Verify Workflow Purge Concurrent Programs *******
REM
prompt <script type="text/javascript"> function displayRows4sql4(){var row = document.getElementById("s4sql4");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv144"></a>
prompt <B>Verify Workflow Purge Concurrent Programs that have run</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows4sql4()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s4sql4" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="10" height="250">
prompt <blockquote><p align="left">
prompt select r.REQUEST_ID, u.user_name, p.USER_CONCURRENT_PROGRAM_NAME,<br>
prompt DECODE(r.STATUS_CODE, 'A','Waiting','B','B=Resuming','C','C=Normal',<br>
prompt 'D','D=Cancelled','E','E=Error','G','G=Warning',<br>
prompt 'H','H=On Hold','I','I=Normal','M','M=No Manager',<br>
prompt 'P','P=Scheduled','Q','Q=Standby','R','R=Normal',<br>
prompt 'S','S=Suspended','T','T=Terminating','U','U=Disabled',<br>
prompt 'W','W=Paused','X','X=Terminated','Z','Z=Waiting'),<br>
prompt DECODE(r.PHASE_CODE, 'C','Completed','I','I=Inactive','P','P=Pending','R','R=Running'),<br>
prompt r.ACTUAL_START_DATE,r.ACTUAL_COMPLETION_DATE,<br>
prompt ROUND((r.actual_completion_date - r.actual_start_date)*1440, 2),<br>
prompt FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)||':hrs '||<br>
prompt FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)||':Mins '||<br>
prompt ROUND((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600-(FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)*60)))||':Secs', <br>
prompt r.ARGUMENT_TEXT<br>
prompt FROM fnd_concurrent_requests r, FND_CONCURRENT_PROGRAMS_TL p, fnd_concurrent_programs c, fnd_user u <br>
prompt WHERE r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID and r.requested_by = u.user_id <br>
prompt and p.CONCURRENT_PROGRAM_ID = c.CONCURRENT_PROGRAM_ID <br>
prompt and c.CONCURRENT_PROGRAM_NAME = ('FNDWFPR') <br>
prompt AND p.LANGUAGE = 'US' <br>
prompt and r.ACTUAL_COMPLETION_DATE is null and r.PHASE_CODE in ('P','R')<br>
prompt order by r.ACTUAL_START_DATE;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>REQUEST_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>USER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROGRAM</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PHASE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STARTED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPLETED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TOTAL_MINS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TIME_TO_RUN</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ARGUMENTS</B></TD>
select
'<TR><TD>'||r.REQUEST_ID||'</TD>'||chr(10)||
'<TD>'||u.user_name||'</TD>'||chr(10)||
'<TD>'||p.USER_CONCURRENT_PROGRAM_NAME||'</TD>'||chr(10)||
'<TD>'||DECODE(r.STATUS_CODE, 'A','Waiting','B','B=Resuming','C','C=Normal',
'D','D=Cancelled','E','E=Error','G','G=Warning',
'H','H=On Hold','I','I=Normal','M','M=No Manager',
'P','P=Scheduled','Q','Q=Standby','R','R=Normal',
'S','S=Suspended','T','T=Terminating','U','U=Disabled',
'W','W=Paused','X','X=Terminated','Z','Z=Waiting')||'</TD>'||chr(10)||
'<TD>'||DECODE(r.PHASE_CODE, 'C','Completed','I','I=Inactive','P','P=Pending','R','R=Running')||'</TD>'||chr(10)||
'<TD>'||r.ACTUAL_START_DATE||'</TD>'||chr(10)||
'<TD>'||r.ACTUAL_COMPLETION_DATE||'</TD>'||chr(10)||
'<TD>'||ROUND((r.actual_completion_date - r.actual_start_date)*1440, 2)||'</TD>'||chr(10)||
'<TD>'||FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)||':hrs '||
FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)||':Mins '||
ROUND((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600-(FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)*60)))||':Secs'||'</TD>'||chr(10)||
'<TD>'||r.ARGUMENT_TEXT||'</TD></TR>'
FROM fnd_concurrent_requests r, FND_CONCURRENT_PROGRAMS_TL p, fnd_concurrent_programs c, fnd_user u
WHERE r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID and r.requested_by = u.user_id
and p.CONCURRENT_PROGRAM_ID = c.CONCURRENT_PROGRAM_ID
and c.CONCURRENT_PROGRAM_NAME = ('FNDWFPR')
AND p.LANGUAGE = 'US'
and r.ACTUAL_COMPLETION_DATE is null
order by r.ACTUAL_START_DATE;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
prompt <table border="1" name="Warning" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody><tr><td>
prompt Delivered in 11i.ATG.rup4+ are new Concurrent Programs designed to gather Workflow Statistics after running purge.<BR>
prompt These requests should automatically run every 24hrs by default, however they can be run anytime to refresh the workflow process tables after purging to confirm that the purgeable items were purged.<BR>
prompt <B> - Workflow Agent Activity Statistics (FNDWFAASTATCC)</B> - Gathers statistics for the Agent Activity graph in the Workflow System status page and for the agent activity list in the Agent Activity page.<BR>
prompt <B> - Workflow Mailer Statistics (FNDWFMLRSTATCC)</B> - Gathers statistics for the throughput graph in the Notification Mailer Throughput page.<BR>
prompt <B> - Workflow Work Items Statistics (FNDWFWITSTATCC)</B> - Gathers statistics for the Work Items graph in the Workflow System status page, for
prompt the Completed Work Items list in the Workflow Purge page, and for the work item lists in the Active Work Items, Deferred Work Items, Suspended Work Items, and Errored Work Items pages.<BR>
prompt </p></td></tr></tbody></table><BR><BR>
REM
REM ******* Verify Workflow Control Queue Cleanup Program *******
REM
prompt <script type="text/javascript"> function displayRows4sql5(){var row = document.getElementById("s4sql5");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv145"></a>
prompt <B>Verify Workflow Control Queue Cleanup requests that have run</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows4sql5()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s4sql5" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="10" height="250">
prompt <blockquote><p align="left">
prompt select r.REQUEST_ID, u.user_name, p.USER_CONCURRENT_PROGRAM_NAME,<br>
prompt DECODE(r.STATUS_CODE, 'A','Waiting','B','B=Resuming','C','C=Normal',<br>
prompt 'D','D=Cancelled','E','E=Error','G','G=Warning',<br>
prompt 'H','H=On Hold','I','I=Normal','M','M=No Manager',<br>
prompt 'P','P=Scheduled','Q','Q=Standby','R','R=Normal',<br>
prompt 'S','S=Suspended','T','T=Terminating','U','U=Disabled',<br>
prompt 'W','W=Paused','X','X=Terminated','Z','Z=Waiting'),<br>
prompt DECODE(r.PHASE_CODE, 'C','Completed','I','I=Inactive','P','P=Pending','R','R=Running'),<br>
prompt r.ACTUAL_START_DATE,r.ACTUAL_COMPLETION_DATE,<br>
prompt ROUND((r.actual_completion_date - r.actual_start_date)*1440, 2),<br>
prompt FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)||':hrs '||<br>
prompt FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)||':Mins '||<br>
prompt ROUND((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600-(FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)*60)))||':Secs', <br>
prompt r.ARGUMENT_TEXT<br>
prompt FROM fnd_concurrent_requests r, FND_CONCURRENT_PROGRAMS_TL p, fnd_concurrent_programs c, fnd_user u <br>
prompt WHERE r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID and r.requested_by = u.user_id <br>
prompt and p.CONCURRENT_PROGRAM_ID = c.CONCURRENT_PROGRAM_ID <br>
prompt and c.CONCURRENT_PROGRAM_NAME = ('FNDWFBES_CONTROL_QUEUE_CLEANUP') <br>
prompt AND p.LANGUAGE = 'US' <br>
prompt and r.ACTUAL_COMPLETION_DATE is null and r.PHASE_CODE in ('P','R')<br>
prompt order by r.ACTUAL_START_DATE;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>REQUEST_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>USER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROGRAM</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PHASE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STARTED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPLETED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TOTAL_MINS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TIME_TO_RUN</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ARGUMENTS</B></TD>
select
'<TR><TD>'||r.REQUEST_ID||'</TD>'||chr(10)||
'<TD>'||u.user_name||'</TD>'||chr(10)||
'<TD>'||p.USER_CONCURRENT_PROGRAM_NAME||'</TD>'||chr(10)||
'<TD>'||DECODE(r.STATUS_CODE, 'A','Waiting','B','B=Resuming','C','C=Normal',
'D','D=Cancelled','E','E=Error','G','G=Warning',
'H','H=On Hold','I','I=Normal','M','M=No Manager',
'P','P=Scheduled','Q','Q=Standby','R','R=Normal',
'S','S=Suspended','T','T=Terminating','U','U=Disabled',
'W','W=Paused','X','X=Terminated','Z','Z=Waiting')||'</TD>'||chr(10)||
'<TD>'||DECODE(r.PHASE_CODE, 'C','Completed','I','I=Inactive','P','P=Pending','R','R=Running')||'</TD>'||chr(10)||
'<TD>'||r.ACTUAL_START_DATE||'</TD>'||chr(10)||
'<TD>'||r.ACTUAL_COMPLETION_DATE||'</TD>'||chr(10)||
'<TD>'||ROUND((r.actual_completion_date - r.actual_start_date)*1440, 2)||'</TD>'||chr(10)||
'<TD>'||FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)||':hrs '||
FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)||':Mins '||
ROUND((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600-(FLOOR((((r.actual_completion_date-r.actual_start_date)*24*60*60)-FLOOR(((r.actual_completion_date-r.actual_start_date)*24*60*60)/3600)*3600)/60)*60)))||':Secs'||'</TD>'||chr(10)||
'<TD>'||r.ARGUMENT_TEXT||'</TD></TR>'
FROM fnd_concurrent_requests r, FND_CONCURRENT_PROGRAMS_TL p, fnd_concurrent_programs c, fnd_user u
WHERE r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID and r.requested_by = u.user_id
and p.CONCURRENT_PROGRAM_ID = c.CONCURRENT_PROGRAM_ID
and c.CONCURRENT_PROGRAM_NAME = ('FNDWFBES_CONTROL_QUEUE_CLEANUP')
AND p.LANGUAGE = 'US'
and r.ACTUAL_COMPLETION_DATE is null and r.PHASE_CODE in ('P','R')
order by r.ACTUAL_START_DATE;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
prompt <table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody>
prompt <tr>
prompt <td>
prompt <p>The Workflow Control Queue Cleanup concurrent program is a seeded request that is automatically scheduled to be run every 12 hours by default.<BR>
prompt Oracle recommends that this frequency not be changed.<BR><BR>
prompt Please see <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=453137.1" target="_blank">Note 453137.1</a> - Oracle Workflow Best Practices Release 12 and Release 11i</p>
prompt </td>
prompt </tr>
prompt </tbody>
prompt </table><BR><BR>
REM ****************************************************************************************
REM ******* Section 5 : Workflow Notification Mailer *******
REM ****************************************************************************************
prompt <a name="section5"></a><B><font size="+2">Workflow Notification Mailer</font></B><BR><BR>
REM
REM ******* Check the Status of Workflow Services *******
REM
prompt <script type="text/javascript"> function displayRows5sql2(){var row = document.getElementById("s5sql2");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=9 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv151"></a>
prompt <B>Check the Status of Workflow Services</B></font></TD>
prompt <TD COLSPAN=2 bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows5sql2()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s5sql2" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="11" height="253">
prompt <blockquote><p align="left">
prompt select fcq.USER_CONCURRENT_QUEUE_NAME, fsc.COMPONENT_NAME,<br>
prompt DECODE(fcp.OS_PROCESS_ID,NULL,'Not Running',fcp.OS_PROCESS_ID), <br>
prompt fcq.MAX_PROCESSES, fcq.RUNNING_PROCESSES, v.PARAMETER_VALUE,<br>
prompt fcq.ENABLED_FLAG, fsc.COMPONENT_ID, fsc.CORRELATION_ID,<br>
prompt fsc.STARTUP_MODE, fsc.COMPONENT_STATUS<br>
prompt from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs, <br>
prompt APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v<br>
prompt where v.COMPONENT_ID=fsc.COMPONENT_ID<br>
prompt and fcq.MANAGER_TYPE = fcs.SERVICE_ID <br>
prompt and fcs.SERVICE_HANDLE = 'FNDCPGSC' <br>
prompt and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)<br>
prompt and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+) <br>
prompt and fcq.application_id = fcp.queue_application_id(+) <br>
prompt and fcp.process_status_code(+) = 'A'<br>
prompt and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'<br>
prompt order by fcp.OS_PROCESS_ID, fsc.STARTUP_MODE;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>CONTAINER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPONENT</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PROCID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>TARGET</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ACTUAL</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>#THREADS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ENABLED</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPONENT_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>CORRELATION_ID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STARTUP_MODE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
select
'<TR><TD>'||fcq.USER_CONCURRENT_QUEUE_NAME||'</TD>'||chr(10)||
'<TD>'||fsc.COMPONENT_NAME||'</TD>'||chr(10)||
'<TD>'||DECODE(fcp.OS_PROCESS_ID,NULL,'Not Running',fcp.OS_PROCESS_ID)||'</TD>'||chr(10)||
'<TD>'||fcq.MAX_PROCESSES||'</TD>'||chr(10)||
'<TD>'||fcq.RUNNING_PROCESSES||'</TD>'||chr(10)||
'<TD>'||v.PARAMETER_VALUE||'</TD>'||chr(10)||
'<TD>'||fcq.ENABLED_FLAG||'</TD>'||chr(10)||
'<TD>'||fsc.COMPONENT_ID||'</TD>'||chr(10)||
'<TD>'||fsc.CORRELATION_ID||'</TD>'||chr(10)||
'<TD>'||fsc.STARTUP_MODE||'</TD>'||chr(10)||
'<TD>'||fsc.COMPONENT_STATUS||'</TD></TR>'
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
order by fcp.OS_PROCESS_ID, fsc.STARTUP_MODE;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
declare
v_comp_id number;
cursor c_mailerIDs IS
select fsc.COMPONENT_ID
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
and fcq.USER_CONCURRENT_QUEUE_NAME = 'Workflow Mailer Service';
begin
select nvl(max(rownum), 0) into :mailer_cnt
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
and fcq.USER_CONCURRENT_QUEUE_NAME = 'Workflow Mailer Service';
dbms_output.put_line('<BR><a name="wfadv152"></a><B><U>Check the status of the Workflow Notification Mailer(s) for this instance</B></U><BR>');
if (:mailer_cnt = 0) then
dbms_output.put_line('There is no Mailer Service defined for this instance.<BR>');
dbms_output.put_line('Check the setup of GSM to understand why the Mailer Service is not created or running.<BR><BR> ');
elsif (:mailer_cnt = 1) then
dbms_output.put_line('There is only one Notification mailer found on this instance.<BR>');
dbms_output.put_line('The Workflow Notification Mailer is the default seeded mailer that comes with EBS. <BR><BR> ');
else
dbms_output.put_line('There are multiple mailers found on this instance.<BR>');
dbms_output.put_line('The seperate mailers will be looked at individually. <BR><BR> ');
end if;
OPEN c_mailerIDs;
LOOP
Fetch c_mailerIDs INTO v_comp_id;
EXIT WHEN c_mailerIDs%NOTFOUND;
if (:mailer_enabled = 'DISABLED') then
dbms_output.put_line('The '|| :component_name ||' is currently ' || :mailer_enabled || ', so no email notifications can be sent. <BR>');
elsif (:mailer_enabled = 'ENABLED') then
select fsc.COMPONENT_STATUS into :mailer_status
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
and fcq.USER_CONCURRENT_QUEUE_NAME = 'Workflow Mailer Service'
and fsc.COMPONENT_ID = v_comp_id;
select nvl(fsc.CORRELATION_ID,'NULL') into :corrid
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
and fcq.USER_CONCURRENT_QUEUE_NAME = 'Workflow Mailer Service'
and fsc.COMPONENT_ID = v_comp_id;
select fsc.STARTUP_MODE into :startup_mode
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
and fcq.USER_CONCURRENT_QUEUE_NAME = 'Workflow Mailer Service'
and fsc.COMPONENT_ID = v_comp_id;
select fcq.USER_CONCURRENT_QUEUE_NAME into :container_name
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
and fcq.USER_CONCURRENT_QUEUE_NAME = 'Workflow Mailer Service'
and fsc.COMPONENT_ID = v_comp_id;
select fsc.COMPONENT_NAME into :component_name
from APPS.FND_CONCURRENT_QUEUES_VL fcq, APPS.FND_CP_SERVICES fcs,
APPS.FND_CONCURRENT_PROCESSES fcp, fnd_svc_components fsc, FND_SVC_COMP_PARAM_VALS_V v
where v.COMPONENT_ID=fsc.COMPONENT_ID
and fcq.MANAGER_TYPE = fcs.SERVICE_ID
and fcs.SERVICE_HANDLE = 'FNDCPGSC'
and fsc.concurrent_queue_id = fcq.concurrent_queue_id(+)
and fcq.concurrent_queue_id = fcp.concurrent_queue_id(+)
and fcq.application_id = fcp.queue_application_id(+)
and fcp.process_status_code(+) = 'A'
and v.PARAMETER_NAME = 'PROCESSOR_IN_THREAD_COUNT'
and fcq.USER_CONCURRENT_QUEUE_NAME = 'Workflow Mailer Service'
and fsc.COMPONENT_ID = v_comp_id;
select v.PARAMETER_VALUE into :email_override
from FND_SVC_COMP_PARAM_VALS_V v, FND_SVC_COMPONENTS fsc
where v.COMPONENT_ID=fsc.COMPONENT_ID
and v.parameter_name = 'TEST_ADDRESS'
and fsc.COMPONENT_ID = v_comp_id
order by fsc.COMPONENT_ID, v.parameter_name;
dbms_output.put_line('The mailer called "'|| :component_name ||'" is ' || :mailer_enabled || ' with a component status of '|| :mailer_status ||'. ');
if (:email_override = 'NONE') then
dbms_output.put_line('<BR>The Email Override (Test Address) feature is DISABLED as ' || :email_override || ' for '|| :component_name ||'. ');
dbms_output.put_line('<BR>This means that all emails with correlation_id of '|| :corrid ||' that get sent by '|| :component_name ||' will be sent to their intended recipients as expected when the mailer is running.<BR><BR> ');
elsif (:email_override is not null) then
dbms_output.put_line('<BR>The Email Override (Test Address) feature is ENABLED to ' || :email_override || ' for '|| :component_name ||'.');
dbms_output.put_line('<BR>This means that all emails that get sent by '|| :component_name ||' are re-routed and sent to this single Override email address (' || :email_override || ') when the '|| :component_name ||' is running.');
dbms_output.put_line('<BR>Please ensure this email address is correct.');
dbms_output.put_line('<BR>This is a standard setup for a production cloned (TEST or DEV) instance to avoid duplicate emails being sent to users.<BR><BR> ');
end if;
if (:mailer_status = 'DEACTIVATED_USER') then
if (:startup_mode = 'AUTOMATIC') then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<B>Warning</B><BR>');
dbms_output.put_line('The Workflow Java Mailer "'|| :component_name ||'" is currently not running.<BR>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('If using the Java Mailer to send email notifications and alerts, please bounce the container : '|| :container_name ||'.<BR>');
dbms_output.put_line('via the Oracle Application Manager - Workflow Manager screen to automatically restart the component : '|| :component_name ||'.<BR>');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1191400.1" target="_blank">Note 1191400.1</a> - Troubleshooting Oracle Workflow Java Notification Mailer, for more information.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
elsif (:startup_mode = 'MANUAL') then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Warning</B><BR>');
dbms_output.put_line('The Workflow Java Mailer "'|| :component_name ||'" is currently not running..<BR>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('If using the Java Mailer to send email notifications and alerts, please manually start the : '|| :component_name ||'.<BR>');
dbms_output.put_line('via the Oracle Application Manager - Workflow Manager screen.');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1191400.1" target="_blank">Note 1191400.1</a> - Troubleshooting Oracle Workflow Java Notification Mailer, for more information.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
end if;
elsif (:mailer_status = 'DEACTIVATED_SYSTEM') then
dbms_output.put_line('<table border="1" name="Error" cellpadding="10" bgcolor="#CC6666" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Error</B><BR>');
dbms_output.put_line('The Workflow Java Mailer "'|| :component_name ||'" is currently down due to an error detected by the System.<BR>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('Please review the email that was sent to SYSADMIN regarding this error.<BR>');
dbms_output.put_line('The Java Mailer is currently set to startup mode of '|| :startup_mode ||'.<BR>');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1191400.1" target="_blank">Note 1191400.1</a> - Troubleshooting Oracle Workflow Java Notification Mailer, for more information.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
elsif (:mailer_status = 'NOT_CONFIGURED') then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<p><B>Warning</B><BR>');
dbms_output.put_line('The Workflow Java Mailer "'|| :component_name ||'" has been created, but is not configured completely.<BR>');
dbms_output.put_line('<B>Action</B><BR>');
dbms_output.put_line('Please complete the configuration of the "'|| :component_name ||'" using the Workflow Manager screens if you plan to use it.<BR>');
dbms_output.put_line('This Java Mailer is currently set to startup mode of '|| :startup_mode ||'.<BR>');
dbms_output.put_line('Please review <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1191400.1" target="_blank">Note 1191400.1</a> - Troubleshooting Oracle Workflow Java Notification Mailer, for more information.<BR>');
dbms_output.put_line('</p></td></tr></tbody></table><BR>');
elsif (:mailer_status = 'STOPPED') then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('The Workflow Java Mailer "'|| :component_name ||'" is currently stopped.<BR>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
elsif (:mailer_status = 'RUNNING') then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('The Workflow Java Mailer "'|| :component_name ||'" is currently running.<BR>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
end if;
end if;
END LOOP;
CLOSE c_mailerIDs;
end;
/
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Check Status of WF_NOTIFICATIONS Table *******
REM
prompt <script type="text/javascript"> function displayRows5sql3(){var row = document.getElementById("s5sql3");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=2 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv153"></a>
prompt <B>Check Status of WF_NOTIFICATIONS Table</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows5sql3()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s5sql3" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="3" height="85">
prompt <blockquote><p align="left">
prompt select status, nvl(mail_status,'NULL'), count(notification_id)<br>
prompt from wf_notifications<br>
prompt group by status, mail_status<br>
prompt order by status, count(notification_id) desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MAIL_STATUS</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||status||'</TD>'||chr(10)||
'<TD>'||nvl(mail_status,'NULL')||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(notification_id),'999,999,999,999')||'</div></TD></TR>'
from wf_notifications
group by status, mail_status
order by status, count(notification_id) desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Check Status of WF_NOTIFICATION_OUT Table *******
REM
prompt <script type="text/javascript"> function displayRows5sql4(){var row = document.getElementById("s5sql4");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=1 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv154"></a>
prompt <B>Check Status of WF_NOTIFICATION_OUT Table</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows5sql4()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s5sql4" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="2" height="60">
prompt <blockquote><p align="left">
prompt select n.msg_state, count(*)<br>
prompt from applsys.aq$wf_notification_out n<br>
prompt group by n.msg_state;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MSG_STATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||n.msg_state||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(*),'999,999,999,999')||'</div></TD></TR>'
from applsys.aq$wf_notification_out n
group by n.msg_state;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Check for Orphaned Notifications *******
REM
prompt <script type="text/javascript"> function displayRows5sql5(){var row = document.getElementById("s5sql5");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=2 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv155"></a>
prompt <B>Check for Orphaned Notifications</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows5sql5()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s5sql5" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="4" height="155">
prompt <blockquote><p align="left">
prompt select WN.MESSAGE_TYPE, wn.MESSAGE_NAME, count(notification_id)<br>
prompt from WF_NOTIFICATIONS WN<br>
prompt where not exists (select NULL from WF_ITEM_ACTIVITY_STATUSES WIAS<br>
prompt where WIAS.NOTIFICATION_ID = WN.GROUP_ID)<br>
prompt and not exists (select NULL from WF_ITEM_ACTIVITY_STATUSES_H WIAS<br>
prompt where WIAS.NOTIFICATION_ID = WN.GROUP_ID)<br>
prompt group by wn.message_type, wn.MESSAGE_NAME<br>
prompt order by count(notification_id) desc;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MESSAGE TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MESSAGE NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COUNT</B></TD>
select
'<TR><TD>'||WN.MESSAGE_TYPE||'</TD>'||chr(10)||
'<TD>'||wn.MESSAGE_NAME||'</TD>'||chr(10)||
'<TD><div align="right">'||to_char(count(notification_id),'999,999,999,999')||'</div></TD></TR>'
from WF_NOTIFICATIONS WN
where not exists (select NULL from WF_ITEM_ACTIVITY_STATUSES WIAS
where WIAS.NOTIFICATION_ID = WN.GROUP_ID)
and not exists (select NULL from WF_ITEM_ACTIVITY_STATUSES_H WIAS
where WIAS.NOTIFICATION_ID = WN.GROUP_ID)
group by wn.message_type, wn.MESSAGE_NAME
order by count(notification_id) desc;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM ****************************************************************************************
REM ******* Section 6 : Workflow Patch Levels *******
REM ****************************************************************************************
prompt <a name="section6"></a><B><font size="+2">Current Workflow Patch Levels</font></B><BR><BR>
REM
REM ******* Applied ATG Patches *******
REM
prompt <script type="text/javascript"> function displayRows6sql1(){var row = document.getElementById("s6sql1");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=3 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv161"></a>
prompt <B>Applied ATG/WF Patches</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows6sql1()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s6sql1" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="4" height="850">
prompt <blockquote><p align="left">
prompt select BUG_NUMBER, LAST_UPDATE_DATE,<br>
prompt decode(bug_number,2728236, 'OWF.G INCLUDED IN 11.5.9',<br>
prompt 3031977, 'POST OWF.G ROLLUP 1 - 11.5.9.1',<br>
prompt 3061871, 'POST OWF.G ROLLUP 2 - 11.5.9.2',<br>
prompt 3124460, 'POST OWF.G ROLLUP 3 - 11.5.9.3',<br>
prompt 3126422, '11.5.9 Oracle E-Business Suite Consolidated Update 1',<br>
prompt 3171663, '11.5.9 Oracle E-Business Suite Consolidated Update 2',<br>
prompt 3316333, 'POST OWF.G ROLLUP 4 - 11.5.9.4.1',<br>
prompt 3314376, 'POST OWF.G ROLLUP 5 - 11.5.9.5',<br>
prompt 3409889, 'POST OWF.G ROLLUP 5 Consolidated Fixes For OWF.G RUP 5', 3492743, 'POST OWF.G ROLLUP 6 - 11.5.9.6',<br>
prompt 3868138, 'POST OWF.G ROLLUP 7 - 11.5.9.7',<br>
prompt 3262919, 'FMWK.H',<br>
prompt 3262159, 'FND.H INCLUDE OWF.H',<br>
prompt 3258819, 'OWF.H INCLUDED IN 11.5.10',<br>
prompt 3438354, '11i.ATG_PF.H INCLUDE OWF.H',<br>
prompt 3140000, 'ORACLE APPLICATIONS RELEASE 11.5.10 MAINTENANCE PACK',<br>
prompt 3240000, '11.5.10 ORACLE E-BUSINESS SUITE CONSOLIDATED UPDATE 1',<br>
prompt 3460000, '11.5.10 ORACLE E-BUSINESS SUITE CONSOLIDATED UPDATE 2',<br>
prompt 3480000, 'ORACLE APPLICATIONS RELEASE 11.5.10.2 MAINTENANCE PACK',<br>
prompt 4017300 , 'ATG_PF:11.5.10 Consolidated Update (CU1) for ATG Product Family',<br>
prompt 4125550 , 'ATG_PF:11.5.10 Consolidated Update (CU2) for ATG Product Family',<br>
prompt 5121512, 'AOL USER RESPONSIBILITY SECURITY FIXES VERSION 1',<br>
prompt 6008417, 'AOL USER RESPONSIBILITY SECURITY FIXES 2b',<br>
prompt 6047864, 'REHOST JOC FIXES (BASED ON JOC 10.1.2.2) FOR APPS 11i',<br>
prompt 4334965, '11i.ATG_PF.H RUP3',<br>
prompt 4676589, '11i.ATG_PF.H.RUP4',<br>
prompt 5473858, '11i.ATG_PF.H.RUP5',<br>
prompt 5903765, '11i.ATG_PF.H.RUP6',<br>
prompt 6241631, '11i.ATG_PF.H.RUP7',<br>
prompt 4440000, 'Oracle Applications Release 12 Maintenance Pack',<br>
prompt 5082400, '12.0.1 Release Update Pack (RUP1)',<br>
prompt 5484000, '12.0.2 Release Update Pack (RUP2)',<br>
prompt 6141000, '12.0.3 Release Update Pack (RUP3)',<br>
prompt 6435000, '12.0.4 RELEASE UPDATE PACK (RUP4)',<br>
prompt 5907545, 'R12.ATG_PF.A.DELTA.1',<br>
prompt 5917344, 'R12.ATG_PF.A.DELTA.2',<br>
prompt 6077669, 'R12.ATG_PF.A.DELTA.3',<br>
prompt 6272680, 'R12.ATG_PF.A.DELTA.4', <br>
prompt 7237006, 'R12.ATG_PF.A.DELTA.6',<br>
prompt 6728000, '12.0.6 RELEASE UPDATE PACK (RUP6)', <br>
prompt 6430106, 'R12 ORACLE E-BUSINESS SUITE 12.1', <br>
prompt 7303030, '12.1.1 Maintenance Pack',<br>
prompt 7307198, 'R12.ATG_PF.B.DELTA.1',<br>
prompt 7651091, 'R12.ATG_PF.B.DELTA.2',<br>
prompt 7303033, 'Oracle E-Business Suite 12.1.2 Release Update Pack (RUP2)',<br>
prompt 8919491, 'R12.ATG_PF.B.DELTA.3',<br>
prompt 9239090, 'ORACLE E-BUSINESS SUITE 12.1.3 RELEASE UPDATE PACK',<br>
prompt 10110982, 'R12 ORACLE E-BUSINESS SUITE 12.2', <br>
prompt bug_number) PATCH, ARU_RELEASE_NAME<br>
prompt from AD_BUGS b <br>
prompt where b.BUG_NUMBER in ('2728236', '3031977','3061871','3124460','3126422','3171663','3316333',<br>
prompt '3314376','3409889', '3492743', '3262159', '3262919', '3868138', '3258819','3438354','3240000', <br>
prompt '3460000', '3140000','3480000','4017300', '4125550', '6047864', '6008417','5121512', '4334965', <br>
prompt '4676589', '5473858', '5903765', '6241631', '4440000','5082400','5484000','6141000','6435000', <br>
prompt '5907545','5917344','6077669','6272680','7237006','6728000','6430106','7303030','7307198', <br>
prompt '7651091','7303033','8919491', '9239090', '10110982')<br>
prompt order by BUG_NUMBER,LAST_UPDATE_DATE,ARU_RELEASE_NAME; </p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>BUG_NUMBER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>LAST_UPDATE_DATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PATCH</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>ARU_RELEASE_NAME</B></TD>
select
'<TR><TD>'||BUG_NUMBER||'</TD>'||chr(10)||
'<TD>'||LAST_UPDATE_DATE||'</TD>'||chr(10)||
'<TD>'||decode(bug_number,2728236, 'OWF.G INCLUDED IN 11.5.9',
3031977, 'POST OWF.G ROLLUP 1 - 11.5.9.1',
3061871, 'POST OWF.G ROLLUP 2 - 11.5.9.2',
3124460, 'POST OWF.G ROLLUP 3 - 11.5.9.3',
3126422, '11.5.9 Oracle E-Business Suite Consolidated Update 1',
3171663, '11.5.9 Oracle E-Business Suite Consolidated Update 2',
3316333, 'POST OWF.G ROLLUP 4 - 11.5.9.4.1',
3314376, 'POST OWF.G ROLLUP 5 - 11.5.9.5',
3409889, 'POST OWF.G ROLLUP 5 Consolidated Fixes For OWF.G RUP 5',
3492743, 'POST OWF.G ROLLUP 6 - 11.5.9.6',
3868138, 'POST OWF.G ROLLUP 7 - 11.5.9.7',
3262919, 'FMWK.H',
3262159, 'FND.H INCLUDE OWF.H',
3258819, 'OWF.H INCLUDED IN 11.5.10',
3438354, '11i.ATG_PF.H INCLUDE OWF.H',
3140000, 'Oracle Applications Release 11.5.10 Maintenance Pack',
3240000, '11.5.10 Oracle E-Business Suite Consolidated Update (CU1)',
3460000, '11.5.10 Oracle E-Business Suite Consolidated Update (CU2)',
3480000, 'Oracle Applications Release 11.5.10.2 Maintenance Pack',
4017300 , 'ATG_PF:11.5.10 Consolidated Update (CU1) for ATG Product Family',
4125550 , 'ATG_PF:11.5.10 Consolidated Update (CU2) for ATG Product Family',
5121512, 'AOL USER RESPONSIBILITY SECURITY FIXES VERSION 1',
6008417, 'AOL USER RESPONSIBILITY SECURITY FIXES 2b',
6047864, 'REHOST JOC FIXES (BASED ON JOC 10.1.2.2) FOR APPS 11i',
4334965, '11i.ATG_PF.H RUP3',
4676589, '11i.ATG_PF.H.RUP4',
5473858, '11i.ATG_PF.H.RUP5',
5903765, '11i.ATG_PF.H.RUP6',
6241631, '11i.ATG_PF.H.RUP7',
4440000, 'Oracle Applications Release 12 Maintenance Pack',
5082400, '12.0.1 Release Update Pack (RUP1)',
5484000, '12.0.2 Release Update Pack (RUP2)',
6141000, '12.0.3 Release Update Pack (RUP3)',
6435000, '12.0.4 Release Update Pack (RUP4)',
5907545, 'R12.ATG_PF.A.DELTA.1',
5917344, 'R12.ATG_PF.A.DELTA.2',
6077669, 'R12.ATG_PF.A.DELTA.3',
6272680, 'R12.ATG_PF.A.DELTA.4',
7237006, 'R12.ATG_PF.A.DELTA.6',
6728000, 'R12 12.0.6 (RUP6)',
6430106, 'R12 Oracle E-Business Suite 12.1',
7303030, '12.1.1 Maintenance Pack',
7307198, 'R12.ATG_PF.B.DELTA.1',
7651091, 'R12.ATG_PF.B.DELTA.2',
7303033, 'R12 Oracle E-Business Suite 12.1.2 (RUP2)',
8919491, 'R12.ATG_PF.B.DELTA.3',
9239090, 'R12 Oracle E-Business Suite 12.1.3 (RUP3)',
10110982, 'R12 Oracle E-Business Suite 12.2',
10079002, 'R12 Oracle E-Business Suite 12.2.0 Maintenance Pack',
bug_number)||'</TD>'||chr(10)||
'<TD>'||ARU_RELEASE_NAME||'</TD></TR>'
from AD_BUGS b
where b.BUG_NUMBER in ('2728236', '3031977','3061871','3124460','3126422','3171663','3316333',
'3314376','3409889', '3492743', '3262159', '3262919', '3868138', '3258819','3438354','3240000',
'3460000', '3140000','3480000','4017300', '4125550', '6047864', '6008417','5121512', '4334965',
'4676589', '5473858', '5903765', '6241631', '4440000','5082400','5484000','6141000','6435000',
'5907545','5917344','6077669','6272680','7237006','6728000','6430106','7303030','7307198',
'7651091','7303033','8919491', '9239090', '10110982','10079002')
order by LAST_UPDATE_DATE,ARU_RELEASE_NAME;
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
prompt <a name="atgrups"></a><B><font size="+2">Known 1-Off Patches on top of ATG Rollups</font></B><BR><BR>
begin
select release_name into :apps_rel
from fnd_product_groups;
dbms_output.put_line('This instance has Oracle Applications version ' || :apps_rel || '.<BR>');
if (:apps_rel is null) then
dbms_output.put_line('<table border="1" name="Warning" cellpadding="10" bgcolor="#DEE6EF" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td> ');
dbms_output.put_line('<B>Warning</B><BR>');
dbms_output.put_line('There is a problem reading the Oracle Apps version : ' || :apps_rel || ' for this instance. ');
dbms_output.put_line('<BR>');
elsif (:apps_rel = '11.5.9') then
dbms_output.put_line('<B>Warning</B><BR>');
dbms_output.put_line('The Oracle Apps version is (' || :apps_rel || ') for this instance. ');
dbms_output.put_line('<BR>');
elsif (:apps_rel > '11.5.10' and :apps_rel < '12.0') then
dbms_output.put_line('<B>One-Off Patches on top of Supported ATG Roll-Up Patches (RUP) for ' || :apps_rel || '.</B><br><br>');
dbms_output.put_line('<P><b>11i.ATG_PF.H RUP4</b><table width="83%" border="1"><tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" >');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td></tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">7829071</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.0.4:ORA-06502 PL/SQL: NUMERIC OR VALUE IN WF_ENGINE_UTIL.NOTIFICATION_SEND</td>');
dbms_output.put_line('<td width="16%">n/a</td></tr><tr bordercolor="#000066"><td width="10%"> ');
dbms_output.put_line('<div align="center">8557487</div></td>');
dbms_output.put_line('<td width="74%">1OFF:5709442: HIGH BUFFER GETS WHEN SENDING NOTIFICATON</td><td width="16%">n/a</td></tr>');
dbms_output.put_line('</table><br>');
dbms_output.put_line('<b>11i.ATG_PF.H RUP6</b>');
dbms_output.put_line('<table width="83%" border="1">');
dbms_output.put_line('<tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" > ');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"> ');
dbms_output.put_line('<td width="10%"> ');
dbms_output.put_line('<div align="center">7594112</div>');
dbms_output.put_line('</td>');
dbms_output.put_line('<td width="74%">1OFF:6243131:11I.ATG_PF.H.RUP6: APPROVALS GOING INTO DEFFRED MODE </td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066">');
dbms_output.put_line('<td width="10%"> ');
dbms_output.put_line('<div align="center">8330993</div>');
dbms_output.put_line('</td>');
dbms_output.put_line('<td width="74%">1OFF:8308654:12.0.6:12.0.6:12.0.6:WF_STANDARD.INITIALIZEEVENTERROR ');
dbms_output.put_line('USING ATTRIB </td>');
dbms_output.put_line('<td width="16%"></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"> ');
dbms_output.put_line('<td width="10%">');
dbms_output.put_line('<div align="center">9199983</div>');
dbms_output.put_line('</td>');
dbms_output.put_line('<td width="74%">1OFF:11.5.10.6RUP:7476877:WORKFLOW PURGE IS CRITICALLY AFFECTING PERFORMANCE</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('</table>');
dbms_output.put_line('<p><b>11i.ATG_PF.H RUP7</b><br>');
dbms_output.put_line('<table width="83%" border="1">');
dbms_output.put_line('<tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" > ');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"> ');
dbms_output.put_line('<td width="10%"> ');
dbms_output.put_line('<div align="center">9747572</div>');
dbms_output.put_line('</td>');
dbms_output.put_line('<td width="74%">1OFF:11i.ATG_PF.H.RUP7:WFBG DOES NOT EXECUTE SELECTOR FUNCTION ');
dbms_output.put_line('WHEN PROCESSING A SUBSEQUENT DEFERRED ACTIVITY OF SAME ITEM TYPE AND ITEM</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('</table><BR><BR>');
elsif (:apps_rel >= '12.0' and :apps_rel < '12.1') then
dbms_output.put_line('<B>One-Off Patches on top of Supported ATG Roll-Up Patches (RUP) for ' || :apps_rel || '.</B><br><br>');
dbms_output.put_line('<P><b>Rel 12.0.4</b><br>');
dbms_output.put_line('<table width="83%" border="1"><tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" >');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">8201652</div></td>');
dbms_output.put_line('<td width="74%">1OFF (7538770) ON TOP OF 12.0.4 (R12.ATG_PF.A.DELTA.4)</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('</table><br>');
dbms_output.put_line('<p><b>Rel 12.0.6</b><br>');
dbms_output.put_line('<table width="83%" border="1"><tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" >');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066">');
dbms_output.put_line('<td width="10%">');
dbms_output.put_line('<div align="center">9123412</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.0.6:8509185:NOTIFICATION HISTORY DOES NOT DISPLAY UP TO DATE CONTENT.</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"> ');
dbms_output.put_line('<td width="10%"> ');
dbms_output.put_line('<div align="center">8330993</div></td>');
dbms_output.put_line('<td width="74%">1OFF:8308654:12.0.6:WF_STANDARD.INITIALIZEEVENTERROR USING ATTRIB ERROR_DETAILS THAT DOES NOT EXIST.</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('</table><BR><BR>');
elsif (:apps_rel >= '12.1' and :apps_rel < '12.2') then
dbms_output.put_line('<B>One-Off Patches on top of Supported ATG Roll-Up Patches (RUP) for ' || :apps_rel || '.</B><br><br>');
dbms_output.put_line('<P><b>Rel 12.1.1</b><br>');
dbms_output.put_line('<table width="83%" border="1"><tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" >');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">8531582</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.1:7538770:FNDWFPR PERFORMANCE IS SLOWER THAN GENERATING SPEED</td>');
dbms_output.put_line('<td width="16%">8832674</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">8603335</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.1:8554209:PERFORMANCE ISSUE WITH WF_NOTIFICATION.SEND()API</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">9102969</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.1:8850464:FND USER IS COMING AS WRONG VALUE</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">9046220</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.1:7842689:WF_ITEM.SET_END_DATE WRONGLY DECREMENTS #WAITFORDETAIL ATTRIBUTE</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">8802718</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.1:8729116:ORA-1422: IN WF_NOTIFICATION.SEND WHEN 2 NTFS ARE SENT FROM AN ACTIVITY</td>');
dbms_output.put_line('<td width="16%">8832674</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">9227423</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.1:9040136:ACTION HISTORY IS OUT OF SEQUENCE IN A RAC INSTANCE </td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">8853694</div></td>');
dbms_output.put_line('<td width="74%">1OFF:8509185:R12 ORACLE E-BUSINESS SUITE 1:FND.A:12.1.1:NOTIFICATION HISTORY DOES NOT DISPLAY UP TO DATE CONTENT</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">9343170</div></td>');
dbms_output.put_line('<td width="74%">1OFF:8729116:11.5.10.6:ORA-01422 IN WF_NOTIFICATION.SEND WHEN 2 NTFS SENT FROM AN ACTIVITY</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066"><td width="10%">');
dbms_output.put_line('<div align="center">9773716</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.2:9771657:WFBG DOES NOT EXECUTE SELECTOR FUNCTION WHEN PROCESSING A SUBSEQUENT DEFERRED ACTIVITY OF SAME ITEM TYPE AND ITEM KEY</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('</table><BR>');
dbms_output.put_line('<p><b>Rel 12.1.2</b><br>');
dbms_output.put_line('<table width="83%" border="1"><tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" >');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066">');
dbms_output.put_line('<td width="10%">');
dbms_output.put_line('<div align="center">9773716</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.2:9771657:WFBG DOES NOT EXECUTE SELECTOR FUNCTION WHEN PROCESSING A SUBSEQUENT DEFERRED ACTIVITY OF SAME ITEM TYPE AND ITEM KEY.</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('</table><BR>');
dbms_output.put_line('<p><b>Rel 12.1.3</b><br>');
dbms_output.put_line('<table width="83%" border="1"><tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" >');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066">');
dbms_output.put_line('<td width="10%">');
dbms_output.put_line('<div align="center">9773716</div></td>');
dbms_output.put_line('<td width="74%">1OFF:12.1.2:9771657:WFBG DOES NOT EXECUTE SELECTOR FUNCTION WHEN PROCESSING A SUBSEQUENT DEFERRED ACTIVITY OF SAME ITEM TYPE AND ITEM KEY.</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('</table><BR>');
elsif (:apps_rel >= '12.2') then
dbms_output.put_line('<B>One-Off Patches on top of Supported ATG Roll-Up Patches (RUP) for ' || :apps_rel || '.</B><br><br>');
dbms_output.put_line('<p><b>Rel 12.2</b><br>');
dbms_output.put_line('<table width="83%" border="1"><tr bordercolor="#DEE6EF" bgcolor="#DEE6EF" >');
dbms_output.put_line('<td width="10%"><b>Patch #</b></td>');
dbms_output.put_line('<td width="74%"><b>Abstract</b></td>');
dbms_output.put_line('<td width="16%"><b>Superseeded by</b></td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('<tr bordercolor="#000066">');
dbms_output.put_line('<td width="10%">');
dbms_output.put_line('<div align="center">TBD</div></td>');
dbms_output.put_line('<td width="74%">n/a</td>');
dbms_output.put_line('<td width="16%">n/a</td>');
dbms_output.put_line('</tr>');
dbms_output.put_line('</table><BR>');
end if;
dbms_output.put_line('<A href="#top"><font size="-1">Back to Top</font></A><BR><BR>');
dbms_output.put_line('<table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">');
dbms_output.put_line('<tbody><tr><td>');
dbms_output.put_line('<p>For more information refer to <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=453137.1"');
dbms_output.put_line('target="_blank">Note 453137.1</a> - Oracle Workflow Best Practices Release 12 and Release 11i<br><br>');
dbms_output.put_line('</td></tr></tbody></table><BR>');
end;
/
REM
REM ******* Verify Workflow Services Log Levels and Mailer Debug Status *******
REM
prompt <script type="text/javascript"> function displayRows6sql2(){var row = document.getElementById("s6sql2");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=3 bordercolor="#DEE6EF"><font face="Calibri"><a name="wfadv162"></a>
prompt <B>Check The Status of Workflow Log Levels and Mailer Debug Status</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows6sql2()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s6sql2" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="4" height="185">
prompt <blockquote>
prompt <p align="left">select SC.COMPONENT_NAME, sc.COMPONENT_TYPE,<br>
prompt v.PARAMETER_DISPLAY_NAME,<br>
prompt decode(v.PARAMETER_VALUE,<br>
prompt '1', '1 = Statement',<br>
prompt '2', '2 = Procedure',<br>
prompt '3', '3 = Event',<br>
prompt '4', '4 = Exception',<br>
prompt '5', '5 = Error',<br>
prompt '6', '6 = Unexpected',<br>
prompt 'N', 'N = Not Enabled',<br>
prompt 'Y', 'Y = Enabled')<br>
prompt FROM FND_SVC_COMP_PARAM_VALS_V v, FND_SVC_COMPONENTS SC<br>
prompt WHERE v.COMPONENT_ID=sc.COMPONENT_ID <br>
prompt AND v.parameter_name in ('COMPONENT_LOG_LEVEL','DEBUG_MAIL_SESSION')<br>
prompt ORDER BY sc.COMPONENT_TYPE, SC.COMPONENT_NAME, v.PARAMETER_VALUE;</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPONENT_NAME</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>COMPONENT_TYPE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PARAMETER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>VALUE</B></TD>
select
'<TR><TD>'||SC.COMPONENT_NAME||'</TD>'||chr(10)||
'<TD>'||sc.COMPONENT_TYPE||'</TD>'||chr(10)||
'<TD>'||v.PARAMETER_DISPLAY_NAME||'</TD>'||chr(10)||
'<TD>'||decode(v.PARAMETER_VALUE,
'1', '1 = Statement',
'2', '2 = Procedure',
'3', '3 = Event',
'4', '4 = Exception',
'5', '5 = Error',
'6', '6 = Unexpected',
'N', 'N = Not Enabled',
'Y', 'Y = Enabled')||'</TD></TR>'
FROM FND_SVC_COMP_PARAM_VALS_V v, FND_SVC_COMPONENTS SC
WHERE v.COMPONENT_ID=sc.COMPONENT_ID
AND v.parameter_name in ('COMPONENT_LOG_LEVEL','DEBUG_MAIL_SESSION')
ORDER BY sc.COMPONENT_TYPE, SC.COMPONENT_NAME, v.PARAMETER_VALUE;
prompt </TABLE><P><P>
prompt The Mailer Debug parameter (Debug Mail Session) should be ENABLED when troubleshooting issues with any Workflow Notification Mailer.<BR>
prompt Set individual Component Logging Levels to Statement Level logging (Log Level = 1) for the most detail and robust logging level.<BR>
prompt Use $FND_TOP/sql/afsvcpup.sql - AF SVC Parameter UPdate script to change the logging levels.<br>
prompt Remember to reset, or lower the logging level after troubleshooting to not generate excessive log files.
prompt <br><BR>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM
REM ******* Verify Workflow Services Current Logs *******
REM
prompt <script type="text/javascript"> function displayRows6sql3(){var row = document.getElementById("s6sql3");if (row.style.display == '') row.style.display = 'none'; else row.style.display = ''; }</script>
prompt <TABLE border="1" cellspacing="0" cellpadding="2">
prompt <TR bgcolor="#DEE6EF" bordercolor="#DEE6EF">
prompt <TD COLSPAN=4 bordercolor="#DEE6EF"><font face="Calibri"> <a name="wfadv163"></a>
prompt <B>Verify Workflow Services Current Logs</B></font></TD>
prompt <TD bordercolor="#DEE6EF">
prompt <div align="right"><button onclick="displayRows6sql3()" >SQL Script</button></div>
prompt </TD>
prompt </TR>
prompt <TR id="s6sql3" style="display:none">
prompt <TD BGCOLOR=#DEE6EF colspan="5" height="150">
prompt <blockquote>
prompt <p align="left">select fcq.concurrent_queue_name, fcp.last_update_date,<br>
prompt fcp.concurrent_process_id,flkup.meaning,fcp.logfile_name<br>
prompt FROM fnd_concurrent_queues fcq, fnd_concurrent_processes fcp, fnd_lookups
prompt flkup<br>
prompt WHERE concurrent_queue_name in ('WFMLRSVC', 'WFALSNRSVC')<br>
prompt AND fcq.concurrent_queue_id = fcp.concurrent_queue_id<br>
prompt AND fcq.application_id = fcp.queue_application_id<br>
prompt AND flkup.lookup_code=fcp.process_status_code<br>
prompt AND lookup_type ='CP_PROCESS_STATUS_CODE'<br>
prompt AND flkup.meaning='Active';</p>
prompt </blockquote>
prompt </TD>
prompt </TR>
prompt <TR>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MANAGER</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>LAST_UPDATE_DATE</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>PID</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>MEANING</B></TD>
prompt <TD BGCOLOR=#DEE6EF><font face="Calibri"><B>LOGFILE_NAME</B></TD>
select
'<TR><TD>'||fcq.concurrent_queue_name||'</TD>'||chr(10)||
'<TD>'||fcp.last_update_date||'</TD>'||chr(10)||
'<TD>'||fcp.concurrent_process_id||'</TD>'||chr(10)||
'<TD>'||flkup.meaning||'</TD>'||chr(10)||
'<TD>'||fcp.logfile_name||'</TD></TR>'
FROM fnd_concurrent_queues fcq, fnd_concurrent_processes fcp, fnd_lookups flkup
WHERE concurrent_queue_name in ('WFMLRSVC', 'WFALSNRSVC')
AND fcq.concurrent_queue_id = fcp.concurrent_queue_id
AND fcq.application_id = fcp.queue_application_id
AND flkup.lookup_code=fcp.process_status_code
AND lookup_type ='CP_PROCESS_STATUS_CODE'
AND flkup.meaning='Active';
prompt </TABLE><P><P>
prompt <A href="#top"><font size="-1">Back to Top</font></A><BR><BR>
REM ****************************************************************************************
REM ******* Section 7 : References *******
REM ****************************************************************************************
prompt <a name="section7"></a><B><font size="+2">References</font></B><BR><BR>
prompt <table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody><font size="-1" face="Calibri"><tr><td><p>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1425053.1" target="_blank">
prompt Note 1425053.1 - How to run EBS Workflow Analyzer Tool as a Concurrent Request</a><br>
prompt <br>
prompt <a href="https://communities.oracle.com/portal/server.pt/community/core_workflow/244" target="_blank">
prompt My Oracle Support - Workflow Communities</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1160285.1" target="_blank">
prompt Application Technology Group (ATG) Product Information Center (PIC) (Doc ID 1160285.1)</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1320509.1" target="_blank">
prompt E-Business Workflow Information Center (PIC) (Doc ID 1320509.1)</a><br>
prompt <br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=186361.1" target="_blank">
prompt Note 186361.1 - Workflow Background Process Performance Troubleshooting Guide</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=453137.1" target="_blank">
prompt Note 453137.1 - Oracle Workflow Best Practices Release 12 and Release 11i</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=225165.1" target="_blank">
prompt Note 225165.1 - Patching Best Practices and Reducing Downtime</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=957426.1" target="_blank">
prompt Note 957426.1 - Health Check Alert: Invalid objects exist for one or more of your EBS applications</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=104457.1" target="_blank">
prompt Note 104457.1 - Invalid Objects In Oracle Applications FAQs</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1191400.1" target="_blank">
prompt Note 1191400.1 - Troubleshooting Oracle Workflow Java Notification Mailer</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=831982.1" target="_blank">
prompt Note 831982.1 - A guide For Troubleshooting Workflow Notification Emails - Inbound and Outbound</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1448095.1" target="_blank">
prompt Note 1448095.1 - How to handle or reassign System : Error (WFERROR) Notifications that default to SYSADMIN</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=562551.1" target="_blank">
prompt Note 562551.1 - Workflow Java Mailer FAQ</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=760386.1" target="_blank">
prompt Note 760386.1 - How to enable Bulk Notification Response Processing for Workflow in 11i and R12</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=559996.1" target="_blank">
prompt Note 559996.1 - What Tables Does the Workflow Purge Obsolete Data Program (FNDWFPR) Touch?</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=277124.1" target="_blank">
prompt Note 277124.1 - FAQ on Purging Oracle Workflow Data</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=132254.1" target="_blank">
prompt Note 132254.1 - Speeding Up And Purging Workflow</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=144806.1" target="_blank">
prompt Note 144806.1 - A Detailed Approach To Purging Oracle Workflow Runtime Data</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=1378954.1" target="_blank">
prompt Note 1378954.1 - bde_wf_process_tree.sql - For analyzing the Root Parent, Children, Grandchildren Associations of a Single Workflow Process</a><BR>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=375095.1" target="_blank">
prompt Note 375095.1 - How to Purge XDPWFSTD Messages</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=311552.1" target="_blank">
prompt Note 311552.1 - How to Optimize the Purge Process in a High Transaction Applications Environment</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=388672.1" target="_blank">
prompt Note 388672.1 - How to Reorganize Workflow Tables</a><br>
prompt <a href="https://support.oracle.com/CSP/main/article?cmd=show\&type=NOT\&id=733335.1" target="_blank">
prompt Note 733335.1 - How to Start Workflow Components</a><br>
prompt </p></font></td></tr></tbody>
prompt </table><BR><BR>
REM ****************************************************************************************
REM ******* Section 7 : Feedback *******
REM ****************************************************************************************
prompt <a name="section8"></a><B><font size="+2">Feedback</font></B><BR><BR>
prompt <table border="1" name="NoteBox" cellpadding="10" bordercolor="#C1A90D" bgcolor="#FEFCEE" cellspacing="0">
prompt <tbody><font size="-1" face="Calibri"><tr><td><p>
prompt Still have questions? Use the<a title="This is a live browser iFrame window"><em><font color="#FF0000"><b><font size="+1"> live</font></b></font></em></a> My Oracle Support EBS - Core Workflow Community window below,
prompt to search for similar discussions or start a new discussion about the Workflow Analyzer.
prompt As always, you can email the author directly <A HREF="mailto:william.burbage@oracle.com?subject=%20Workflow%20Analyzer%20Feedback&
prompt body=Please attach a copy of your WF Analyzer output">here</A>.<BR>
prompt Be sure to include the output of the script for review.<BR>
prompt </p></font></td></tr></tbody>
prompt </table><BR><BR>
prompt <iframe width="90%" height="550" frameborder="1"
prompt src="https://communities.oracle.com/portal/server.pt/community/view_discussion_topic/216?threadid=271375\&Portlet=Search%20Results\&PrevPage=Communities-Search"
prompt id="iframedemo" name="iframedemo" style="border-style: groove; border-width: 4px; margin: 15px;" class="Docframe">
prompt </iframe><BR>
begin
select to_char(sysdate,'hh24:mi:ss') into :et_time from dual;
end;
/
declare
st_hr1 varchar2(10);
st_mi1 varchar2(10);
st_ss1 varchar2(10);
et_hr1 varchar2(10);
et_mi1 varchar2(10);
et_ss1 varchar2(10);
hr_fact varchar2(10);
mi_fact varchar2(10);
ss_fact varchar2(10);
begin
dbms_output.put_line('<br>PL/SQL Script was started at:'||:st_time);
dbms_output.put_line('<br>PL/SQL Script is complete at:'||:et_time);
st_hr1 := substr(:st_time,1,2);
st_mi1 := substr(:st_time,4,2);
st_ss1 := substr(:st_time,7,2);
et_hr1 := substr(:et_time,1,2);
et_mi1 := substr(:et_time,4,2);
et_ss1 := substr(:et_time,7,2);
if et_hr1 >= st_hr1 then
hr_fact := to_number(et_hr1) - to_number(st_hr1);
else
hr_fact := to_number(et_hr1+24) - to_number(st_hr1);
end if;
if et_ss1 >= st_ss1 then
mi_fact := to_number(et_mi1) - to_number(st_mi1);
ss_fact := to_number(et_ss1) - to_number(st_ss1);
else
mi_fact := (to_number(et_mi1) - to_number(st_mi1))-1;
ss_fact := (to_number(et_ss1)+60) - to_number(st_ss1);
end if;
dbms_output.put_line('<br><br>Total time taken to complete the script: '||hr_fact||' Hrs '||mi_fact||' Mins '||ss_fact||' Secs');
end;
/
spool off
set heading on
set feedback on
set verify on
exit
;
| true |
867f244bfed75db32abaf4f89ab95eaff8243b91 | SQL | kikicat-meows/aA_Classwork | /W5D3/aa_questions/import_db.sql | UTF-8 | 2,508 | 4.28125 | 4 | [] | no_license | PRAGMA foreign_keys = ON;
/*REMEMBER THE SEMICOLON!!*/
/*NO TRAILING COMMAS!!*/
DROP TABLE IF EXISTS question_follows;
DROP TABLE IF EXISTS question_likes;
DROP TABLE IF EXISTS replies;
DROP TABLE IF EXISTS questions;
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id INTEGER PRIMARY KEY,
fname VARCHAR(255) NOT NULL,
lname VARCHAR(255)
);
CREATE TABLE questions(
id INTEGER PRIMARY KEY,
title VARCHAR(255) NOT NULL,
body TEXT NOT NULL,
author_id INTEGER,
FOREIGN KEY (author_id) REFERENCES users(id)
);
CREATE TABLE replies(
id INTEGER PRIMARY KEY,
subject INTEGER,
parent_reply INTEGER,
body TEXT NOT NULL,
author_id INTEGER NOT NULL,
FOREIGN KEY (subject) REFERENCES questions(id),
FOREIGN KEY (parent_reply) REFERENCES replies(id),
FOREIGN KEY (author_id) REFERENCES users(id)
);
CREATE TABLE question_follows(
id INTEGER PRIMARY KEY,
question_id INTEGER NOT NULL,
follower_id INTEGER NOT NULL,
FOREIGN KEY (question_id) REFERENCES questions(id),
FOREIGN KEY (follower_id) REFERENCES users(id)
);
CREATE TABLE question_likes(
id INTEGER PRIMARY KEY,
question_id INTEGER NOT NULL,
like_user_id INTEGER NOT NULL,
FOREIGN KEY (question_id) REFERENCES questions(id),
FOREIGN KEY (like_user_id) REFERENCES users(id)
);
INSERT INTO /*specifies the order we will be supplying values in below*/
users (fname, lname)
VALUES /*,...; <- if you want to add more make sure you separate by commas and end list with semicolon*/
('Helen', 'Cheung'),
('Cody', 'Breene'),
('Sam', 'Walker'),
('Ronil', 'Bhatia');
INSERT INTO
questions (title, body, author_id)
VALUES
('Ruby', 'How do I make a hash?', 1),
('SQL', 'How do I join a table?', 2),
('JavaScript', 'How do I use the while loop for hashes?', 2);
INSERT INTO
replies (subject, parent_reply, body, author_id)
VALUES
(1, NULL, 'Declare new variable with Hash.new(0)', 3),
(2, NULL, 'Name your first table with FROM, then use JOIN before second table', 1),
(2, 2, 'Don''t forget to nickname your two tables after declaring them, and using ON to specify which row', 4),
(3, NULL, 'It''s similar to Ruby syntax, give it a try first then raise your question if you can''t figure it out', 3);
INSERT INTO
question_likes (question_id, like_user_id)
VALUES
(2, 1);
INSERT INTO
question_follows (question_id, follower_id)
VALUES
(2, 1),
(1, 2),
(3, 1);
| true |
1afda075cffd74d52e86731d840688dc195ad0a1 | SQL | JeffreyGallegosCoding/data-design | /sql/oml.sql | UTF-8 | 1,125 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | insert into account(accountId, accountEmail, accountHash)
values (unhex("1a6e8ac0d8a7402580e6ddadb18fc7f1"), "gamer@george.com", "password");
insert into product(productId, productPrice, productDetails)
values (unhex("7d15be8e8a1a434c93a797ee6ecd969c"), "20", "Bloodborne");
insert into cart(cartId, cartAccountId, cartShippingOption, cartQuantity)
values (unhex("7e36a025cdc7493fa4bea15015ebc1fe"), unhex("1a6e8ac0d8a7402580e6ddadb18fc7f1"), 0, 1);
insert into cartProduct(cartProductCartId, cartProductProductId)
values (unhex("7e36a025cdc7493fa4bea15015ebc1fe"), unhex("7d15be8e8a1a434c93a797ee6ecd969c"));
select productId, productPrice, productDetails from product;
update product set productPrice = "30" where productPrice = "20";
delete from cartProduct where cartProductCartId = unhex("7e36a025cdc7493fa4bea15015ebc1fe");
select cartId, cartAccountId, cartShippingOption, cartQuantity from cart
where cartId = unhex ("7e36a025cdc7493fa4bea15015ebc1fe");
select account.accountId, account.accountEmail
from account
inner join cart on account.accountId = cart.cartAccountId
where account.accountEmail = "gamer@george.com";
select count(likeProfileId) from `like` where tweetId = unhex("1ab76fb5655a495bbc0b611952a82488");
| true |
3ee6dd72a9c71795f04f9f26ecf9d92d96bccadb | SQL | Maev4l/celsus-contacts | /tests/scripts/contact.sql | UTF-8 | 1,220 | 3.078125 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS "contact"
(
id VARCHAR(36) NOT NULL,
user_id VARCHAR(36) NOT NULL,
nickname VARCHAR(100) NOT NULL,
thumbnail TEXT,
CONSTRAINT contact_id_key UNIQUE (id)
)
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
-- for test update
INSERT INTO "contact" ("id", "user_id", "nickname", "thumbnail")VALUES ('1000', 'user1', 'contact-1', 'thumbnail-1');
-- for test get
INSERT INTO "contact" ("id", "user_id", "nickname", "thumbnail")VALUES ('1001', 'user2', 'contact-z-1', 'thumbnail-1');
INSERT INTO "contact" ("id", "user_id", "nickname", "thumbnail")VALUES ('1002', 'user2', 'contact-a-2', 'thumbnail-2');
-- for test delete
INSERT INTO "contact" ("id", "user_id", "nickname", "thumbnail")VALUES ('1003', 'user3', 'contact-z-1', 'thumbnail-1');
-- for test delete if book borrowed
INSERT INTO "contact" ("id", "user_id", "nickname", "thumbnail")VALUES ('1004', 'user4', 'contact-z-1', 'thumbnail-1');
-- for borrower validation
INSERT INTO "contact" ("id", "user_id", "nickname", "thumbnail")VALUES ('1005', 'user5', 'contact-1005', '');
-- for return book use case
INSERT INTO "contact" ("id", "user_id", "nickname", "thumbnail")VALUES ('1006', 'user6', 'contact-1006', ''); | true |
dccd6272bb3477b7fc89aecd1adf4bbe11cbc6c0 | SQL | irmasftri/Tubes-Basdat | /BASDAT/TUBES-PBO-master/DataBase/smiati_update.sql | UTF-8 | 3,550 | 3.140625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: May 02, 2019 at 01:21 PM
-- Server version: 10.1.9-MariaDB
-- PHP Version: 7.0.0
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `smiati`
--
-- --------------------------------------------------------
--
-- Table structure for table `adminakun`
--
CREATE TABLE `adminakun` (
`Username` varchar(20) NOT NULL,
`Password` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `adminakun`
--
INSERT INTO `adminakun` (`Username`, `Password`) VALUES
('admin', 'admin'),
('Hiskia', '1234567');
-- --------------------------------------------------------
--
-- Table structure for table `akunalumni`
--
CREATE TABLE `akunalumni` (
`Password` varchar(30) NOT NULL,
`NIM` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `akunalumni`
--
INSERT INTO `akunalumni` (`Password`, `NIM`) VALUES
('1999-01-22', '14117067'),
('1999-01-03', '14117071'),
('2000-02-21', '14117086'),
('1999-01-01', '14117091');
-- --------------------------------------------------------
--
-- Table structure for table `alumni`
--
CREATE TABLE `alumni` (
`NIM` varchar(10) NOT NULL,
`NAMA` varchar(25) NOT NULL,
`Tahun_Lulus` char(4) NOT NULL,
`Tempat_KP` varchar(30) NOT NULL,
`IPK` double NOT NULL,
`Riwayat_Kerja` varchar(30) NOT NULL,
`Judul_TA` varchar(30) NOT NULL,
`email` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `alumni`
--
INSERT INTO `alumni` (`NIM`, `NAMA`, `Tahun_Lulus`, `Tempat_KP`, `IPK`, `Riwayat_Kerja`, `Judul_TA`, `email`) VALUES
('14117067', 'Irma Safitri', '2019', '', 4, '', '', 'irma.14117067@student.itera.ac.id'),
('14117071', 'nurul fauziah azizah', '2021', '-', 3.4, 'oss', '-', '-'),
('14117086', 'Nurtias Rahayu', '2019', '', 3, '', '', 'nurtias.14117086@student.itera.ac.id'),
('14117091', 'Hiskia Perdamen Pulungan', '2021', 'jakarta', 3, '', '', 'hiskia.14117091@student.itera.ac.id');
-- --------------------------------------------------------
--
-- Table structure for table `lowongan_kerja`
--
CREATE TABLE `lowongan_kerja` (
`nama_perusahaan` varchar(30) NOT NULL,
`jabatan` varchar(25) NOT NULL,
`email` varchar(30) NOT NULL,
`alamat` varchar(40) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `lowongan_kerja`
--
INSERT INTO `lowongan_kerja` (`nama_perusahaan`, `jabatan`, `email`, `alamat`) VALUES
('Buka Lapak', 'Programmer', 'customerservice@buka-lapak.com', 'Jakarta');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `adminakun`
--
ALTER TABLE `adminakun`
ADD PRIMARY KEY (`Username`);
--
-- Indexes for table `akunalumni`
--
ALTER TABLE `akunalumni`
ADD PRIMARY KEY (`NIM`),
ADD KEY `NIM` (`NIM`);
--
-- Indexes for table `alumni`
--
ALTER TABLE `alumni`
ADD PRIMARY KEY (`NIM`);
--
-- Indexes for table `lowongan_kerja`
--
ALTER TABLE `lowongan_kerja`
ADD PRIMARY KEY (`email`);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `akunalumni`
--
ALTER TABLE `akunalumni`
ADD CONSTRAINT `akunalumni_ibfk_1` FOREIGN KEY (`NIM`) REFERENCES `alumni` (`NIM`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
0d4c6f9863b792997f45bd4186eac70155ad6f5f | SQL | Seas-dev/Coding-Dojo-Work | /MySQL/sample databases/twitter.sql | UTF-8 | 96 | 2.78125 | 3 | [] | no_license | select region, count(id) as countries
from countries
group by region
order by count(id) desc;
| true |
fd52877c1232e4a829563bb68eac5509cfa099cf | SQL | eltonmesquita87/test | /jose-typescript-nodejs-authentication/sql/schedule/billing_center/27-Error QUEUE PolicySystem.sql | UTF-8 | 122 | 2.609375 | 3 | [] | no_license | select distinct m.payload, m.ErrorDescription from bc_message m
where destinationid = 32
and errordescription is not null
| true |
2e644527c4b4c44279e9d41b3bcca53cae915539 | SQL | eduardo-villasboas/transaction-manager | /src/main/resources/db/changelog/scripts/2020-11-07_CREATE_ACCOUNT_TABLE.sql | UTF-8 | 382 | 2.953125 | 3 | [] | no_license | --liquibase formatted sql
--changeset eduardo-villasboas:2020-11-07_01 author:eduardo-villasboas
CREATE TABLE account (
account_id UUID NOT NULL,
document_number BIGINT NOT NULL,
CONSTRAINT account_pkey PRIMARY KEY (account_id)
);
CREATE UNIQUE INDEX account_account_id_index ON account(account_id);
--rollback DROP index account_account_id_index;
--rollback DROP TABLE account;
| true |
3cdd6b7c8c931c2798b7edd21b65b9d54ee1f1a5 | SQL | 7aske/uni | /se321/se321-pz-nikola_tasic_3698/ddl/rzp.ddl | UTF-8 | 6,390 | 3.671875 | 4 | [] | no_license | #create database if not exists `rzp-database`;
#use `rzp-database`;
#
#create user if not exists 'rzp-root'@'localhost' identified by 'rzp-root';
#grant all on `rzp-database`.* to 'rzp-root'@'localhost';
set foreign_key_checks = 0;
drop table if exists `category`;
create table `category`
(
`category_id` int auto_increment primary key,
`name` varchar(64) not null unique,
-- auditable
`created_date` timestamp default current_timestamp(),
`last_modified_by` varchar(32) default 'system',
`last_modified_date` timestamp default current_timestamp(),
`record_status` int default 1
) comment 'Blog post category';
drop table if exists `media`;
create table `media`
(
`media_id` int auto_increment primary key,
`uri` varchar(2048) not null unique,
-- auditable
`created_date` timestamp default current_timestamp(),
`last_modified_by` varchar(32) default 'system',
`last_modified_date` timestamp default current_timestamp(),
`record_status` int default 1
) comment 'Uploaded image shown on the blog post';
drop table if exists `role`;
create table `role`
(
`role_id` int auto_increment primary key,
`name` varchar(32) not null unique,
-- auditable
`created_date` timestamp default current_timestamp(),
`last_modified_by` varchar(32) default 'system',
`last_modified_date` timestamp default current_timestamp(),
`record_status` int default 1
) comment 'User permissions';
drop table if exists `tag`;
create table `tag`
(
`tag_id` int auto_increment primary key,
`name` varchar(32) not null unique,
-- auditable
`created_date` timestamp default current_timestamp(),
`last_modified_by` varchar(32) default 'system',
`last_modified_date` timestamp default current_timestamp(),
`record_status` int default 1
) comment 'Blog post tag';
drop table if exists `user`;
create table `user`
(
`user_id` int auto_increment primary key,
`username` varchar(32) not null,
`password` varchar(512) not null,
`email` varchar(32) not null,
`first_name` varchar(32) not null,
`last_name` varchar(32) not null,
`about` text null,
`display_name` varchar(32) not null,
-- auditable
`created_date` timestamp default current_timestamp(),
`last_modified_by` varchar(32) default 'system',
`last_modified_date` timestamp default current_timestamp(),
`record_status` int default 1
) comment 'Blog user or author';
drop table if exists `contact`;
create table `contact`
(
`contact_id` int auto_increment primary key,
`contact_type` varchar(32) not null,
`user_fk` int not null,
`value` varchar(128) not null,
-- auditable
`created_date` timestamp default current_timestamp(),
`last_modified_by` varchar(32) default 'system',
`last_modified_date` timestamp default current_timestamp(),
`record_status` int default 1,
constraint `fk_user_contact` foreign key (`user_fk`) references `user` (`user_id`)
) comment 'User contact information entry';
drop table if exists `post`;
create table `post`
(
`post_id` int auto_increment primary key,
`user_fk` int null,
`category_fk` int not null,
`title` varchar(255) not null,
`excerpt` text not null,
`body` text not null,
`deleted` tinyint(1) default 0 null,
`published` tinyint(1) default 0 null,
`views` bigint null,
`slug` varchar(64) not null,
-- auditable
`created_date` timestamp default current_timestamp(),
`last_modified_by` varchar(32) default 'system',
`last_modified_date` timestamp default current_timestamp(),
`record_status` int default 1,
constraint `fk_post_author` foreign key (`user_fk`) references `user` (`user_id`)
on update cascade on delete set null,
constraint `fk_post_category` foreign key (`category_fk`) references `category` (`category_id`)
on update cascade on delete restrict
) comment 'Blog post';
drop table if exists `comment`;
create table `comment`
(
`comment_id` int auto_increment primary key,
`user_fk` int not null,
`post_fk` int null,
`body` text not null,
-- auditable
`created_date` timestamp default current_timestamp(),
`last_modified_by` varchar(32) default 'system',
`last_modified_date` timestamp default current_timestamp(),
`record_status` int default 1,
constraint `fk_post_comment` foreign key (`post_fk`) references `post` (`post_id`)
on update cascade on delete cascade,
constraint `fk_user_comment` foreign key (`user_fk`) references `user` (`user_id`)
on update cascade on delete cascade
) comment 'User comment on a post';
drop table if exists `post_tag`;
create table `post_tag`
(
`tag_fk` int not null,
`post_fk` int not null,
primary key (`tag_fk`, `post_fk`),
constraint `fk_post_tag_tag` foreign key (`tag_fk`) references `tag` (`tag_id`)
on update cascade on delete cascade,
constraint `fk_post_tag_post` foreign key (`post_fk`) references `post` (`post_id`)
on update cascade on delete cascade
);
drop table if exists `user_role`;
create table `user_role`
(
`role_fk` int not null,
`user_fk` int not null,
primary key (`role_fk`, `user_fk`),
constraint fk_user_role_role foreign key (`role_fk`) references `role` (`role_id`)
on update cascade on delete cascade,
constraint fk_user_role_user foreign key (`user_fk`) references `user` (`user_id`)
on update cascade on delete cascade
);
set foreign_key_checks = 1; | true |
d830c36d1c73dcb9c41662ca028b99a062ae5c5b | SQL | mateoqac/raktv | /db/structure.sql | UTF-8 | 7,982 | 3.265625 | 3 | [] | no_license | SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: video_quality; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.video_quality AS ENUM (
'hd',
'sd'
);
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: episodes; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.episodes (
id bigint NOT NULL,
title character varying,
plot character varying,
episode_number integer,
season_id bigint,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: episodes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.episodes_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: episodes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.episodes_id_seq OWNED BY public.episodes.id;
--
-- Name: movies; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.movies (
id bigint NOT NULL,
title character varying,
plot character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: movies_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.movies_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: movies_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.movies_id_seq OWNED BY public.movies.id;
--
-- Name: purchases; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.purchases (
id bigint NOT NULL,
expires_at timestamp without time zone NOT NULL,
price numeric(10,2) NOT NULL,
user_id integer,
purchasable_id integer NOT NULL,
purchasable_type character varying NOT NULL,
active boolean DEFAULT true,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
video_quality public.video_quality
);
--
-- Name: purchases_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.purchases_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: purchases_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.purchases_id_seq OWNED BY public.purchases.id;
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.schema_migrations (
version character varying NOT NULL
);
--
-- Name: seasons; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.seasons (
id bigint NOT NULL,
title character varying,
plot character varying,
number integer,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: seasons_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.seasons_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: seasons_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.seasons_id_seq OWNED BY public.seasons.id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.users (
id bigint NOT NULL,
email character varying,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL
);
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- Name: episodes id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.episodes ALTER COLUMN id SET DEFAULT nextval('public.episodes_id_seq'::regclass);
--
-- Name: movies id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.movies ALTER COLUMN id SET DEFAULT nextval('public.movies_id_seq'::regclass);
--
-- Name: purchases id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.purchases ALTER COLUMN id SET DEFAULT nextval('public.purchases_id_seq'::regclass);
--
-- Name: seasons id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.seasons ALTER COLUMN id SET DEFAULT nextval('public.seasons_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
--
-- Name: episodes episodes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.episodes
ADD CONSTRAINT episodes_pkey PRIMARY KEY (id);
--
-- Name: movies movies_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.movies
ADD CONSTRAINT movies_pkey PRIMARY KEY (id);
--
-- Name: purchases purchases_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.purchases
ADD CONSTRAINT purchases_pkey PRIMARY KEY (id);
--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
--
-- Name: seasons seasons_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.seasons
ADD CONSTRAINT seasons_pkey PRIMARY KEY (id);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: index_episodes_on_season_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_episodes_on_season_id ON public.episodes USING btree (season_id);
--
-- Name: index_episodes_on_title; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_episodes_on_title ON public.episodes USING btree (title);
--
-- Name: index_movies_on_title; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_movies_on_title ON public.movies USING btree (title);
--
-- Name: index_purchases_on_user_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_purchases_on_user_id ON public.purchases USING btree (user_id);
--
-- Name: index_seasons_on_title; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_seasons_on_title ON public.seasons USING btree (title);
--
-- Name: index_unique_purchase_active_per_user; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_unique_purchase_active_per_user ON public.purchases USING btree (user_id, purchasable_id, purchasable_type, active);
--
-- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_users_on_email ON public.users USING btree (email);
--
-- PostgreSQL database dump complete
--
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
('20210124234040'),
('20210124234048'),
('20210124234054'),
('20210124234100'),
('20210124234105'),
('20210125151838');
| true |
88b1aa5465223225c3923a78e42f231c200f6664 | SQL | agzsoftsi/holbertonschool-web_back_end | /0x0C-MySQL_Advanced/5-valid_email.sql | UTF-8 | 299 | 3.4375 | 3 | [] | no_license |
-- Task 5: Email validation to sent - creates a trigger that resets the attribute valid_email
-- only when the email has been changed
DELIMITER |
CREATE TRIGGER email_bool BEFORE UPDATE ON users
FOR EACH ROW
BEGIN
IF NEW.email <> OLD.email THEN
SET NEW.valid_email = 0;
END IF;
END;
| | true |
267ea2d08825e1fa1bc658847a020ed465d9775a | SQL | orbs-network/marvin | /docker/mysql/cre-events.sql | UTF-8 | 567 | 2.515625 | 3 | [] | no_license | CREATE TABLE `events`
(
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`event_start` datetime NOT NULL,
`event_end` datetime DEFAULT NULL,
`vchain` varchar(50) DEFAULT '',
`description` varchar(200) DEFAULT '',
`tag1` varchar(16) DEFAULT '',
`tag2` varchar(16) DEFAULT '',
`semantic_version` varchar(50) DEFAULT '',
`commit_hash` varchar(50) DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
AUTO_INCREMENT = 10
DEFAULT CHARSET = latin1; | true |
267d44e6993c78c8fb1f6af4164264f7a16a782c | SQL | ComptonMSHI/hcris-mssql | /validation-counts.sql | UTF-8 | 2,347 | 2.859375 | 3 | [
"MIT"
] | permissive | /*
hosp10 RECORD COUNTS BY YEAR FOR THE QUARTER ENDING 2018-03-31 [hosp10.hosp10]
FY RPT count ALPHA count NMRC count
2010 2322 1347622 7397272
2011 6150 3534353 19341879
2012 6227 3594970 19687768
2013 6248 3664554 19907610
2014 6247 3659511 19809785
2015 6255 3637134 19661609
2016 6158 3595530 19406811
2017 900 545037 3090913
TOTAL 40507 23578711 128303647
Ref: https://www.cms.gov/Research-Statistics-Data-and-Systems/Downloadable-Public-Use-Files/Cost-Reports/Hospital-2010-form.html
*/
SELECT COUNT(*) FROM MCR_NEW_NMRC WHERE FORM='2552-10'; -- 128303647
SELECT COUNT(*) FROM MCR_NEW_ALPHA WHERE FORM='2552-10'; -- 24258452 (HIGHER July Release)
SELECT COUNT(*) FROM MCR_NEW_RPT WHERE FORM='2552-10'; -- 44392 (HIGHER July Release)
SELECT COUNT(*) FROM mcrFormData_Nmrc WHERE FORM='2552-10'; -- 128303647
SELECT COUNT(*) FROM mcrFormData_Alpha WHERE FORM='2552-10'; -- 17948807
SELECT COUNT(*) FROM mcrFormData_Alpha_Desc WHERE FORM='2552-10'; -- 6309645
/*
HOSP RECORD COUNTS BY YEAR FOR THE QUARTER ENDING 2018-03-31 [HOSP.HOSP]
FY RPT count ALPHA count NMRC count
1995 2 141 2878
1996 6062 670885 12478350
1997 6380 739823 13469799
1998 6327 808358 13439896
1999 6210 832186 13272836
2000 6195 888780 13745150
2001 6172 966385 11906388
2002 6198 1031855 11287953
2003 6193 1083900 11093105
2004 6265 1053055 11089783
2005 6248 1078823 10989728
2006 6233 1087420 10826659
2007 6180 1068909 10618244
2008 6208 1082755 10534639
2009 6202 1080751 10398870
2010 3851 675420 6382242
2011 34 4321 33641
TOTAL 90960 14153767 171570161
*/
SELECT COUNT(*) FROM MCR_NEW_NMRC WHERE FORM='2552-96'; -- 171570161
SELECT COUNT(*) FROM MCR_NEW_ALPHA WHERE FORM='2552-96'; -- 14153767
SELECT COUNT(*) FROM MCR_NEW_RPT WHERE FORM='2552-96'; -- 90960
SELECT COUNT(*) FROM mcrFormData_Nmrc WHERE FORM='2552-96'; -- 171570161
SELECT COUNT(*) FROM mcrFormData_Alpha WHERE FORM='2552-96'; -- 7629799
SELECT COUNT(*) FROM mcrFormData_Alpha_Desc WHERE FORM='2552-96'; -- 6523968
SELECT COUNT(*) FROM mcrFormData_Nmrc; -- 299873808
SELECT COUNT(*) FROM mcrFormData_Alpha; -- 25578606
-- 325,452,414
SELECT COUNT(*) FROM mcrFormData; -- 46052696
SELECT COUNT(*) FROM mcrMeasures; -- 130169
| true |
6d35758332b2a89e93efc1ecc350b22e83a0d554 | SQL | soniakshay/online-mobile-reparing | /project.sql | UTF-8 | 6,997 | 2.921875 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Feb 05, 2016 at 03:06 AM
-- Server version: 10.1.9-MariaDB
-- PHP Version: 5.6.15
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `project`
--
-- --------------------------------------------------------
--
-- Table structure for table `comname`
--
CREATE TABLE `comname` (
`comid` int(20) NOT NULL,
`comname` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `comname`
--
INSERT INTO `comname` (`comid`, `comname`) VALUES
(1, 'samsung'),
(2, 'Nokia '),
(6, 'Asus'),
(7, 'radmi');
-- --------------------------------------------------------
--
-- Table structure for table `login`
--
CREATE TABLE `login` (
`id` int(20) NOT NULL,
`uname` varchar(50) NOT NULL,
`pwd` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `login`
--
INSERT INTO `login` (`id`, `uname`, `pwd`) VALUES
(1, 'admin', '123');
-- --------------------------------------------------------
--
-- Table structure for table `product`
--
CREATE TABLE `product` (
`proid` int(20) NOT NULL,
`comid` int(20) NOT NULL,
`proname` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `product`
--
INSERT INTO `product` (`proid`, `comid`, `proname`) VALUES
(8, 6, 'Zenfon Laser 2'),
(12, 2, 'N72'),
(13, 1, 'galaxy Y');
-- --------------------------------------------------------
--
-- Table structure for table `ragister`
--
CREATE TABLE `ragister` (
`rid` int(20) NOT NULL,
`cname` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`phoneno` varchar(100) NOT NULL,
`addr` varchar(100) NOT NULL,
`model` varchar(100) NOT NULL,
`imei` varchar(100) NOT NULL,
`detail` varchar(50) NOT NULL,
`stocknm1` varchar(100) NOT NULL,
`qty1` int(20) NOT NULL,
`stocknm2` varchar(100) NOT NULL,
`qty2` int(20) NOT NULL,
`stocknm3` varchar(100) NOT NULL,
`qty3` int(20) NOT NULL,
`stocknm4` varchar(100) NOT NULL,
`qty4` int(20) NOT NULL,
`price` int(20) NOT NULL,
`date` varchar(100) NOT NULL,
`edate` varchar(100) NOT NULL,
`status` int(11) NOT NULL,
`tachid` int(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ragister`
--
INSERT INTO `ragister` (`rid`, `cname`, `email`, `phoneno`, `addr`, `model`, `imei`, `detail`, `stocknm1`, `qty1`, `stocknm2`, `qty2`, `stocknm3`, `qty3`, `stocknm4`, `qty4`, `price`, `date`, `edate`, `status`, `tachid`) VALUES
(78, 'akshay', 'akshayysonii@yahoo.in', '8000623262', ' anand', 'zenfone2', '85858', 'Damage', '21', 1, '', 0, '', 0, '21', 0, 700, '04-02-2015', '12-10-2015', 1, 8),
(79, 'milan', 'milan@gmail.com', '87877878', 'anand', 'zenfone2', '8777', 'Water Damage', '21', 1, '', 0, '', 0, '', 0, 700, '06-02-2015', '10-12-2015', 1, 0),
(80, 'yagnic', 'ya@gmailcom', '787878', 'nand', 'zenfone2', '8787878', 'Damage', '22', 1, '', 0, '', 0, '', 0, 200, '04-02-2016', '06-02-2016', 0, 8),
(81, 'kano', 'kano@gmail.com', '878788', 'anand', 'zenfone2', '444444', 'damage', '22', 1, '', 0, '', 0, '', 0, 300, '04-02-2016', '04-02-2016', 0, 8);
-- --------------------------------------------------------
--
-- Table structure for table `report`
--
CREATE TABLE `report` (
`id` int(20) NOT NULL,
`techid` int(20) NOT NULL,
`stockid` int(20) NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`phno` int(20) NOT NULL,
`add` varchar(50) NOT NULL,
`imei` varchar(50) NOT NULL,
`battryno` varchar(50) NOT NULL,
`date` varchar(50) NOT NULL,
`estdate` varchar(50) NOT NULL,
`status` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `stock`
--
CREATE TABLE `stock` (
`stockid` int(20) NOT NULL,
`proid` int(20) NOT NULL,
`stocknm` varchar(50) NOT NULL,
`qty` int(50) NOT NULL,
`date` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `stock`
--
INSERT INTO `stock` (`stockid`, `proid`, `stocknm`, `qty`, `date`) VALUES
(21, 8, 'lcd', 25, '2016-01-23'),
(22, 8, 'mic', 26, '2016-01-23'),
(23, 8, 'speaker', 30, '2016-01-23'),
(24, 8, 'motherbord', 30, '2016-01-23'),
(25, 8, 'touchpad', 30, '2016-01-23'),
(26, 8, 'ic', 30, '2016-01-23'),
(27, 8, 'connector', 30, '2016-01-23'),
(28, 12, 'lcd', 29, '2016-01-23'),
(29, 12, 'mic', 30, '2016-01-23'),
(30, 12, 'speaker', 30, '2016-01-23');
-- --------------------------------------------------------
--
-- Table structure for table `technision`
--
CREATE TABLE `technision` (
`techid` int(20) NOT NULL,
`tachname` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `technision`
--
INSERT INTO `technision` (`techid`, `tachname`) VALUES
(8, 'purv '),
(10, 'akshay');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `comname`
--
ALTER TABLE `comname`
ADD PRIMARY KEY (`comid`);
--
-- Indexes for table `login`
--
ALTER TABLE `login`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `uname` (`uname`),
ADD UNIQUE KEY `id` (`id`);
--
-- Indexes for table `product`
--
ALTER TABLE `product`
ADD PRIMARY KEY (`proid`);
--
-- Indexes for table `ragister`
--
ALTER TABLE `ragister`
ADD PRIMARY KEY (`rid`);
--
-- Indexes for table `report`
--
ALTER TABLE `report`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stock`
--
ALTER TABLE `stock`
ADD PRIMARY KEY (`stockid`);
--
-- Indexes for table `technision`
--
ALTER TABLE `technision`
ADD PRIMARY KEY (`techid`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `comname`
--
ALTER TABLE `comname`
MODIFY `comid` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT for table `login`
--
ALTER TABLE `login`
MODIFY `id` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `product`
--
ALTER TABLE `product`
MODIFY `proid` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
--
-- AUTO_INCREMENT for table `ragister`
--
ALTER TABLE `ragister`
MODIFY `rid` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=82;
--
-- AUTO_INCREMENT for table `report`
--
ALTER TABLE `report`
MODIFY `id` int(20) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stock`
--
ALTER TABLE `stock`
MODIFY `stockid` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=31;
--
-- AUTO_INCREMENT for table `technision`
--
ALTER TABLE `technision`
MODIFY `techid` int(20) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| true |
6494defe24041e0d67662abb7406d208ce48d853 | SQL | nisarg291/Training-Aug-21 | /SQL/chirag/day 5/day 5(queries).sql | UTF-8 | 1,881 | 4.15625 | 4 | [] | no_license | /*SELECT * FROM Employees
create table Incentive
(
Incentives_ID int,
Incentives_Date date,
Incentives_Amount int,
EmployeeID decimal(6,0) cONstraint fk foreign key references Employees(EmployeeID)
)
create table Manager
(
ManagerID decimal(6,0),
ManagerName varchar(23)
)
Insert into manager values('100','karan')
Insert into manager values('103','mukesh')
Insert into manager values('108','meet')
EmployeeID decimal(6,0) cONstraint fk foreign key references Employees(EmployeeID)
)
drop table Incentive
delete table
seleIncentive
Insert into Incentive values(2,'1990-08-17','12000','102')
Insert into Incentive values(3,'1987-09-18','500','103')
Insert into Incentive values(5,'1989-12-14','3500','104')
Insert into Incentive values(4,'1989-06-14','5000','108')
Insert into Incentive values(1,'1991-11-14','3500','101')
delete FROM Incentive
SELECT * FROM Employees e
INNER JOIN Incentive i
ON e.EmployeeID = i.EmployeeID
*/
--Q1 Get difference between JOINING_DATE and INCENTIVE_DATE FROM employee and incentives table
SELECT * ,datediff(dd,E.Hiredate,I.Incentive_Date) FROM Incentive I INNER JOIN Employees E ON I.EmployeeID = E.EmployeeID
--Q2SELECT first_name, incentive amount FROM employee and incentives table for those employees who have incentives and incentive amount greater than 3000
SELECT E.FirstName,I.Incentive_Amount FROM Incentive I LEFT JOIN Employees E ON I.EmployeeID=E.EmployeeID where I.Incentive_Amount>3000
--q3 SELECT first_name, incentive amount FROM employee and incentives table for all employees even if they didn๏ฟฝt get incentives.
SELECT E.FirstName, I.Incentive_Amount FROM Incentive I RIGHT JOIN Employees E ON I.EmployeeID=E.EmployeeID
--q4 SELECT EmployeeName, ManagerName FROM the employee table.
SELECT E.FirstName,M.ManagerName FROM Manager M LEFT JOIN Employees E ON M.ManagerID=E.ManagerID
| true |
b38fad7ac42591daf45b62b11e6b006b009d88de | SQL | jm-park/sql | /[Where]595_Big Countries.sql | UTF-8 | 269 | 3.125 | 3 | [] | no_license | # [LeetCode] 595. Big Countries
# https://leetcode.com/problems/big-countries/solution/
# it has an area of bigger than 3 million square km or a population of more than 25 million.
SELECT name, population, area
FROM World
WHERE area > 3000000
OR population > 25000000
| true |
86f3101b37e6517ad6644e18de0866cded1c6b3c | SQL | a-bemporad/Astrid-Alejandra | /semana16/exerciciosSQL/Actor.sql | UTF-8 | 1,565 | 3.703125 | 4 | [] | no_license | CREATE TABLE Actor (
id VARCHAR(255) PRIMARY KEY,
name VARCHAR(255) NOT NULL,
salary FLOAT NOT NULL,
birth_date DATE NOT NULL,
gender VARCHAR(6) NOT NULL
);
INSERT INTO Actor (id, name, salary, birth_date, gender)
VALUES("001", "Tony Ramos" ,400000, "1948-08-25", "male");
INSERT INTO Actor (id, name, salary, birth_date, gender)
VALUES ("002", "Glรณria Pires", 1200000, "1963-08-23", "female");
INSERT INTO Actor (id, name, salary, birth_date, gender)
VALUES ("003", "Fernanda Montenegro", 300000, "1929-10-19", "female");
INSERT INTO Actor (id, name, salary, birth_date, gender)
VALUES ("004", "Antรดnio Fagundes", 400000, "1949-04-18", "male");
INSERT INTO Actor (id, name, salary, birth_date, gender)
VALUES ("005", "Juliana Paes", 719333.33, "1979-03-26", "female");
INSERT INTO Actor (id, name, salary, birth_date, gender)
VALUES ("006", "Tarcรญsio Meira", 200000, "1935-10-05", "male");
INSERT INTO Actor (id, name, salary, birth_date, gender)
VALUES ("007", "Maria Flor", 100000, "1983-08-31", "female");
SELECT * FROM Actor;
SELECT id, salary FROM Actor;
SELECT id, name FROM Actor WHERE gender = "male";
SELECT * FROM Actor WHERE gender = "female";
SELECT salary FROM Actor WHERE name = "Tony Ramos";
SELECT id, name, salary FROM Actor WHERE salary <= 500000;
SELECT id, name FROM Actor WHERE id="002";
SELECT * FROM Actor WHERE (name LIKE "a%" OR name LIKE "j%") AND salary > 300000;
SELECT * FROM Actor WHERE name NOT LIKE "a%" AND salary > 350000;
SELECT * FROM Actor WHERE name LIKE "%g%";
SELECT * FROM Actor WHERE (name LIKE "%a%" OR name LIKE "%g%") AND salary BETWEEN 350000 AND 900000;
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.