Error PLS-00428: an INTO clause is expected in this SELECT statement
Dear Experts,
I am new PL/SQL Programming
I am trying to run the following query i am getting Error.
Please help me to solve the error.
declare
var_cd number(20);
begin
if :P1_TYP_CAT is not null then
select max(CAT_cd + 1) as var_cd from IM_AST_CAT order by CAT_cd;
insert into IM_AST_CAT (CAT_NM, CAT_CD) values ((upper(:P1_TYP_CAT)),(:var_cd));
else
RAISE_APPLICATION_ERROR (-20001,'Both department and location must be provided');
end if;
end;
Others have already explained you the cause of the error. You can simplify your code like this.
begin
if :p1_typ_cat is not null then
insert into im_ast_cat
cat_nm
, cat_cd
select upper(:p1_type_cat)
, max(cat_cd + 1)
from im_ast_cat;
else
raise_application_error (-20001,'Both department and location must be provided');
end if;
end;
Similar Messages
-
PLS -00428-- an INTO clause is expected in the SELECT statement
I dnt know what i'm doing wrong with statement, can you help me please.
DECLARE start_date DATE:= to_date('01/09/2006' , 'DD-MON-YYYY');
end_date DATE:= to_date('30/09/2006' , 'DD-MON-YYYY');
BEGIN
SELECT t.SEC_SHORT_NAME, t.SEC_ISIN, t.SEC_NO,t.SEC_NAME, t.TRADE_DATE,
t.PAYMENT_DATE,t.COUNTERPARTY, t.PRICE , t.NOMINAL ,
t.TRANSACTION_NO,t.CURRENT_VALUE_PC, t.CURRENT_VALUE_SC, t.PAYMENT_AMOUNT_PC,
t.PAYMENT_AMOUNT_SC,
ct.AMOUNT , ct.CURRENCY,
sb.BUSINESS_CLASS_LEVEL_2 ,sb.BUSINESS_CLASS_LEVEL_2_NAME,
sb.BUSINESS_CLASS_LEVEL_3 ,sb.BUSINESS_CLASS_LEVEL_3_NAME,
sb.BUSINESS_CLASS_LEVEL_4 ,sb.BUSINESS_CLASS_LEVEL_4_NAME,
sb.BUSINESS_CLASS_LEVEL_5 ,sb.BUSINESS_CLASS_LEVEL_5_NAME
from scdat.A_TRANSACTIONS t
INNER JOIN scdat.A_COSTTAX ct
ON ct.TRANS_REF = t.TRANS_REF
INNER JOIN scdat.A_SECS_BUSINESS_CLASS_TS sb
ON sb.SEC_REF = t.SEC_REF
where t.TRADE_DATE >= to_char(start_date ,'DD-MON-YYYY')
and t.TRADE_DATE < to_char(end_date ,'DD-MON-YYYY')
and ct.COST_NAME = 'Broker commission'
and sb.BUSINESS_CLASS_DEFINITION = 'FTSE';
END;i think you should have placed your SELECT statement in a cursor variables since you
are using a date range instead of the INTO clause. this is to avoid too many rows error.
DECLARE
Cursor c1(pStartDate Date, pEndDate Date) Is
SELECT t.SEC_SHORT_NAME,
t.SEC_ISIN,
t.SEC_NO,
t.SEC_NAME,
t.TRADE_DATE,
t.PAYMENT_DATE,
t.COUNTERPARTY,
t.PRICE,
t.NOMINAL ,
t.TRANSACTION_NO,
t.CURRENT_VALUE_PC,
t.CURRENT_VALUE_SC,
t.PAYMENT_AMOUNT_PC,
t.PAYMENT_AMOUNT_SC,
ct.AMOUNT,
ct.CURRENCY,
sb.BUSINESS_CLASS_LEVEL_2,
sb.BUSINESS_CLASS_LEVEL_2_NAME,
sb.BUSINESS_CLASS_LEVEL_3,
sb.BUSINESS_CLASS_LEVEL_3_NAME,
sb.BUSINESS_CLASS_LEVEL_4,
sb.BUSINESS_CLASS_LEVEL_4_NAME,
sb.BUSINESS_CLASS_LEVEL_5,
sb.BUSINESS_CLASS_LEVEL_5_NAME
FROM scdat.A_TRANSACTIONS t
INNER JOIN scdat.A_COSTTAX ct ON ct.TRANS_REF = t.TRANS_REF
INNER JOIN scdat.A_SECS_BUSINESS_CLASS_TS sb ON sb.SEC_REF = t.SEC_REF
WHERE t.TRADE_DATE >= pStartDate
AND t.TRADE_DATE < pEndDate
AND ct.COST_NAME = 'Broker commission'
AND sb.BUSINESS_CLASS_DEFINITION = 'FTSE';
start_date DATE:= to_date('01/09/2006','DD-MON-YYYY');
end_date DATE:= to_date('30/09/2006','DD-MON-YYYY');
BEGIN
For c1_rec in c1(start_date, end_date) Loop
dbms_output.put_line('t.SEC_SHORT_NAME: '||t.SEC_SHORT_NAME);
dbms_output.put_line('t.SEC_ISIN: '||t.SEC_ISIN);
End Loop;
END; -
Dear Oracle Experts,
I try to use the stored procedure below but get this error :
"Error(4,1): PLS-00428: an INTO clause is expected in this SELECT statement"
I don't have any clue what could be wrong with my syntax. INTO wouldn't make any sense at this task.
Does someone of you know what's wrong with my Procedure ?
Hope someone can help,
best regards,
Daniel Wetzler
create or replace PROCEDURE AnalysisCompatibility (DATEBEGIN timestamp, DATEEND timestamp)
AS
BEGIN
select Fs.*,Vs.Analysispriority,Vs.Compatibility Compatibility from SigFacts Fs
inner Join Variables Vs On
(Fs.Var_Ref=Vs.Var_Ref and Fs.Machines_Ref=Vs.Machines_Ref )
where Fs.DT between DATEBEGIN and DATEEND
and
Vs.AnalysisPriority > 0
or
VS.Compatibility in (6,7,8,9,10,11,13,21,22)
order by Fs.DT,Fs.Machines_Ref desc, Vs.AnalysisPriority;
END AnalysisCompatibility;I have created a table (ATREPORT.TEST) that has has got the same column name and type of the query output and i still get error message
PLS-00403 -- statement ATreport.TESt cannot be used as an into target, pls help
DECLARE start_date DATE := to_date('01/09/2006' , 'DD-MON-YYYY');
end_date DATE := to_date('30/09/2006' , 'DD-MON-YYYY');
BEGIN
SELECT t.SEC_SHORT_NAME, t.SEC_ISIN, t.SEC_NO,t.SEC_NAME, t.TRADE_DATE,
t.PAYMENT_DATE,t.COUNTERPARTY, t.PRICE , t.NOMINAL ,
t.TRANSACTION_NO,t.CURRENT_VALUE_PC, t.CURRENT_VALUE_SC, t.PAYMENT_AMOUNT_PC,
t.PAYMENT_AMOUNT_SC,
ct.AMOUNT , ct.CURRENCY,
sb.BUSINESS_CLASS_LEVEL_2 ,sb.BUSINESS_CLASS_LEVEL_2_NAME,
sb.BUSINESS_CLASS_LEVEL_3 ,sb.BUSINESS_CLASS_LEVEL_3_NAME,
sb.BUSINESS_CLASS_LEVEL_4 ,sb.BUSINESS_CLASS_LEVEL_4_NAME,
sb.BUSINESS_CLASS_LEVEL_5 ,sb.BUSINESS_CLASS_LEVEL_5_NAME
INTO ATREPORT.TEST
from scdat.A_TRANSACTIONS t
INNER JOIN scdat.A_COSTTAX ct
ON ct.TRANS_REF = t.TRANS_REF
INNER JOIN scdat.A_SECS_BUSINESS_CLASS_TS sb
ON sb.SEC_REF = t.SEC_REF
where t.TRADE_DATE >= to_char(start_date ,'DD-MON-YYYY')
and t.TRADE_DATE < to_char(end_date ,'DD-MON-YYYY')
and ct.COST_NAME = 'Broker commission'
and sb.BUSINESS_CLASS_DEFINITION = 'FTSE';
END; -
ERROR INTO clause is expected in SELECT
Hi experts,
on executing the following code on Application Express 4.0.2.00.09. I had the error like below.
declare
xml_Base_No_Gra_Iva number;
xml_Base_Imponible NUMBER;
xml_Base_Imp_Grav NUMBER;
xml_Monto_Iva NUMBER;
xml_Valor_Ret_Iva NUMBER;
xml_Valor_Ret_Renta NUMBER;
xml_Tpld_Cliente VARCHAR2(2);
xml_Id_Cliente VARCHAR2(13);
xml_Tipo_Comprobante VARCHAR2(2);
xml_Numero_Comprobantes NUMBER;
xml_Id_Informante VARCHAR2(19);
begin
select c."Tpld_Cliente" as xml_Tpld_Cliente,
c."Id_Cliente" as xml_Id_Cliente,
c."Tipo_Comprobante" as xml_Tipo_Comprobante,
sum(c."Numero_Comprobantes") as xml_Numero_Comprobantes,
sum(c."Base_No_Gra_Iva") as xml_Base_No_Gra_Iva,
sum(c."Base_Imponible") as xml_Base_Imponible,
sum(c."Base_Imp_Grav") as xml_Base_Imp_Grav,
sum(c."Monto_Iva") as xml_Monto_Iva,
sum(c."Valor_Ret_Iva") as xml_Valor_Ret_Iva,
sum(c."Valor_Ret_Renta") as xml_Valor_Ret_Renta,
c."Id_Informante" as xml_Id_Informante
from "xml_VentasD" b
INNER JOIN "xml_Informante" a ON (b."Id_Informante" = a."Id_Informante")
INNER JOIN "xml_VentasD" c ON (c."Id_Informante" = b."Id_Informante"
and c."Id_VentasD" = b."Id_VentasD"
and c."Tpld_Cliente" = b."Tpld_Cliente"
and c."Id_Cliente" = b."Id_Cliente")
where a."Ruc" =:P12_RUC
and a."Anio" =:P12_ANIO
and a."Mes" =:P12_MES
group by c."Tpld_Cliente", c."Id_Cliente", c."Tipo_Comprobante", c."Id_Informante"
order by c."Tpld_Cliente", c."Id_Cliente";
end;
ORA-06550: line 17, column 8: PLS-00428: an INTO clause is expected in this SELECT statement
Please can you help me?you declared INTO variables but not using it ...
/* Formatted on 5/2/2013 6:58:55 PM (QP5 v5.185.11230.41888) */
DECLARE
xml_Base_No_Gra_Iva NUMBER;
xml_Base_Imponible NUMBER;
xml_Base_Imp_Grav NUMBER;
xml_Monto_Iva NUMBER;
xml_Valor_Ret_Iva NUMBER;
xml_Valor_Ret_Renta NUMBER;
xml_Tpld_Cliente VARCHAR2 (2);
xml_Id_Cliente VARCHAR2 (13);
xml_Tipo_Comprobante VARCHAR2 (2);
xml_Numero_Comprobantes NUMBER;
xml_Id_Informante VARCHAR2 (19);
BEGIN
SELECT c."Tpld_Cliente",
c."Id_Cliente",
c."Tipo_Comprobante",
SUM (c."Numero_Comprobantes"),
SUM (c."Base_No_Gra_Iva"),
SUM (c."Base_Imponible"),
SUM (c."Base_Imp_Grav"),
SUM (c."Monto_Iva"),
SUM (c."Valor_Ret_Iva"),
SUM (c."Valor_Ret_Renta"),
c."Id_Informante"
INTO xml_Tpld_Cliente,
xml_Id_Cliente,
xml_Tipo_Comprobante,
xml_Numero_Comprobantes,
xml_Base_No_Gra_Iva,
xml_Base_Imponible,
xml_Base_Imp_Grav,
xml_Monto_Iva,
xml_Valor_Ret_Iva,
xml_Valor_Ret_Renta,
xml_Id_Informante
FROM "xml_VentasD" b
INNER JOIN "xml_Informante" a
ON (b."Id_Informante" = a."Id_Informante")
INNER JOIN "xml_VentasD" c
ON ( c."Id_Informante" = b."Id_Informante"
AND c."Id_VentasD" = b."Id_VentasD"
AND c."Tpld_Cliente" = b."Tpld_Cliente"
AND c."Id_Cliente" = b."Id_Cliente")
WHERE a."Ruc" = :P12_RUC AND a."Anio" = :P12_ANIO AND a."Mes" = :P12_MES
GROUP BY c."Tpld_Cliente",
c."Id_Cliente",
c."Tipo_Comprobante",
c."Id_Informante"
ORDER BY c."Tpld_Cliente", c."Id_Cliente";
END;http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/selectinto_statement.htm -
Getting error while executing this select statement
Hi All,
I am new to this community.
I am getting error whie compiling the below code. Its telling 'Text' is invalid identifier. Also i want to know how can we obtain 'parseable' version of the below query?
my basic intention is to create a trigger header through a select statement and show it the complete text as a single column..
select text from
(select 'CREATE OR REPLACE TRIGGER '||SUBSTR(column_name,2,4)||'aud
AFTER INSERT
OR UPDATE
OF '||column_name||',
OR DELETE ON '||table_name||'
FOR EACH ROW'
FROM(SELECT lower(REPLACE(column_name,'O_','')) column_name , /*changing O to O_*/
lower(replace(t.table_name,'_A_','_')) table_name,
lower(t.table_name) table_name1,
c.column_id
FROM all_tab_columns c,
(SELECT object_name table_name
FROM all_objects
WHERE object_name LIKE '%/_A/_%' ESCAPE '/') t
WHERE c.table_name(+) = t.table_name
AND SUBSTR(column_name(+),1,2) = 'O_'))thanks prathamesh. it solved the problem. i have one more question.
as of now it creates single create trigger statement for each column on a table.
example:
CREATE OR REPLACE TRIGGER ust_aud
AFTER INSERT
OR UPDATE
OF cust_id,
OR DELETE ON characteristic_t
FOR EACH ROW
however, i want to create trigger for all columns in a single statement. can you please help me how to do it?
basically want to 'CREATE TRIGGER' for all columns in a table. i am finding difficult how to change my query to suit this!!
i am pasting my original query again for your reference. pls advise...
example:
CREATE OR REPLACE TRIGGER ust_aud
AFTER INSERT
OR UPDATE
OF cust_id,
fixed_item_val,
copy_item_val,
rgn_id,
txn_id,
OR DELETE ON characteristic_t
FOR EACH ROW
ORIGINAL QUERY
select text from
(select 'CREATE OR REPLACE TRIGGER '||SUBSTR(column_name,2,4)||'aud
AFTER INSERT
OR UPDATE
OF '||column_name||',
OR DELETE ON '||table_name||'
FOR EACH ROW' text
FROM(SELECT lower(REPLACE(column_name,'O_','')) column_name , /*changing O to O_*/
lower(replace(t.table_name,'_A_','_')) table_name,
lower(t.table_name) table_name1,
c.column_id
FROM all_tab_columns c,
(SELECT object_name table_name
FROM all_objects
WHERE object_name LIKE '%/_A/_%' ESCAPE '/') t
WHERE c.table_name(+) = t.table_name
AND SUBSTR(column_name(+),1,2) = 'O_')) -
Why would this select statement give an error?
*LOOKUP Z_HELPER
*DIM TGT1 : ACCOUNT="AA_1070100"
*DIM CATEGORY="ACTUAL"
*DIM TIME="2011.JAN"
*ENDLOOKUP
*SELECT(%TGTDEST2%, "[ID]", TARGETDESTINATION, "[UNIQUEIDENTIFIER]"=LOOKUP(TGT))
UniqueIdentifier is a property of Targetdestination dimension. Here is the error its giving:
Validation status of executable file: Failed
- Unclosed quotation mark after the character string '=LOOKUP(TGT'. in:select [ID] from mbrTARGETDESTINATION where [UNIQUEIDENTIFIER]"=LOOKUP(TGT
Validation status of syntax: Failed
- Invalid syntax found; see statements in redNilanjan, I changed TGT to TGT1, still same thing. Here is the big picture outcome I am trying to achieve.
Reporting App
Entity Costcenter Shipto Time Category Account Signed data
ABC CO1 USA 2011.jan Actual ACT123 200
So data is coming in like this, the business wants to set up rules such as.....when Costcenter is CO1 AND Shipto is USA AND Entity is ABC....Change the shipto from USA to INDIA. These rules have to be able to be updated by a business user, So I cant hardcode these rules. My manager doesnt want to use Stored procedures, so here is what I did....
Z_Helper App(Non reporting App)
Entity Costcenter Shipto signeddata (other required dimensions are just dummy values)
ABC CO1 USA 9
Now how does 9 get linked to INDIA? I created a new dimension called TARGETDESTINATION. it has ID(which is nothing but shipto country values), and a property called UNIQUEIDENTIFIER. Unique Identifier basically just assigned a unique value to that shiptocountry member row.
So now I need to write a script logic in reporting app that will look up signed data of 9 in this example, and I was thinking use a select statement to pull INDIA from TARGETDESTINATION dimension.
Let me know if you have any suggestions. thanks. -
Why am I getting an error in this Select statement ?
Any reason why this SQL string does not work on Oracle ?
SELECT * From kestjori.vatnshaed_web WHERE TIEINS = '1' AND TIDTIM BETWEEN To_Date('01.01.2000') AND To_Date('27.10.2000');
TIEINS is of the datatype NUMBER(3)
TIDTIM is of the datatype DATE
I am getting this error :
SQLException: [ORACLE][ODBC Oracle Driver][Oracle OCI] ORA-00911: invalid character
With thanks in advance,
Oskar Jenssoni think there is one exact problem in sql and other is optional.
1. u write field
TIEINS is of the datatype NUMBER(3)
but in query in where part u write
where TIEINS = '1'
so problem is of data type.
second optional problem can be removed by given date format in to_Date() function.
like To_Date('27.10.2000','dd.mm.yyyy')
i hope it will help u
bye
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Oskar Jensson ([email protected]):
Any reason why this SQL string does not work on Oracle ?
SELECT * From kestjori.vatnshaed_web WHERE TIEINS = '1' AND TIDTIM BETWEEN To_Date('01.01.2000') AND To_Date('27.10.2000');
TIEINS is of the datatype NUMBER(3)
TIDTIM is of the datatype DATE
I am getting this error :
SQLException: [ORACLE][ODBC Oracle Driver][Oracle OCI] ORA-00911: invalid character
With thanks in advance,
Oskar Jensson<HR></BLOCKQUOTE>
null -
How to convert this select statement into update
Hai All
I have two table Namely Daily_attend , Train_mast
Daily_attend Consist Of fields are Train_mast consist Of fields are
Name varchar Train no var
Empcode Num T_date date
Intime Date Train_name var
Outtime date Late_hrs var
IND_IN Number
IDE_OUT Number
Attend_date date
I need to update IDE_IN In Daily_attend table Depend upon late_hrs in the Train_mast table
I have got Through in select statement This is my select statement
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 dail_Att,train_mast;
How can i convert it to update
Any help is highly appricateable
Thanks In Advance
Regards
Srikkanth.MSrikkanth,
Try this code. And 1 more thing, i can'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 <condition>);Regards,
Manu.
If my response or the response of another was helpful or Correct, please mark it accordingly -
Problem with showing a group of records in dynamic page (PLS-00428 error)
Hi
I have problems with viewing a group of records from db. I've created Page, which "Page Type" attribute is "PL/SQL". In "PL/SQL Code" field, I've written very simple SQL query: "SELECT * FROM PORTAL_DEMO.EMP ;"
I'd like to generate HTML table with it's result. Unfortunately, every time I get the same Exception:
Error 30584: DBMS_SQL has raised an unhandled exception. ORA-06550: line 1, column 7: PLS-00428: an INTO clause is expected in this SELECT statement
Is it necessary to write a COURSOR (and use HTP function) to realize this functionality? I succeed, trying this way - but it is very uncomfortable ( a lot of code ).
What I have done in wrong way?
Please help me.
Best regards
MarioHow do I handle this?
-
Getting pls-00428 error.
Hi all,
I'm trying to fix some invalid objects in our 11g database and i'm getting a pls-00428 error. Not sure where the issue is originating at (keep in mind, my IT team and I are not thoroughly experienced with 11g, so I apologize if this sounds a little too newbie-ish)
Here's the plsql:
create or replace
FUNCTION detail_cogs (
sSKU varchar2
--,dtFrom date := sysdate
return number
is
nRetval number;
begin
select *
--SUM(cost * ieqty) into nRetval
from (
select
ie.qty ieqty
,ie.part
,ic.validdate
,ic.cost
,LAG(validdate) OVER (partition by ic.part order by validdate desc) prev_entry_time
from
oracle2_partexplosion_mv ie
,oracle2_itemcogs_mv ic
where
ie.sku = sSKU
and ic.part = ie.part
and ic.validdate <= sysdate
order by part, validdate desc
where
prev_entry_time is null;
return nRetval;
exception
when others then
return null;
end;Welcome to the forum.
Reading the documentation will save you:
PLS-00428: an INTO clause is expected in this SELECT statement
Cause: The INTO clause of a SELECT INTO statement was omitted. For example, the code might look like SELECT deptno, dname, loc FROM dept WHERE ... instead of SELECT deptno, dname, loc INTO dept_rec FROM dept WHERE ... In PL/SQL, only a subquery is written without an INTO clause.
http://download.oracle.com/docs/cd/E11882_01/server.112/e10880/pcmus.htm#sthref17855
http://www.oracle.com/pls/db112/search?word=select+into&partno=e10472
Doc home: http://www.oracle.com/pls/db112/homepage
And please change or remove this part from your code anyway, since it's nothing but a bug:
exception
when others then
return null;11g compiler warned you already about that, I may hope... -
PLS-00428 Why SELECT must be adorned with REF CURSOR to work?
hello
*"PLS-00428: an INTO clause is expected in this SELECT statement"* - This problem has been resolved. I just want to understand WHY SELECT statements need to be paired with REF CURSOR.
To reproduce this,
DECLARE
Id1 numeric(19,0);
Id2 numeric(19,0);
CreateTimestamp date;
BEGIN
-- ATTN: You'd either need to select into variable or open cursor!
select * from SystemUser left join Person on Person.Id = SystemUser.PersonId WHERE Person.PrimaryEmail in ('[email protected]','[email protected]');
END;
Solution?
* In install script:
CREATE OR REPLACE PACKAGE types
AS
TYPE cursorType IS REF CURSOR;
END;
* Then in your query:
DECLARE
Id1 numeric(19,0);
Id2 numeric(19,0);
Result_cursor types.cursorType;
BEGIN
OPEN Result_cursor FOR select * from SystemUser left join Person on Person.Id = SystemUser.PersonId WHERE Person.PrimaryEmail in ('[email protected]','[email protected]');
END;
I Googled for reasonable explaination - closest is: http://www.tek-tips.com/viewthread.cfm?qid=1338078&page=34
That in oracle block or procedures are expected to do something and a simple SELECT is not!! (Very counter intuitive). What needs to be done is therefore to put the select output into a ref-cursor to fool oracle so that it thinks the procedure/block is actually doing something. Is this explanation right? Sounds more like an assertion than actually explaining...
Any suggestion please? Thanks!Opening a cursor (ref cursor or otherwise) is not the same as executing a select statement.
A select statement returns data, so if you are using it inside PL/SQL code it has to return that data into something i.e. a local variable or structure. You can't just select without a place for the data to go.
Opening a cursor issues the query against the database and provides a pointer (the ref cursor), but at that point, no data has been retrieved. The pointer can then be used or passed to some other procedure or code etc. so that it may then fetch the data into a variable or structure as required.
It's not counter-intuitive at all. It's very intuitive. -
Oracle 11gR2 Linux x86_64
Hi all,
I am running the below PL/SQL block but getting the below error. From what I know, the INTO clause can only be used when a single row will be returned. In this case, I know it returns multiple rows, so why is it asking to use the INTO clause?
DECLARE
v_object VARCHAR2(10) := 'TABLE';
v_schema VARCHAR2(30) := 'TEST';
CURSOR tblsze_cur IS
SELECT table_name
FROM dba_tables
WHERE owner='TEST'
AND table_name IN (
'T1',
'T2',
'T3');
BEGIN
FOR tbl_rec IN tblsze_cur
LOOP
select * from
table(dbms_space.OBJECT_GROWTH_TREND
(v_schema,tbl_rec.table_name,v_object));
END LOOP;
END;
select * from table(dbms_space.OBJECT_GROWTH_TREND
ERROR at line 21:
ORA-06550: line 21, column 3:
PLS-00428: an INTO clause is expected in this SELECT statementOk, I think I have the TYPES correct...taken from the documentation.
DECLARE
v_object VARCHAR2(10) := 'TABLE';
v_schema VARCHAR2(30) := 'TEST';
TYPE object_growth_trend_row IS RECORD(
timepoint TIMESTAMP,
space_usage NUMBER,
space_alloc NUMBER,
quality VARCHAR(20));
TYPE object_growth_trend_table IS TABLE OF object_growth_trend_row;
TYPE nmtbl IS TABLE OF dba_tables.table_name%TYPE;
tname nmtbl;
CURSOR c1 IS
SELECT table_name
FROM dba_tables
WHERE owner='TEST'
AND table_name IN (
'T1',
'T2',
'T3');
BEGIN
OPEN c1;
FETCH c1 BULK COLLECT INTO tname;
FOR i IN tname.FIRST .. tname.LAST
LOOP
select * from (dbms_space.OBJECT_GROWTH_TREND (v_schema, tname, v_object)) INTO object_growth_trend_table;
DBMS_OUTPUT.PUT_LINE (object_growth_trend_table);
END LOOP;
CLOSE c1;
END;
select * from (dbms_space.OBJECT_GROWTH_TREND (v_schema,tname,v_object) INTO object_growth_trend_table);
ERROR at line 33:
ORA-06550: line 33, column 55:
PL/SQL: ORA-00907: missing right parenthesis
ORA-06550: line 33, column 9:
PL/SQL: SQL Statement ignored -
INTO clause expected in SELECT statement
Hi all,
I have this pl sql code that errors out:an INTO clause is expected in this SELECT statement.
Code
Declare
prev_col1 FLOAT(10) := 0;
temp3 temp2%rowtype;
Begin
select * from
select col1, col2, col3,
lag(col1,1,0) over(order by rownum) prev_col1
from temp2 where <conditions here> order by col2
where col1- prev_col1 > 10000 and col1>0 and prev_col1>0;
End;
I have tried in vain to use select into, with both the select statements(separately). Please advise.
Basically, I am comparing a field with the previous field and identifying faulty fields. Then I want to replace the faulty field with the previous field.I have tried this in vain:
Declare
prev_col1 FLOAT(10) := 0;
v_col1 temp2.col1%type;
v_col2 temp2.col2%type;
v_col3 temp2.col3%type;
Begin
select col1, col2, col3, prev_col1 into v_col1, v_col2, v_col3, prev_col1 from
select col1, col2, col3,
lag(col1,1,0) over(order by rownum) prev_col1
from temp2 order by col3
where col1- prev_col1 > 10000 and prev_col1 > 0;
UPDATE temp2 SET col1= prev_col1 WHERE (col1- prev_col1 > 10000 and prev_col1 > 0);
End;
I am only able to update the declared variable:v_col1. How do I update the original value in table temp2? -
Getting error PLS-00307: too many declarations while instantiating object.
Hi,
I'm using oracle 10.2.0.4.0
I've created an object obj_bsk as follows:
create or replace type obj_bsk as object
(batch_set_key varchar2(64),
constructor function obj_bsk
return self as result,
constructor function obj_bsk(p_batch_set_key in varchar2)
return self as result,
member procedure display_batch_set_key
and object body as
create or replace type body obj_bsk as
constructor function obj_bsk
return self as result is
begin
self.batch_set_key := sys_guid();
return;
end;
constructor function obj_bsk (p_batch_set_key varchar2)
return self as result is
begin
self.batch_set_key := p_batch_set_key;
return;
end;
member procedure display_batch_set_key is
begin
dbms_output.put_line('batch_set_key is:' || self.batch_set_key);
end;
end;
Then I've created a package test_obj as follows:
specification:
create or replace package test_obj is
-- Author : TSHARMA
-- Created : 31/01/2012 10:32:37
-- Purpose : to test objects
my_bsk obj_bsk;
g_batch_set_key varchar2(64);
procedure show_obj_val;
end test_obj;
body:
create or replace package body test_obj is
procedure show_obj_val is
begin
my_bsk.display_batch_set_key();
end;
begin
-- Initialization
if (g_batch_set_key is not null) then
my_bsk := obj_bsk(g_batch_set_key);
else
my_bsk := obj_bsk();
end if;
end test_obj;
When I'm compiling the package I'm getting following error:
Compilation errors for PACKAGE BODY TSHARMA.TEST_OBJ
Error: PLS-00307: too many declarations of 'OBJ_BSK' match this call
Line: 12
Text: my_bsk := obj_bsk(g_batch_set_key);
Error: PL/SQL: Statement ignored
Line: 12
Text: my_bsk := obj_bsk(g_batch_set_key);
Can anyone please explain why oracle is viewing it as too many call for constructor when both constructors are different.
and how to resolve the issue.
Thanks
TarunI've solved the problem. Though it is strange.
The error occurred because I'm using p_batch_set_key as parameter constructor.
i.e. constructor function obj_bsk(p_batch_set_key in varchar2)
return self as result,
once I changed it to the same name as variable name in object it compiled fine.
i.e constructor function obj_bsk(batch_set_key in varchar2)
return self as result,
It is very strange. Can anyone plesae explain why the parameter name should be same as variable name in object.
Thanks
Tarun -
Hi ,
I am currently working with a include which is already written. The include has a select statement where the into clause is not available.
SELECT SINGLE * FROM cnvmbtrename
WHERE packid = p_pack
AND domname = space
AND param = gc_rfcdest
AND value_old = ls_rename1-value_old
AND value_new = ls_rename1-value_new.
This statement works fine when it is sued in some other program, but i does not work in mine. Can someone help me on this front.
Regards,
RishavHi
U make sure all global data are defined in your program too, so:
- Database table:
TABLES cnvmbtrename.
- Selection screen (I suppose):
PARAMETERS: P_PACK....
- Data:
DATA: gc_rfcdest
Max
Maybe you are looking for
-
Help need in buliding my Online Bidding Project
hello all, i am quite new to JSP. as part of my MS course work i am building a OnLine Bidding system or an Auction system. hope u all might have seen sites like. yahooauctions and ubid.com.. i want to know wether it is easy to do with JSP or complete
-
Portlet could not be contacted error in content area
hi everybody, i've developed an application using Portal Content Area.And i am accessing the content Area like "http://<servername>/pls/portal30/url/folder/<Content area name>". But when i access it shows "Error : Portlet could not be Contacted".then
-
Problem with affinetransformOp method...
I have a serious problem with filter method I Want to make a image flipping or some other filtering by using AffineTransformOp but it printouts an erro like this cannot resolve symbol op.filter (img, flipped) (the error pointer shows ".after the op")
-
hi, How to do invoice printing in batches & background scheduling ie., suppose there are 20 invoice i want to create spool request & print all 20 invoice-at paerticular date & time. Pl suggest
-
Components for the Subcontract Purchase Order
Hello All, I am trying to create a subcontract Purchase Order, I have created a subcontract Purchase Info Record using ME11 for the Finished Goods and also defined the BOM using CS01. When using ME21N, I have defined the line item as L Category. In