stored-procedures

Error(9,1): PLS-00428: an INTO clause is expected in this SELECT statement while creating stored procedures

删除回忆录丶 提交于 2020-04-17 22:06:07
问题 I have created a SP, but while compiling I am getting error as Error(9,1): PLS-00428: an INTO clause is expected in this SELECT statement Below is the SP CREATE OR REPLACE PROCEDURE FIP_VALID_TBL_TRANSMEDIA ( POUTMSG OUT VARCHAR2 ) AS BEGIN SELECT distinct TO_CHAR(sp.RJ_SPAN_ID) AS SPAN_ID, TO_CHAR(sp.RJ_MAINTENANCE_ZONE_CODE) AS MAINT_ZONE_CODE from APP_FTTX.span@SAT sp WHERE LENGTH(sp.RJ_SPAN_ID) = 21 AND (sp.RJ_SPAN_ID LIKE ('%SPN%') OR sp.RJ_SPAN_ID LIKE ('%SPQ%') OR sp.RJ_SPAN_ID LIKE ('

Error(9,1): PLS-00428: an INTO clause is expected in this SELECT statement while creating stored procedures

与世无争的帅哥 提交于 2020-04-17 22:05:55
问题 I have created a SP, but while compiling I am getting error as Error(9,1): PLS-00428: an INTO clause is expected in this SELECT statement Below is the SP CREATE OR REPLACE PROCEDURE FIP_VALID_TBL_TRANSMEDIA ( POUTMSG OUT VARCHAR2 ) AS BEGIN SELECT distinct TO_CHAR(sp.RJ_SPAN_ID) AS SPAN_ID, TO_CHAR(sp.RJ_MAINTENANCE_ZONE_CODE) AS MAINT_ZONE_CODE from APP_FTTX.span@SAT sp WHERE LENGTH(sp.RJ_SPAN_ID) = 21 AND (sp.RJ_SPAN_ID LIKE ('%SPN%') OR sp.RJ_SPAN_ID LIKE ('%SPQ%') OR sp.RJ_SPAN_ID LIKE ('

How to insert records into variables from cte in oracle?

半城伤御伤魂 提交于 2020-04-17 21:27:04
问题 I have a procedure in which I want to fetch all records from cte into Names variable. But this code is not writing into names from CTE. How can I fetch records into names so that I can later loop through names and get content of field_name? CREATE OR REPLACE PROCEDURE sp_market IS Names VARCHAR2(32767); BEGIN WITH CTE(sqql) As ( SELECT field_name sqql FROM pld_medicare_config ) SELECT sqql into Names from CTE; END sp_market; 回答1: SELECT sqql into Names from CTE; You are assigning multiple

How to insert records into variables from cte in oracle?

跟風遠走 提交于 2020-04-17 21:26:49
问题 I have a procedure in which I want to fetch all records from cte into Names variable. But this code is not writing into names from CTE. How can I fetch records into names so that I can later loop through names and get content of field_name? CREATE OR REPLACE PROCEDURE sp_market IS Names VARCHAR2(32767); BEGIN WITH CTE(sqql) As ( SELECT field_name sqql FROM pld_medicare_config ) SELECT sqql into Names from CTE; END sp_market; 回答1: SELECT sqql into Names from CTE; You are assigning multiple

Procedure for Interchanging Swap, Values Primary Key, Oracle, ORA-00001

三世轮回 提交于 2020-04-16 05:44:12
问题 TABLE_PRD CREATE TABLE TABLE_PRD ( PRODUCT_CODE_PRD VARCHAR2(10) NOT NULL , DESCRIPTION_PRODUCT_PRD VARCHAR2(20) , CONSTRAINT TABLE_PRD_PK PRIMARY KEY ( PRODUCT_CODE_PRD ) ENABLE ); INSERT INTO TABLE_PRD (PRODUCT_CODE_PRD, DESCRIPTION_PRODUCT_PRD) VALUES ('LS', 'Leasing'); INSERT INTO TABLE_PRD (PRODUCT_CODE_PRD, DESCRIPTION_PRODUCT_PRD) VALUES ('TG', 'Total Cost'); TABLE_POS CREATE TABLE TABLE_POS ( POSITION_CODE_POS INTEGER NOT NULL , SOME_TEXT_POS VARCHAR2(20) , CONSTRAINT TABLE_POS_PK

How to call stored procedure in Entity Framework Core with input and output parameters using mysql

走远了吗. 提交于 2020-04-16 02:18:07
问题 I am using ASP.net Core 2.2 with Entity Framework core 2.2.6 and Pomelo.EntityFrameworkCore.MySql 2.2.0 for connectivity with MySQL, I have a stored procedure which takes 3 input parameters and 1 output parameter. I am able to call it in MySQL workbench like CALL GetTechniciansByTrade('Automobile', 1, 10, @total); select @total; Now I want to call this using entity framework core, the code I am currently using is var outputParameter = new MySqlParameter("@PageCount", MySqlDbType.Int32);

Creating a MySQL stored procedure to update records

て烟熏妆下的殇ゞ 提交于 2020-04-14 09:24:52
问题 I'm converting all of my existing MSSQL databases and stored procedures am stuck on a new stored procedure where I need to update an existing record. The procedure gets called from a web form once a record has been inserted into the database and en email sent successfully (or at least passed off to the SMTP server) I've had a working procedure in MSSQL for a long time but am trying to convert it to MySQL. I'm passing in 3 variables - a bit indicating the email got sent, a string indicating

Creating a MySQL stored procedure to update records

牧云@^-^@ 提交于 2020-04-14 09:23:10
问题 I'm converting all of my existing MSSQL databases and stored procedures am stuck on a new stored procedure where I need to update an existing record. The procedure gets called from a web form once a record has been inserted into the database and en email sent successfully (or at least passed off to the SMTP server) I've had a working procedure in MSSQL for a long time but am trying to convert it to MySQL. I'm passing in 3 variables - a bit indicating the email got sent, a string indicating

Passing parameters to IN clause in SQL Server [duplicate]

自作多情 提交于 2020-04-13 06:14:37
问题 This question already has answers here : Closed 9 years ago . Possible Duplicates: Parameterizing a SQL IN clause? SQL Server - In clause with a declared variable Hi, I am facing problem passing parameters to 'IN' clause. I am using the below query. Query: SELECT Topics.Topic_Id FROM Topics Where Topic_Description IN (''+ @Topics +'') This query works when the parameter has single value. My parameter can have comma separated multiple values like : 'one','two','three','four'. But the query

mysql count rows with a specific column

馋奶兔 提交于 2020-04-07 04:20:31
问题 I have a table like this Sr Name 1 A 2 B 3 C 4 C 5 C 6 E 7 A 8 A 9 A 10 E 11 B 12 B I need output like this A = 4 Times B = 3 Times C = 3 Times E = 2 Times How can I achieve this? Thanks in advance 回答1: SELECT Name, COUNT(Sr) FROM myTable GROUP BY Name ORDER BY Name ASC; 回答2: You may want to use: SELECT name, CONCAT(COUNT(*), ' Times') number FROM your_table GROUP BY name ORDER BY name; Test case: CREATE TABLE your_table (sr int, name varchar(50)); INSERT INTO your_table VALUES(1, 'A');