procedure

Delphi function, Not allowing files and folders from main directory during compression

安稳与你 提交于 2019-12-02 13:36:30
I used this code to combined all files into one from a directory, not really compression, procedure CompressDirectory(InDir : string; OutStream : TStream); var AE : TArchiveEntry; procedure RecurseDirectory(ADir : string); var sr : TSearchRec; TmpStream : TStream; begin if FindFirst(ADir + '*', faAnyFile, sr) = 0 then begin repeat if (sr.Attr and (faDirectory or faVolumeID)) = 0 then begin // We have a file (as opposed to a directory or anything // else). Write the file entry header. AE.EntryType := aeFile; AE.FileNameLen := Length(sr.Name); AE.FileLength := sr.Size; OutStream.Write(AE, SizeOf

Oracle: How to use procedure local variables for “EXECUTE IMMEDIATE” statements in procedures

自闭症网瘾萝莉.ら 提交于 2019-12-02 10:35:43
We have a procedure starting with following code: CREATE OR REPLACE PROCEDURE get_id (id_ IN OUT number, type_ IN number) IS PRAGMA AUTONOMOUS_TRANSACTION; local_id number; BEGIN EXECUTE IMMEDIATE 'SELECT SYS_LOCAL_ID_SERIAL_SEQ.NEXTVAL into :local_id FROM dual'; ... Now if i execute this, the variable "local_id" is not filled with the next sequence value, but with null (although the sequence is raised by 1). If i change this to "... into local_id ..." i get ORA Error 1008 . What is going wrong here? A local variable from the procedure can be bind to the query placeholder with USING [OUT][IN]

TOAD displaying cursor recordset returned by stored procedure

徘徊边缘 提交于 2019-12-02 09:59:18
How I could print recorset result from the returning cursor, please. Down below executes fine but I need to see result. This is block in TOAD, calling package sp AMD_NEEDMSG: DECLARE RETURN_RECORDSET CTI_MATRIX.AMD.REF_CURSOR; BEGIN CTI_MATRIX.AMD.AMD_NEEDMSG ( '88888888885', RETURN_RECORDSET ); END; This package spec: CREATE OR REPLACE PACKAGE CTI_MATRIX.AMD AS TYPE REF_CURSOR IS REF CURSOR; PROCEDURE AMD_NEEDMSG (v_CRN IN VARCHAR2, return_recordset OUT REF_CURSOR); END AMD; This is package body: CREATE OR REPLACE PACKAGE BODY CTI_MATRIX.AMD AS PROCEDURE AMD_NEEDMSG (v_CRN IN VARCHAR2, return

How can I implement if(condition1 && condition2) in MIPS?

懵懂的女人 提交于 2019-12-02 08:29:00
问题 I have written the following function to check whether a character is a digit or not: # IsDigit - tests a if a character a digit or not # arguments: # $a0 = character byte # return value: # $v0 = 1 - digit # 0 - not a digit IsDigit: lb $t0, ($a0) # obtain the character li $t1, 48 # '0' - character li $t2, 57 # '9' - character bge $t0, $t1, condition1 condition1: ble $t0, $t2, condition2 li $v0, 0 j return condition2: li $v0, 1 return: # return jr $ra Is there any better way to do or write

PL/SQL procedure succesfully completed but shows nothing

China☆狼群 提交于 2019-12-02 07:33:01
I've the following procedure code: create or replace PROCEDURE Ventas_cliente( p_DNI IN CHAR ) IS CURSOR c_pedidos_clientes IS SELECT * FROM Pedidos_venta WHERE DNI_Cliente = p_DNI; BEGIN DBMS_OUTPUT.PUT_LINE('test'); FOR fila IN c_pedidos_clientes LOOP DBMS_OUTPUT.PUT_LINE(fila.OID_Pedido_venta||' '||fila.precio); END LOOP; END Ventas_cliente; When I type EXECUTE Ventas_(88441020); Oracle returns PL/SQL procedure succesfully completed . The great problem is that it'd return 'test'. Why does not Oracle return 'test'? You need to enable printing to stdout. In SQL*Plus the simplest way of doing

Mysql calling procedure failed when dynamically alter table in it

∥☆過路亽.° 提交于 2019-12-02 07:11:24
I want to alter my tables dynamically based on whether the table has specific column. My database name is summer_cms , and there are over 50 tables in it. What I want are below: If a table has a column named add_time , then I would like to add a column add_user_id in it. Similarly, I would like to add update_user_id in the table if update_time is found. I know I should get it down in the process of creating the database schemas, but my database has been built and I have to alter it by need. So I create a procedure to do it: CREATE PROCEDURE ALTER_SUMMER_TABLE() BEGIN DECLARE tableName VARCHAR

oracle存储过程中提示“权限不足”的解决办法

隐身守侯 提交于 2019-12-01 21:07:43
我们知道,用户拥有的role权限在存储过程是不可用的。如: SQL> select * from dba_role_privs where grantee='SUK'; GRANTEE GRANTED_ROLE ADMIN_OPTION DEFAULT_ROLE ------------ ------------ ------------ ------------ SUK DBA NO YES SUK CONNECT NO YES SUK RESOURCE NO YES --用户SUK拥有DBA这个role --再创建一个测试存储过程: create or replace procedure p_create_table is begin Execute Immediate 'create table create_table(id int)'; end p_create_table; --然后测试 SQL> exec p_create_table; begin p_create_table; end; ORA-01031: 权限不足 ORA-06512: 在"SUK.P_CREATE_TABLE", line 3 ORA-06512: 在line 1 --可以看到,即使拥有DBA role,也不能创建表。role在存储过程中不可用。 --遇到这种情况,我们一般需要显式进行系统权限

Error declaring integer variable inside MySQL stored function

回眸只為那壹抹淺笑 提交于 2019-12-01 17:32:42
I'm getting an error when trying to declare a new stored function in MySQL (Server version: 5.5.13) Basically, I have a large table which classifies strings depending on how they start. My function takes a string (from user input) and then tells you the classification of that string by searching the database for the classification. It's a bit like a LIKE query, except in reverse as it's the user input that contains the full string and the database contains the string being searched for. Hope that makes sense! The concept and logic behind it work fine as I've written/developed this in PHP and

Calculating the position of QR Code alignment patterns

喜你入骨 提交于 2019-12-01 06:47:58
I need to know how to calculate the positions of the QR Code alignment patterns as defined in the table of ISO/IEC 18004:2000 Annex E . I don't understand how it's calculated. If you take the Version 16, for example, the positions are calculated using {6,26,50,74} and distance between the points are {20,24,24}. Why isn't it {6,28,52,74}, if the distances between the points, {22,24,22}, is distributed more equally? I would like to know how this can be generated procedurally. eriksoe While the specification does provide a table of the alignment, this is a reasonable question (and one I found

Calculating the position of QR Code alignment patterns

末鹿安然 提交于 2019-12-01 04:24:19
问题 I need to know how to calculate the positions of the QR Code alignment patterns as defined in the table of ISO/IEC 18004:2000 Annex E. I don't understand how it's calculated. If you take the Version 16, for example, the positions are calculated using {6,26,50,74} and distance between the points are {20,24,24}. Why isn't it {6,28,52,74}, if the distances between the points, {22,24,22}, is distributed more equally? I would like to know how this can be generated procedurally. 回答1: While the