procedure

PL/SQL procedure: UPDATE uppercase names to initcaps, with special handling for some values

☆樱花仙子☆ 提交于 2019-12-06 04:18:57
I need a procedure to do something like this: original name: AMSTERDAM new name: Amsterdam. I made this procedure for it: create or replace PROCEDURE NaamRoutine is BEGIN update Gemeentenew set gemeentenaam = lower(gemeentenaam); update Gemeentenew set gemeentenaam = initcap(gemeentenaam); END; The problem is there are a couple of names that start like 'S GRAVENHAGE and need to be 's Gravenhage. Frank Schmitt Assuming the special handling is necessary only for names like 'S... , adding a simple REPLACE should work. BTW, you don't need two separate UPDATE statements - INITCAP will automatically

What is pros and cons of calling procedures in VB.NET?

南笙酒味 提交于 2019-12-06 01:39:54
问题 I would like to know the pros and cons of calling procedures with Call Keyword and without Call in VB.NET? Private Sub ProOne() ' Code Are Here End Sub Private Sub Calling() ProOne() ' I would like to know pros and cons of this Call ProOne() ' And I would like to know pros and cons of this End Sub Thanks in advance all. 回答1: From here: You normally use the Call statement to call a procedure that does not return a value. If the procedure returns a value, the Call statement discards it. You are

Procedure mysql with cursor is too slow.. Why?

房东的猫 提交于 2019-12-06 00:04:12
I create a Mysql procedure using cursor, but it's run too slow... It's get between 40 and 60 lines by second.. See: DELIMITER $$ CREATE PROCEDURE sp_create(IN v_idsorteio INT,OUT afetados INT) BEGIN DECLARE done INT default 0; DECLARE vc_idsocio INT; DECLARE z INT; DECLARE cur1 CURSOR FOR select IdSocio from socios where Sorteio=1 and Finalizado='S' and CodClientes IS NOT NULL; DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done=1; SET z=1; OPEN cur1; FETCH cur1 INTO vc_idsocio; WHILE done=0 DO -- SELECT register as t; insert INTO socios_numeros_sorteio (IdSocio,IdSorteio,NumerodeSorteio)

Binary Trees Count Number of Leaves

拜拜、爱过 提交于 2019-12-04 21:47:05
Suppose you already have the basic binary tree procedures isempty(bt), root(bt), left(bt), and right(bt). Write a procedure isLeaf(bt) that returns true if the binary tree bt is a leaf node and false if it is not. This is what I have: proc isLeaf(bt) if (isEmpty(bt)) error('The binary tree is empty.'); elseif (left(bt) < right(bt)) return true; else return false; Then write a procedure numLeaves(bt) that returns the number of leaves in the binary tree bt. This is what I have: proc numLeaves(bt) if (isEmpty(bt)) error ('The binary tree is empty.'); elseif (count left(bt) + right(bt)); return

Is it possible to have generic type in vhdl?

为君一笑 提交于 2019-12-04 14:53:45
Is there a way in VHDL to have generic types? So for example I want to call a procedure but I'm not sure what type the signal has I want to give as paarameter, is it possible to declare the parameter as generic? Like in C++ you would use a Template. procedure eq_checker(name : string; sig : ANYTHING); should : ANYTHING; at : time) is if (at = now) then if sig = should then report "has same value" severity note; else report "has not same value" severity note; end if; end if; end checker; At least it should be possible to use different signal types as "sig". The Peter Ashenden and Jim Lewis book

What is pros and cons of calling procedures in VB.NET?

早过忘川 提交于 2019-12-04 06:24:52
I would like to know the pros and cons of calling procedures with Call Keyword and without Call in VB.NET? Private Sub ProOne() ' Code Are Here End Sub Private Sub Calling() ProOne() ' I would like to know pros and cons of this Call ProOne() ' And I would like to know pros and cons of this End Sub Thanks in advance all. From here : You normally use the Call statement to call a procedure that does not return a value. If the procedure returns a value, the Call statement discards it. You are not required to use the Call statement when calling a procedure. However, it improves the readability of

Oracle之PL/SQL学习笔记之包

馋奶兔 提交于 2019-12-04 05:06:14
Oracle之PL/SQL学习笔记之包 1. 认识包(package) 1.1 什么是包 包是一组相关过程、函数、变量、常量和游标等PL/SQL程序设计元素的组合,它具有面向对象程序设计语言的特点,是对这些PL/SQL 程序设计元素的封装。包类似于C++和JAVA语言中的类,其中变量相当于类中的成员变量,过程和函数相当于类方法。把相关的模块归类成为包,可使开发人员利用面向对象的方法进行存储过程的开发,从而提高系统性能。 与类相同,包中的程序元素也分为公用元素和私用元素两种,这两种元素的区别是他们允许访问的程序范围不同,即它们的作用域不同。公用元素不仅可以被包中的函数、过程所调用,也可以被包外的PL/SQL程序访问,而私有元素只能被包内的函数和过程序所访问。 在PL/SQL程序设计中,使用包不仅可以使程序设计模块化,对外隐藏包内所使用的信息(通过使用私用变量),而且可以提高程序的执行效率。因为,当程序首次调用包内函数或过程时,ORACLE将整个包调入内存,当再次访问包内元素时,ORACLE直接从内存中读取,而不需要进行磁盘I/O操作,从而使程序执行效率得到提高 1.2 包的组成 一个包由两个分开的部分组成: 包定义(PACKAGE):包定义部分声明包内数据类型、变量、常量、游标、子程序和异常错误处理等元素,这些元素为包的公有元素。 包主体(PACKAGE BODY)

%ROWTYPE variable from table name

心不动则不痛 提交于 2019-12-04 02:49:01
问题 I've got an Oracle procedure, that I want to be somehow generic. I would like to: pass a table name as a varchar parameter use EXECUTE IMMEDIATE to dynamically select data store the result in the %ROWTYPE variable of passed type The third point seems to be a problem. I'm not sure if i can create a type dynamically inside the procedure body. It would be great to have something like this: procedure CHANGE_GENERIC(tableName in VARCHAR2, someOldVal in integer, someNewVal in integer) is v_sql

using comma separated values inside IN clause for NUMBER column

人盡茶涼 提交于 2019-12-03 18:07:52
问题 I have 2 procedures inside a package. I am calling one procedure to get a comma separated list of user ids. I am storing the result in a VARCHAR variable. Now when I am using this comma separated list to put inside an IN clause in it is throwing " ORA-01722:INVALID NUMBER" exception. This is how my variable looks like l_userIds VARCHAR2(4000) := null; This is where i am assigning the value l_userIds := getUserIds(deptId); -- this returns a comma separated list And my second query is like -

Can an SQL procedure return a table?

半世苍凉 提交于 2019-12-03 15:08:01
Can an Oracle SQL procedure return a table? I'm currently using a dbms_output to print out the outputs of two cursors which are in a loop, although this would look nicer if it was returning two columns instead. Would that be possible within a procedure? A PL/SQL function can return a nested table. Provided we declare the nested table as a SQL type we can use it as the source of a query, using the the TABLE() function . Here is a type, and a nested table built from it: SQL> create or replace type emp_dets as object ( 2 empno number, 3 ename varchar2(30), 4 job varchar2(20)); 5 / Type created.