Error PLS-00428: an INTO clause in this SELECT statement
Dear Experts,
I'm new to PL/SQL programming
I try to run the following query, I get the error message.
Please help me solve the error.
declare
var_cd number (20);
Start
If: P1_TYP_CAT is not null then
SELECT max (CAT_cd + 1) as var_cd from IM_AST_CAT by CAT_cd;
insert into IM_AST_CAT (CAT_NM, CAT_CD) values ((upper (:P1_TYP_CAT)),(:var_cd));
on the other
RAISE_APPLICATION_ERROR ('-20001,' both Department and location must be provided ");
end if;
end;
In PL/SQL, must be used IN the clause when using SELECT statements.
SELECT max (CAT_cd + 1) as var_cd
in variable - it is missing in your code
from IM_AST_CAT by CAT_cd;
Your code should be
declare
var_cd number (20);
Start
If: P1_TYP_CAT is not null then
SELECT max (CAT_cd + 1).
in var_cd
of IM_AST_CAT
order of CAT_cd;insert into IM_AST_CAT (CAT_NM, CAT_CD) values (upper(:P1_TYP_CAT), var_cd);
on the other
RAISE_APPLICATION_ERROR ('-20001,' both Department and location must be provided ");
end if;
end;
For example:
DECLARE
l_first_name varchar2 (100);
BEGIN
Select first_name
in l_first_name
employees
where employee_id = 100;
END;
Post edited by: Suri
Tags: Database
Similar Questions
-
an INTO clause in this SELECT statement
Hello
This query is to start an error, an INTO clause in the SELECT statement. I have a line in my table
DECLARE
TNom VARCHAR (100);
BEGIN
Select tNom under Tnom in t_conf where Tna = 'Home';
If instr (tNom, 'living room') > 0
then return true;
otherwise return false;
end if;
END;
DECLARE
v_Tname VARCHAR (100);
BEGIN
Select Tname in v_Tname t_conf where Tna = 'Home';
If instr (v_Tname, "living room") > 0
then return true;
otherwise return false;
end if;
END;
-
How to split string separated by commas and pass to the clause of the select statement
Referring to article How to divide string separated by commas, then pass to clause of a select statement, tquery that there the following plan:
Query1:
select * from emp where ename in ( select regexp_substr('SMITH,ALLEN,WARD,JONES','[^,]+', 1, level) from dual connect by regexp_substr('SMITH,ALLEN,WARD,JONES', '[^,]+', 1, level) is not null );
Base1:
Plan hash value: 4242290184 -------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | 133 | 7 (29)| 00:00:01 | |* 1 | HASH JOIN | | 1 | 133 | 7 (29)| 00:00:01 | | 2 | VIEW | VW_NSO_1 | 1 | 46 | 3 (34)| 00:00:01 | | 3 | HASH UNIQUE | | 1 | | 3 (34)| 00:00:01 | |* 4 | CONNECT BY WITHOUT FILTERING| | | | | | | 5 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 | | 6 | TABLE ACCESS FULL | EMP | 14 | 1218 | 3 (0)| 00:00:01 | -------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("ENAME"="$nso_col_1") 4 - filter( REGEXP_SUBSTR ('SMITH,ALLEN,WARD,JONES','[^,]+',1,LEVEL) IS NOT NULL)
However, the following query generates the plan I want:
Query2:
select * from emp where ename in ('SMITH','ALLEN','WARD','JONES');
Plan2:
Plan hash value: 3956160932 -------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | -------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 4 | 348 | 3 (0)| 00:00:01 | |* 1 | TABLE ACCESS FULL| EMP | 4 | 348 | 3 (0)| 00:00:01 | -------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter("ENAME"='ALLEN' OR "ENAME"='JONES' OR "ENAME"='SMITH' OR "ENAME"='WARD')
Can I change the query1 query for plan2?
As Juliet was mentioned in the first SQL that you generate from the ENAME list that you must pass in the IN clause when executing. But in the second SQL, it passed as a static value. So first SQL must do more work. So you see a different execution plan.
But this is a work around to get what you are looking for. But I can't say it's a foolproof method. But anyway here you go.
SQL > var ename_list varchar2 (100)
SQL > exec: ename_list: = 'SMITH, ALLEN, WARD, JONES ';PL/SQL procedure successfully completed.
SQL > select *.
2 of PEM
where the 3 «,» | : ename_list | ',' like '%', | Ename | ',%';EMPNO, ENAME, JOB HIREDATE DEPTNO ID COM SAL MGR
---------- ------ --------- ---------- --------- ---------- ---------- ---------- ----------
7369 SMITH COMMITTED 7902 2975 2 APRIL 81 0 20
7499 ALLEN 7698 1600 20 FEBRUARY SALESMAN 81 300 30
7521 WARD 7698 1250 22 FEBRUARY SALESMAN 81 500 30
7566 JONES MANAGER 7839 2975 2 APRIL 81 0 20SQL > select * from table (dbms_xplan.display_cursor);
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------
SQL_ID, 848zhvbvgf7d6, number of children 0
-------------------------------------
Select * from emp where «,» | : ename_list | ',' like '%', | Ename
|| ',%'Hash value of plan: 2872589290
--------------------------------------------------------------------------
| ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
--------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | 2 (100) | |
|* 1 | TABLE ACCESS FULL | EMP | 1. 38. 2 (0) | 00:00:01 |
--------------------------------------------------------------------------Information of predicates (identified by the operation identity card):
---------------------------------------------------1 - filter(','||:ENAME_LIST||',' LIKE '%,'||") ENAME "|", %')
19 selected lines.
SQL >
-
call a function in a where clause of a select statement clause
Hello
is it possible to call a function in a where clause of a select statement clause?
ex: select col1, col2
from my_table
where my_package.my_function (32199, 2008, col3, 'P');
and I have the error message ' ORA-00920: invalid relational operator.
FUNCTION ma_fonction (v_matricule in NUMBER,
v_Year in NUMBERS
T_DATE IN a DATE,
v_type in DEFAULT CHAR 'P')
RETURN A BOOLEAN VALUE;
@+ RosagioYes, it is possible.
But you have no relational operator:
where my_package.my_function (32199, 2008, col3, 'P') =?
where my_package.my_function (32199, 2008, col3, 'P') >?
where my_package.my_function (32199, 2008, col3, 'P')<>Oops, I just noticed that your function returns a Boolean value.
Can't do that as in a SQL statement.
Boolean is known only to other code PL/SQL, no SQL statements.
Published by: SomeoneElse on November 7, 2008 09:24
-
Nothing wrong with including ORDER BY in INSERT into... SELECT statement?
Are there implications due to the use of ORDER BY (field3 control) in bottom INSERT INTO... SELECT statement.
insert into mytable ( field1, field2, field3 ) select field1, field2, field3 from source_Table order by field3;
Order by is used with functions select but not a mandate. Usually people uninterested by what people order insert data in a table. We have to try to keep operations and it inserts into a table.
-
When I try to go into my Windows Word and type something, it won't allow me. He told me that this modification is not allowed because this selection is locked. How can I fix it. Miss me a lot of homework, so for this reason. It allows me to remove the program from the Control Panel Add/Remove program also.
-You can publish the same query in the office community
http://www.Microsoft.com/Office/Community/en-us/FlyoutOverview.mspx -
How to convert this select statement in the update
Hai All
I have two tables namely Daily_attend, Train_mast
The Daily_attend are made up of fields are Train_mast are made up of fields are
Name varchar form no var
Date of empcode Num V_DATE
Intimate Date Train_name var
Outtime date Late_hrs var
Number IND_IN
Number IDE_OUT
Date of Attend_date
I need to update the table Depend of IDE_IN in Daily_attend in late_hrs in the Train_mast table
I got through in the select statement, it is my select statement
Select to_number (TO_DATE (TO_CHAR(Intime,'DD-MON-YYYY') |)) » '||
To_char (0815, '0000'), 'MON-DD-YYYY HH24') + late_hrs /(24*60)-respondent
) * 24 * 60 dail_Att, train_mast;
How can I convert to update
Any help is highly appricateable
Thanks in advance
Concerning
Srikkanth.MSrikkanth,
Try this code. And 1 thing, I don't see any WHERE condition to join between the 2 tables, DAIL_ATT, TRAIN_MAST.
UPDATE DAIL_ATT A SET A.IDE_IN = (SELECT TO_NUMBER(TO_DATE(TO_CHAR(INTIME, 'DD-MON-YYYY')|| ' ' || TO_CHAR(0815, '0000'), 'DD-MON-YYYY HH24:MI') + LATE_HRS / (24 * 60) - INTIME) * 24 * 60 FROM TRAIN_MAST B WHERE
); Kind regards
Manu.
If my answer or the answer to another person has been useful or appropriate, please mark accordingly
-
Hello
I have this scenario where I have to pass multiple values to a parameter of a procedure of monkey and then collect in another variable (the lines can be multiple).
The parameter must be used in the where clause of the statement select here I create a sample table for the problem.
Create table test_tab (number of trans_id, cmts varchar2 (50));
insert into test_tab values (568890112115, ' wnlb-CMTS-11-04' ");
insert into test_tab values (568890112115, ' wnlb-CMTS-11-04' ");
insert into test_tab values (568890112115, ' wnlb-CMTS-11-01' ");
insert into test_tab values (568890112115, ' wnlb-CMTS-11-01' ");
insert into test_tab values (568890112115, ' wnlb-CMTS-11-01' ");
insert into test_tab values (568890112115, ' wnlb-CMTS-12-02' ");
insert into test_tab values (568890112115, ' wnlb-CMTS-12-02' ");
This is so all cmts have same trans_id but different name
This query gives the result as -
Select the cmts, count (1)
of test_tab
where cmts ("wnlb-cmts-11-04','wnlb-cmts-11-01", "wnlb-CMTS-11-02'")
and trans_id = 568890112115
Cmts group;
COUNTY OF CMTS
WNLB-CMTS-11-04 2
3 WNLB-CMTS-11-01
Now, I want to use this query in a PLSQL block like where I can spend the CMTS collection and trans_id as a scalar variable and once again an OUTPUT parameter that holds the result of the query.
I use OUT parameter because it will be called to the JAVA program.
Here, I write a PACKAGE for it but it gives me compilation error!
create or replace package CMTS_SUCCESS_FAILED_API
is
type t_item_name is table of index varchar2 (50) by pls_integer;
TYPE t_cmts_count () IS RENDERING
CMTS VARCHAR2 (30),
number of NUMBER
);
type t_reseg_dtl is table of index t_cmts_count by pls_integer;
procedure CMTS_SUCCESS_FAILED_RESEG_ORDR (p_item_name t_item_name, p_trans_id in numbers, p_reseg_dtl to t_reseg_dtl);
end CMTS_SUCCESS_FAILED_API;
/
Now that I have created a different PACKAGE BODY, but none don't work!
1.
create or replace package CMTS_SUCCESS_FAILED_API
is
type t_item_name is table of index varchar2 (50) by pls_integer;
TYPE t_cmts_count () IS RENDERING
CMTS VARCHAR2 (30),
number of NUMBER
);
type t_reseg_dtl is table of index t_cmts_count by pls_integer;
procedure CMTS_SUCCESS_FAILED_RESEG_ORDR (p_item_name t_item_name, p_trans_id in numbers, p_reseg_dtl to t_reseg_dtl);
end;
/
create or replace package CMTS_SUCCESS_FAILED_API body
is
procedure CMTS_SUCCESS_FAILED_RESEG_ORDR (p_item_name t_item_name, p_trans_id in numbers, p_reseg_dtl to t_reseg_dtl)
is
Start
I'm in p_item_name.first... p_item_name. Last
loop
Select the cmts, count (1)
bulk collect into p_reseg_dtl (i)
of test_tab
where cmts = p_item_name (i)
and trans_id = p_trans_id
Cmts group;
end loop;
for r in p_reseg_dtl.first... p_reseg_dtl. Last
loop
dbms_output.put_line (p_reseg_dtl (r). TRANSACTION_ID | » '|| p_reseg_dtl (r). JOB_STATUS | » '|| p_reseg_dtl (r). CMTS);
end loop;
end CMTS_SUCCESS_FAILED_RESEG_ORDR;
end CMTS_SUCCESS_FAILED_API;
While I run this procedure it is said TOO_MANY LINES.
2.
create or replace package CMTS_SUCCESS_FAILED_API body
is
procedure CMTS_SUCCESS_FAILED_RESEG_ORDR (p_item_name t_item_name, p_trans_id in numbers, p_reseg_dtl to t_reseg_dtl)
is
cursor c_dtl is
Select the cmts, count (1)
of test_tab
where cmts = p_item_name < < error
and trans_id = p_trans_id
Cmts group;
Start
Open c_dtl;
collect the fetch c_dtl in bulk in p_reseg_dtl;
close c_dtl;
-for i in p_item_name.first... p_item_name. Last
-loop
-end loop;
end;
end;
THIS error GIVES BODY as EXPRESSION IS OF TYPE INCORRECT for where clause where I mark it as "BOLD".
I think Miss me a small detail to add here, but I can't do even now it seems for me that I'm working on it since the morning and SQL are a little complex in real time who also write.
I use-Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
Please suggest me!
Until then I'm also working on this issue hope will find a solution.
In the database (we show it with a standalone function, you should put it in a package):
create or replace function CMTS_SUCCESS_FAILED_RESEG_ORDR ( p_item_name IN SYS.DBMS_DEBUG_VC2COLL, p_trans_id IN number ) return sys_refcursor is l_refcur sys_refcursor; begin open l_refcur for SELECT cmts , COUNT(*) FROM test_tab WHERE cmts member of p_item_name AND trans_id = p_trans_id GROUP BY cmts; return l_refcur; end CMTS_SUCCESS_FAILED_RESEG_ORDR; /
In Java:
import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import oracle.jdbc.OracleCallableStatement; import oracle.jdbc.OracleTypes; import oracle.jdbc.pool.OracleDataSource; import oracle.sql.ARRAY; import oracle.sql.ArrayDescriptor; public class SQLCollection { public static void main(String[] args) throws SQLException { System.out.println("Class SQLCollection started."); OracleDataSource ods = null; Connection conn = null; CallableStatement cs = null; ResultSet rset = null; try { ods = new OracleDataSource(); String url = "jdbc:oracle:thin:@//127.0.0.1:1522/orcl.localdomain"; ods.setURL(url); ods.setUser("stew"); ods.setPassword("stew"); conn = ods.getConnection(); conn.setAutoCommit(false); ArrayDescriptor oracleVarchar2Collection = ArrayDescriptor.createDescriptor("SYS.DBMS_DEBUG_VC2COLL", conn); String[] inset = new String[2]; inset[0] = "wnlb-cmts-11-04"; inset[1] = "wnlb-cmts-11-01"; ARRAY ora_inset = new ARRAY(oracleVarchar2Collection, conn, inset); cs = conn.prepareCall("begin ? := CMTS_SUCCESS_FAILED_RESEG_ORDR(?, ?); end;"); cs.registerOutParameter(1, OracleTypes.CURSOR); cs.setArray(2, ora_inset); cs.setBigDecimal(3, new BigDecimal("568890112115")); cs.execute(); // Dump the cursor rset = ((OracleCallableStatement)cs).getCursor(1); while (rset.next()) System.out.println(rset.getString(1) + ": " + rset.getInt(2)); } catch (Exception e) { e.printStackTrace(); } finally { if (rset != null) { rset.close(); } if (cs != null) { cs.close(); } if (conn != null) { conn.close(); } System.out.println("Class SQLCollection ended."); } } }
-
Error of identifying incorrect when you run a select statement
Hi all
I get this weird error when you try to run the statement select it below:
Error on line 16
ORA-00904: "A". "" LIMCU ": invalid identifier
SELECT
B.IMAITM,
A.LIMCU,
A.LILOCN,
COUNCS/10000 "COUNCS."
A.LIPQOH,
A.LIURAB,
A.LIGLPT,
B.IMLITM,
B.IMDSC1,
B.IMSRP2
Of
BODS_READONLY. F41021 A, BODS_READONLY. F4101 B,
BODS_READONLY. F41001 C, BODS_READONLY. F4105 D
JOIN INTERNAL BODS_READONLY. F0005 F5 ON
F5. DRDL02 = A.LIMCU
WHERE
A.LIITM = B.IMITM AND
A.LIMCU = C.CIMCU AND
A.LIMCU = D.COMCU AND
B.IMITM = D.COITM AND
D.COLEDG = C.CICSMT AND
A.LILOCN IN ("FM", "SF")
He worked Frank and thanks.
Kind regards
N. Ganesh
-
Conditional clause in the select statement
Hi all
Suppose for example of diagram of HR that I have the following query where it counts the number of Department based on their identity papers and the total number of jobs:
The total number of global jobs regardless of which Department is 107. Question: How to make a query that displays the result above and makes the JOBID and DEPARTMENTID column value to two TotalAgregate where the count indicates 107? Like this:SQL> select decode(grouping(job_id),1,'total_job',job_id) as JobID, decode(group ing(department_id),1,'all_department',department_id) as DepartmentID, count(*) f rom employees group by rollup(job_id,department_id) order by job_id,department_i d; JOBID DEPARTMENTID COUNT(*) ---------- ---------------------------------------- ---------- AC_ACCOUNT 110 1 AC_ACCOUNT all_department 1 AC_MGR 110 1 AC_MGR all_department 1 AD_ASST 10 1 AD_ASST all_department 1 AD_PRES 90 1 AD_PRES all_department 1 AD_VP 90 2 AD_VP all_department 2 FI_ACCOUNT 100 5 JOBID DEPARTMENTID COUNT(*) ---------- ---------------------------------------- ---------- FI_ACCOUNT all_department 5 FI_MGR 100 1 FI_MGR all_department 1 HR_REP 40 1 HR_REP all_department 1 IT_PROG 60 5 IT_PROG all_department 5 MK_MAN 20 1 MK_MAN all_department 1 MK_REP 20 1 MK_REP all_department 1 JOBID DEPARTMENTID COUNT(*) ---------- ---------------------------------------- ---------- PR_REP 70 1 PR_REP all_department 1 PU_CLERK 30 5 PU_CLERK all_department 5 PU_MAN 30 1 PU_MAN all_department 1 SA_MAN 80 5 SA_MAN all_department 5 SA_REP 80 29 SA_REP 1 SA_REP all_department 30 JOBID DEPARTMENTID COUNT(*) ---------- ---------------------------------------- ---------- SH_CLERK 50 20 SH_CLERK all_department 20 ST_CLERK 50 20 ST_CLERK all_department 20 ST_MAN 50 5 ST_MAN all_department 5 total_job all_department 107 40 rows selected.
Best regardsJOBID DEPARTMENTID COUNT(*) ---------- ---------------------------------------- ---------- AC_ACCOUNT 110 1 AC_ACCOUNT all_department 1 AC_MGR 110 1 AC_MGR all_department 1 AD_ASST 10 1 AD_ASST all_department 1 AD_PRES 90 1 AD_PRES all_department 1 AD_VP 90 2 AD_VP all_department 2 FI_ACCOUNT 100 5 JOBID DEPARTMENTID COUNT(*) ---------- ---------------------------------------- ---------- FI_ACCOUNT all_department 5 FI_MGR 100 1 FI_MGR all_department 1 HR_REP 40 1 HR_REP all_department 1 IT_PROG 60 5 IT_PROG all_department 5 MK_MAN 20 1 MK_MAN all_department 1 MK_REP 20 1 MK_REP all_department 1 JOBID DEPARTMENTID COUNT(*) ---------- ---------------------------------------- ---------- PR_REP 70 1 PR_REP all_department 1 PU_CLERK 30 5 PU_CLERK all_department 5 PU_MAN 30 1 PU_MAN all_department 1 SA_MAN 80 5 SA_MAN all_department 5 SA_REP 80 29 SA_REP 1 SA_REP all_department 30 JOBID DEPARTMENTID COUNT(*) ---------- ---------------------------------------- ---------- SH_CLERK 50 20 SH_CLERK all_department 20 ST_CLERK 50 20 ST_CLERK all_department 20 ST_MAN 50 5 ST_MAN all_department 5 TotalAgregate TotalAgregate 107 40 rows selected.
ValerieI do not have the HR schema to play with, but isn't it just a nested decode it takes?
for example something like...
select decode(grouping(job_id),1,'TotalAggregate',job_id) as JobID ,decode(grouping(department_id),1,decode(grouping(job_id),1,'TotalAggregate','all_department'),department_id) as DepartmentID ,count(*) from employees group by rollup(job_id,department_id) order by job_id,department_id;
-
Why I got error PLS-00103 for this procedure?
Hey, guys:
I have a question about the syntax of the exception, I want to record the number of rows from the tables, but if there is no such thing as a table, my program must be able to continue the loop.
I'm your only syntax error:create or replace procedure check_rows as cursor t1 is select table_name from all_csv where table_built='Y' and table_name is not null; match_count1 INTEGER; begin for n in t1 loop dbms_output.put_line(n.table_name); EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || n.table_name INTO match_count1 ; update all_csv set total_rows=match_count1 where table_name=n.table_name; exception when table_does_not_exist then null end; end loop; commit; end;
PLS-00103: encountered the symbol "EXCEPTION" when expected
of the following:
begin case declare end exit for goto if loop mod null pragma
raise return select update while < ID >
< between double quote delimited identifiers of > < a variable binding > < <
Close current delete fetch locking insert open rollback
SAVEPOINT SQLExecute set pipe fusion commit forall
Could someone give me a hint?
Thank you very much!
SamEXCEPTION clause should be at the end of the BEGIN block. It cannot start in the middle of the lock begin body:
create or replace procedure check_rows as cursor t1 is select table_name from all_csv where table_built='Y' and table_name is not null; match_count1 INTEGER; begin for n in t1 loop begin dbms_output.put_line(n.table_name); EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' || n.table_name INTO match_count1; update all_csv set total_rows = match_count1 where table_name = n.table_name; exception when table_does_not_exist then null; end; end loop; commit; end; /
And it is not a good idea to engage in the stored procedure. But the main question here is table_does_not_exist exception because it is not declared in your code. You must declare it and use PRAGMA EXCEPTION_INIT to connect with the desired error code.
SY.
-
for windows update make me number error msg: 0 x 80240036 and solve this problem poblem with fixit get msg w xp sp3 rendered and nework Framework 2 or lator should be installed pls can help you
See your other thread the same. http://answers.Microsoft.com/en-us/Windows/Forum/windows_xp-windows_update/to-make-Windows-Update-am-getting-MSG-error-number/3f579859-ecb0-408D-9db3-804044a21fb7
-
Convert number to Varchar for printing the Type of table in a loop error: PLS-00306:
Hello
I am trying to print a number of the Table that I get from a ref cursor But cannot convert the number to Varchar to print. What I'm doing wrong here
Thank you
Ken
OUT_REFCURSOR FETCH BULK COLLECT INTO theTBL_RCRD_ID ;
So THAT (theTBL_RCRD_ID IS NOT NULL)
LOOP
strRCRDID: = TO_CHAR (onTBL_RCRD_ID (indx), "99999"); -This line throws error message
dbms_output.put_line (strRCRDID);
INDX: = indx + 1;
END LOOP;
- Error: PLS-00306: wrong number or types of arguments in the call to "TO_CHAR.
Try this...
strRCRDID: = TO_CHAR (outTBL_RCRD_ID (indx). RCRD_ID, "99999");
-
I am receving oracle error PLS-00201
Hi all
When I call a procedure stored beside another stored procedure I get the below error
PLS-00201: identifier 'P_IN_USER_NAME' must be declared.
CREATE OR REPLACE PACKAGE BODY VABOSS. VABOSS_ODM_CHNG_PKG
AS
PROCEDURE VABOSS_DEL_UPL_CHNG (P_IN_UPD_NO IN VARCHAR2, P_IN_RELEASE IN P_IN_RECREATE IN P_IN_USER IN VARCHAR2, BOOLEAN, BOOLEAN)
IS
/*******************************************************************************************************************
Module name: VABOSS data, delete and insert
Package Name: VABOSS_ODM_CHNG_PKG
Program name: VABOSS_DEL_UPL_CHNG
Program description: this processing of drop table VABOSS_PLAN_ODM_BOM and insertion of data in the VABOSS_PLAN_ODM_BOM.
Created by: Maria - touati
Creation date: 14 October 2011
PROJECT_NAME: VABOSS
First version: 1.0
Input parameters: all THE
Output parameters: no
Return the parameters: no
********************************************************************************************************************/
CURSOR C_DEL
IS
SELECT GENERATION_ID, ODM_BOM_ID
OF VABOSS_PLAN_ODM_BOM
WHERE GENERATION_ID IN (SELECT GENERATION_ID
OF VABOSS_PLAN_ODM_UPDATE_ADMIN
WHERE UPD_NO = P_IN_UPD_NO);
CURSOR C_INST
IS
SELECT *.
OF VABOSS_INTR_ODM_BOM
WHERE ODM_BOM_ID IN SELECT (SEPARATE ODM_BOM_ID
Of
ADELINE VABOSS_PLAN_ODM_UPDATE_ADMIN
WHERE PUAH. UPD_NO = P_IN_UPD_NO;)
CURSOR C_UPD
IS
SELECT *.
OF VABOSS_PLAN_ODM_BOM_FILE
WHERE ODM_BOM_ID IN SELECT (SEPARATE ODM_BOM_ID
Of
ADELINE VABOSS_PLAN_ODM_UPDATE_ADMIN
WHERE PUAH. UPD_NO = P_IN_UPD_NO;)
V_UPD_NO VARCHAR2 (15);
V_ERROR_MSG VARCHAR2 (20);
NUMBER OF V_INS_CNT;
BEGIN
FOR T_UPD_NO IN C_DEL
LOOP
BEGIN
REMOVE FROM VABOSS_PLAN_ODM_BOM
WHERE GENERATION_ID = T_UPD_NO. GENERATION_ID;
UPDATE VABOSS_PLAN_ODM_BOM_FILE
SET CURRENT_STATUS = '99'
WHERE ODM_BOM_ID = T_UPD_NO. ODM_BOM_ID;
COMMIT;
EXCEPTION
WHILE OTHERS
THEN
VABOSS_COMMON_PKG.oracle_error_info (SQLCODE,
SQLERRM,
' VABOSS_ODM_CHNG_PKG. VABOSS_DEL_UPL_CHNG',.
p_in_user);
END;
END LOOP;
FOR T_INST_NO IN C_INST
LOOP
BEGIN
INSERT INTO VABOSS_PLAN_ODM_BOM (GRT_SEQ_NO,
ODM_BOM_ID,
SEQ_NO,
STATUS,
AGENDA,
BLOCK_ID,
BLOCK_NAME,
SPEC_CATEGORY_ID,
SPEC_CATEGORY_NAME,
SPEC_ID,
SPEC_NAME,
LEVEL_01,
LEVEL_02,
LEVEL_03,
LEVEL_04,
LEVEL_05,
LEVEL_06,
LEVEL_07,
LEVEL_08,
LEVEL_09,
MODULE_ID,
MODULE_NAME,
SONY_ASSY_NUMBER,
LOCAL_PARTS_NUMBER,
LOCAL_PARTS_NAME,
SONY_MP_PARTS_NUMBER,
SONY_SERVICE_PARTS_NUMBER,
SONY_SERVICE_PARTS_NAME,
PARTS_QUANTITY,
SERVICE,
SUBSTITUTE,
SERVICE_MANUAL_REF,
CRP,
SAFETY_PART,
ELECTRONIC_KEY_PART,
PROVISION,
ACL_TYPE,
$VENDOR_NAME,
VENDOR_DESCRIPTION,
GENERATION_ID,
PROTOTYPE_MODEL_NUMBER,
REMARKS1,
REMARKS2,
SERVICE_MANUAL_REMARK1,
SERVICE_MANUAL_REMARK2,
EFFECTIVE_START_DATE,
EFFECTIVE_END_DATE,
TECHNICAL_NEWS,
CREATE_USER,
CREATE_DATE,
MODULE_A_NO,
COMBINATION_PARTS,
EXPLOSION_CODE_FOR_SERVICE,
SERVICE_MANUAL_BLOCK,
SUBSTITUTE_PART_INFO,
USER_ADD_FLAG
)
VALUES (VB_PLAN_ODM_BOM_SEQ. NEXTVAL,
T_INST_NO. ODM_BOM_ID,
T_INST_NO. SEQ_NO,
'00',
T_INST_NO. AGENDA,
T_INST_NO. BLOCK_ID,
T_INST_NO. BLOCK_NAME,
T_INST_NO. SPEC_CATEGORY_ID,
T_INST_NO. SPEC_CATEGORY_NAME,
T_INST_NO. SPEC_ID,
T_INST_NO. SPEC_NAME,
T_INST_NO. LEVEL_01,
T_INST_NO. LEVEL_02,
T_INST_NO. LEVEL_03,
T_INST_NO. LEVEL_04,
T_INST_NO. LEVEL_05,
T_INST_NO. LEVEL_06,
T_INST_NO. LEVEL_07,
T_INST_NO. LEVEL_08,
T_INST_NO. LEVEL_09,
T_INST_NO. MODULE_ID,
T_INST_NO. MODULE_NAME,
T_INST_NO. SONY_ASSY_NUMBER,
T_INST_NO. LOCAL_PARTS_NUMBER,
T_INST_NO. LOCAL_PARTS_NAME,
T_INST_NO. SONY_MP_PARTS_NUMBER,
T_INST_NO. SONY_SERVICE_PARTS_NUMBER,
T_INST_NO. SONY_SERVICE_PARTS_NAME,
T_INST_NO. PARTS_QUANTITY,
T_INST_NO. SERVICE,
T_INST_NO. SUBSTITUTE,
T_INST_NO. SERVICE_MANUAL_REF,
T_INST_NO. CRP,
T_INST_NO. SAFETY_PART,
T_INST_NO. ELECTRONIC_KEY_PART,
T_INST_NO. PROVISION,
T_INST_NO. ACL_TYPE,
T_INST_NO. $VENDOR_NAME,
T_INST_NO. VENDOR_DESCRIPTION,
T_INST_NO. GENERATION_ID,
T_INST_NO. PROTOTYPE_MODEL_NUMBER,
T_INST_NO. REMARKS1,
T_INST_NO. REMARKS2,
T_INST_NO. SERVICE_MANUAL_REMARK1,
T_INST_NO. SERVICE_MANUAL_REMARK2,
T_INST_NO. EFFECTIVE_START_DATE,
T_INST_NO. EFFECTIVE_END_DATE,
NULL,
p_in_user,
VABOSS_COMMON_PKG. TIMEZONE_CONVERSION_TO_JST,
T_INST_NO. MODULE_A_NO,
T_INST_NO.COMBINATION_PARTS,
T_INST_NO. EXPLOSION_CODE_FOR_SERVICE,
T_INST_NO. SERVICE_MANUAL_BLOCK,
T_INST_NO. SUBSTITUTE_PART_INFO,
T_INST_NO. USER_ADD_FLAG
);
v_ins_cnt: = v_ins_cnt + sql % ROWCOUNT;
IF MOD (v_ins_cnt, 500) = 0
THEN
COMMIT;
END IF;
EXCEPTION
WHILE OTHERS
THEN
VABOSS_COMMON_PKG.oracle_error_info (SQLCODE,
SQLERRM,
' VABOSS_ODM_CHNG_PKG. VABOSS_DEL_UPL_CHNG',.
p_in_user);
END;
END LOOP;
FOR T_UPD_FILE IN C_UPD
LOOP
BEGIN
UPDATE VABOSS_PLAN_ODM_BOM_FILE
SET CURRENT_STATUS = '90',
UPDATE_USER = P_IN_USER,
UPDATE_DATE = VABOSS_COMMON_PKG. TIMEZONE_CONVERSION_TO_JST
WHERE ODM_BOM_ID = T_UPD_FILE. ODM_BOM_ID;
EXCEPTION
WHILE OTHERS
THEN
VABOSS_COMMON_PKG.oracle_error_info (SQLCODE,
SQLERRM,
' VABOSS_ODM_CHNG_PKG. VABOSS_DEL_UPL_CHNG',.
p_in_user);
END;
END LOOP;
-VALIDATION;
-IMMEDIATE EXECUTION "VABOSS_INTR_ODM_BOM";
FOR T_DEL_INTR IN C_DEL
LOOP
BEGIN
DELETE
OF VABOSS_INTR_ODM_BOM
WHERE ODM_BOM_ID = T_DEL_INTR. ODM_BOM_ID;
UPDATE VABOSS_PLAN_ODM_BOM
SET STATUS = '99',
UPDATE_USER = P_IN_USER,
UPDATE_DATE = VABOSS_COMMON_PKG. TIMEZONE_CONVERSION_TO_JST
WHERE ODM_BOM_ID = T_DEL_INTR. ODM_BOM_ID;
COMMIT;
EXCEPTION
WHILE OTHERS
THEN
VABOSS_COMMON_PKG.oracle_error_info (SQLCODE,
SQLERRM,
' VABOSS_ODM_CHNG_PKG. VABOSS_DEL_UPL_CHNG',.
p_in_user);
END;
END LOOP;
/ * Calls a procedure SERVICE_PARTS_LIST_RELEASE_ODM * /.
VABOSS_SERVICE_BOM_PKG. SERVICE_PARTS_LIST_RELEASE_ODM-> >HERE I am GETTING the ERROR
(P_IN_UPD_NO,
P_IN_USER_NAME);
EXCEPTION
WHILE OTHERS
THEN
VABOSS_COMMON_PKG.oracle_error_info (SQLCODE,
SQLERRM,
' VABOSS_ODM_CHNG_PKG. VABOSS_DEL_UPL_CHNG',.
p_in_user);
END VABOSS_DEL_UPL_CHNG;
END VABOSS_ODM_CHNG_PKG;
/
your help is apprecited
Thank you
Krupa879534 wrote:
PLS-00201: identifier 'P_IN_USER_NAME' must be declared.CREATE OR REPLACE PACKAGE BODY VABOSS. VABOSS_ODM_CHNG_PKG
AS
PROCEDURE VABOSS_DEL_UPL_CHNG (P_IN_UPD_NO IN VARCHAR2, IN BOOLEAN P_IN_RECREATE, IN BOOLEAN P_IN_RELEASE, * P_IN_USER * IN VARCHAR2)... snip...
VABOSS_SERVICE_BOM_PKG. SERVICE_PARTS_LIST_RELEASE_ODM---> >HERE I am GETTING the ERROR
(P_IN_UPD_NO,
( P_IN_USER_NAME ) ;Spot the difference
-
package with error pls-00103.
Hello all;
I was wondering if you can help me understand why I get an error pls-003. Also, how you include a blank space in a where in the statement. Thanks for the help
See the package belowSomething similar to this where in (' ')
See the below package bodycreate or replace package NEW_INFORMATION is function total_number return number; procedure daily_tasks; end NEW_INFORMATION;
create or replace package body NEW_INFORMATION is ----------------------------------------------------------------------------------------------------- function total_number return number is oput number(10); begin select count(unique (p1.user_id)) into oput from table_one p1 where p1.user_id in ('JOHN', 'PAIR', ' '); return oput; end; ----------------------------------------------------------------------------------------------------- procedure daily_tasks is name_p_id varchar2(20); temp_num number(6,2); temp_num := total_number(); --used to call the above function begin end daily_tasks ; end NEW_INFORMATION;
Hello
Whenever you have a question about an error message, it helps if you post the full error message, including line numbers.
In the package body, you must:
procedure daily_tasks is name_p_id varchar2(20); temp_num number(6,2); temp_num := total_number(); --used to call the above function begin ...
The statement
temp_num := total_number(); --used to call the above function
would be good after the BEGIN statement, but not in front of him, in the declaration section.
If you declare and initialize temp_num at the same time, you can say:temp_num number (6,2) := total_number;
Given that you call total_number without argument, the parnetheses are optional.
The condition
where p1.user_id in ('JOHN', 'PAIR', ' ');
is syntactically correct. It will result in the rows being counted when user_id is one of the following:
(a) the 4 characters strring 'J', 'o', 'H', ' don't
(b) the 4 characters strring 'P', 'A', 'I', 'R', or
(c) the 6-character string '',' ', ' ', ' ', '',' ' (in other words, 6characters) If this isn't what you want, post a small example of data for table_one (CREATE TABLE and INSERT statements) and the results desired from these sample data.
Maybe you are looking for
-
Updated to El Capitan, lost over 40 000 photos!
I upgraded my macbook Pro of Cougar to El Capitan and lost more 40 000 photos iPhoto becomes unavailable. Very angry and praying I can get an answer on how to get them back. Any help is greatly appreciated that frustration is rising.
-
I bought this in Japan, is there an English version that I can download?
-
Cannot print on 8620 via the option on my network wireless
I have 3 computers with Windows 7. The printer works great as connected USB printer. the wireless set in place works very well and gets an IP address from my router wireless (an old LinkSys G wireless). I can't ping the printer. It does not appea
-
I have accidentlt deleated Microsoft office that came on my PC how do I get it back...
-
HP Wireless TV doesn't Connect - no sound from the TV
HP G60 - 235DX notebook PC with Windows Vista. HP Wireless TV Connect WY555AA #ABC model Connected to the HDMI port - 2 on a Samsung HD 52 '' TV The video is great, but no sound from the TV speakers. Sound plays on the mobile speakeres. I checked the