procedures

plsql procedure to compare two tables where structure of table is not known

守給你的承諾、 提交于 2020-02-02 14:40:50
问题 So the problem goes like this: I have a table with two columns namely source query and target query. each row contains a sql query for a informatica mapping from source side and target side and we needed to build a reconciliation procedure which take those two values for each row and generate there output and store it in temp table say temp1 and temp2 and then compare the result of these two temp tables. I Did this by creating two tables and then bulk fetching through two cursors and

plsql procedure to compare two tables where structure of table is not known

百般思念 提交于 2020-02-02 14:40:25
问题 So the problem goes like this: I have a table with two columns namely source query and target query. each row contains a sql query for a informatica mapping from source side and target side and we needed to build a reconciliation procedure which take those two values for each row and generate there output and store it in temp table say temp1 and temp2 and then compare the result of these two temp tables. I Did this by creating two tables and then bulk fetching through two cursors and

SQL Server - copy stored procedures from one db to another

烈酒焚心 提交于 2020-01-19 02:47:25
问题 I am new to SQL, and what I needed to do was to combine 2 .mdf databases into one. I did that using SQL Server 2008 Manager - Tasks > Import/Export tables.The tables and views were copied successfully, but there are no Stored procedures in the new database. Is there any way to do that? 回答1: Right click on database Tasks Generate Scripts Select the objects you wish to script Script to File Run generated scripts against target database 回答2: This code copies all stored procedures in the Master

SQL Server - copy stored procedures from one db to another

霸气de小男生 提交于 2020-01-19 02:46:07
问题 I am new to SQL, and what I needed to do was to combine 2 .mdf databases into one. I did that using SQL Server 2008 Manager - Tasks > Import/Export tables.The tables and views were copied successfully, but there are no Stored procedures in the new database. Is there any way to do that? 回答1: Right click on database Tasks Generate Scripts Select the objects you wish to script Script to File Run generated scripts against target database 回答2: This code copies all stored procedures in the Master

PostgreSQL Trigger Exception

旧城冷巷雨未停 提交于 2020-01-06 14:13:44
问题 I'm having problems with creating this trigger in PostgreSQL 8.4. CREATE OR REPLACE FUNCTION tbi_Usuarios() RETURNS TRIGGER AS $tbi_Usuarios$ BEGIN IF trim(both ' ' from NEW.Nombre_usuario) = '' OR NEW.Nombre_usuario IS NULL THEN RAISE EXCEPTION 'Debes ingresar un nombre de usuario.'; END IF; IF NEW.Password = '' OR NEW.Password IS NULL THEN RAISE EXCEPTION 'Debes ingresar una contraseña correctamente'; ELSE NEW.Password := md5(NEW.Password); END IF; IF Fecha_registro IS NULL THEN NEW.Fecha

Dynamically access column value in record

只谈情不闲聊 提交于 2020-01-05 02:48:19
问题 Is it possible to dynamically access a column value from a record by its name? I'm writing a trigger function that executes a dynamic SQL command and I would like to dynamically extract a column value from a NEW record by column name. Here's a simplified example of what I'm trying to do: $$ DECLARE command text := 'UPDATE $1 SET $2 = $3'; myColumn := 'votes' BEGIN EXECUTE command using 'anotherTable', myColumn, NEW.myColumn; END $$ 回答1: That's possible , but the USING clause of EXECUTE can

The MySQL “DELIMITER” keyword isn't working

社会主义新天地 提交于 2020-01-04 04:32:13
问题 Ok so, I've been ripping my hairs ou on this one, why doesn't this work? DELIMITER | CREATE PROCEDURE Decrypt_pw() READS SQL DATA BEGIN SELECT 'Hey Select'; END| It's so basic and I'm pretty sure I'm using the correct syntax, what am I missing? Error: 21:14:07 [DELIMITER - 0 row(s), 0.000 secs] [Error Code: 1064, SQL State: 42000] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DELIMITER | CREATE PROCEDURE

Oracle - procedure related query

梦想与她 提交于 2019-12-25 01:55:43
问题 I am writing the below queries in oracle: DBMS_OUTPUT.....'Ashish' Select col1 into val1 from tab_1 DBMS_OUTPUT.....'Ubale' when I run this procedure I get the output as "Ashish" only why? also what will be the value of v_val1 variable Note: the table does not contain any records 回答1: Since the table is empty, the "select into" statement will raise the NO_DATA_FOUND exception. That's why you don't get the second message. val1 will have the same value as before the select - i.e. null if you

How do I retrieve values from a nested Oracle procedure?

喜你入骨 提交于 2019-12-23 16:03:34
问题 I have kind of a tricky Oracle problem. I am trying to select one set of data, we'll call items. For each item I want to call another procedure and return an Inventory Item. I have two operations I am not sure on how to perform. How do I retrieve a value from the nested procedure? How do I return those retrieved values in the form of SYS_REFCURSOR? My attempt here was to put the results from spSelect_Inv_Search into a nested table called ITEMS_TABLE. This is not working. Code below PROCEDURE

How do I get Oracle, see what procedures are running?

让人想犯罪 __ 提交于 2019-12-21 19:38:24
问题 Good afternoon. How do I get Oracle, see what procedures are running? 回答1: Depending on your needs, this might suffice (but relies on access to v$session and dba_objects): select 'CALLED PLSQL', vs.username, d_o.object_name -- whatever info you need from dba_objects d_o inner join v$session vs on d_o.object_id = vs.plsql_entry_object_id union all select 'CURRENT PLSQL', vs.username, d_o.object_name from dba_objects d_o inner join v$session vs on d_o.object_id = vs.plsql_object_id As per the