SELECT * INTO Problem
I need help, please. I'm trying this basic statement to create a backup copy of the hr.employees table.
SELECT * INTO employees_Backup FROM employees
Which I copied from examples on the internet (two sources, same syntax)
When I run this in SQL Developer, I get the following:
ORA-00905: missing keyword
00905. 00000 - "missing keyword"
*Cause:
*Action:
Error at Line: 1 Column: 14
Hi,
Houffle wrote:
... Now, if I can just learn to format my code when I post.This site normally doesn't display multiple spaces in a row.
Whenever you post formatted text (such as query results) on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
Similar Messages
-
Oracle Function with a select into problem
Here is one that I cannot figure out. I'm trying to select the median of a set of events in a purchase qty. I have the selects working in SQL. It returns the correct answer for several sets of test data. However, when I put this into a function to be able to call during more complex queries it doesn't work. I've tested the function several different ways and it's looking like the select median into v_median2... is not working. Please help!
Here is the code... When this is run what ever is in v_plant is returned. IE: If you pass 1122 into with getmedian('4567','12345678-0001') this returns 4567 at the output. I've bypassed the v_plant and v_material in the select part below and it still output 4567.
If you run the select (with test data put in place of v_plant and v_material in a sqlplus window without the INTO v_median2) it would return a 12.
If you run this function as is it would return 4567.
Here is the output from the dbms_output tests.
4567
12345678-0001
4567
12345678-0001
4567
WHY?
CREATE OR REPLACE FUNCTION getmedian(v_plant IN VARCHAR2, v_material IN VARCHAR2)
RETURN NUMBER
AS
v_median2 NUMBER;
BEGIN
DBMS_OUTPUT.PUT_LINE(v_plant);
DBMS_OUTPUT.PUT_LINE(v_material);
SELECT MEDIAN INTO v_median2
FROM (SELECT ROWNUM as rownums,MEDIAN
FROM (SELECT abs(quantity_in_unit_entry) AS MEDIAN
FROM tbl_transactions
WHERE plant = v_plant
AND material = v_material
AND movement_type IN ('961','261','201')
ORDER BY quantity_in_unit_entry DESC))
WHERE ROWNUMs = ( select round(COUNT(1)/2,0) AS TOTAL2
from tbl_transactions t
WHERE plant = v_plant
AND material = v_material
AND t.movement_type IN ('961','261','201'));
DBMS_OUTPUT.PUT_LINE(v_plant);
DBMS_OUTPUT.PUT_LINE(v_material);
DBMS_OUTPUT.PUT_LINE(v_median2);
RETURN v_median2;
END;It looks like another one of those cases where the pl/sql engine doesn't yet handle everything that the sql engine does. The usual solution is to execute the part that only works in sql dynamically. Try this:
CREATE OR REPLACE FUNCTION getmedian
(v_plant IN VARCHAR2,
v_material IN VARCHAR2)
RETURN NUMBER
AS
v_rownums NUMBER := 0;
v_sql VARCHAR2 (4000) := NULL;
v_median2 NUMBER := 0;
BEGIN
SELECT ROUND (COUNT (1) / 2, 0)
INTO v_rownums
FROM tbl_transactions
WHERE plant = v_plant
AND material = v_material
AND movement_type IN
('961', '261', '201');
v_sql :=
'SELECT median
FROM (SELECT ROWNUM AS rownums,
median
FROM (SELECT ABS (quantity_in_unit_entry)
AS median
FROM tbl_transactions
WHERE plant = :v_plant
AND material = :v_material
AND movement_type IN
(''961'', ''261'', ''201'')
ORDER BY quantity_in_unit_entry DESC))
WHERE rownums = :v_rownums';
EXECUTE IMMEDIATE v_sql INTO v_median2
USING v_plant, v_material, v_rownums;
RETURN v_median2;
END getmedian; -
MS-SQL - Oracle SELECT INTO conversion problem...
Under MS-SQL (T-SQL) Select statement is defined as follows:
SELECT select_list
[INTO new_table_]
^^^^^^^^^^^^^^^^^^^^^
FROM table_source
[WHERE search_condition]
[GROUP BY group_by_expression]
[HAVING search_condition]
[ORDER BY order_expression [ASC | DESC] ]
Q:How under PL/SQL can one redirect sorted (ORDERed BY) results
from SELECT query to another table.
Slawek
nullI have asked the question because of the following reason:
I have a large select query that returns rows from a table in
different sort orders depending on user inputs, and I wonder if
there is any way to return just the rows between two specified
positions.
I figured that I'm going to either create one temporary table
with all the data (1000 records for example), sort the data in
the prefered order and use the rownum method to obtain the row
range (works fine under T-SQL). Other way is to try an inline
view that return the rownumber. I can then restrict the numer of
fields, e.g.
select empid, rowNumber from emp,
(select empid as id, rownum as rowNumber from emp) x
where empid = id
and rowNumber between 2 and 5
The problem is that under Oracle the subquery is not allowed to
have an ORDER BY clause (even if it had, rownum reflects row
numbers before they were sorted) and there is no SELECT into
TABLE_NAME.
Michael Malicky (guest) wrote:
: Slawek (guest) wrote:
: : Under MS-SQL (T-SQL) Select statement is defined as follows:
: : SELECT select_list
: : [INTO new_table_]
: : ^^^^^^^^^^^^^^^^^^^^^
: : FROM table_source
: : [WHERE search_condition]
: : [GROUP BY group_by_expression]
: : [HAVING search_condition]
: : [ORDER BY order_expression [ASC | DESC] ]
: : Q:How under PL/SQL can one redirect sorted (ORDERed BY)
results
: : from SELECT query to another table.
: : Slawek
: Order by is irrelevant when creating a new table out of a
: query, as the rows are NOT stored in any order in a table.
: The syntax for creating a new table out of an existing one
: is:
: CREATE TABLE new_table AS
: SELECT select_list FROM old_table
: WHERE ...
: etc.
: /mike
null -
SELECT INTO clause strange problem
Hi all,
I need some help with a very strange select into statement.Select into throws NO DATA exception even if table has data.
I am trying to invoke procedure from BPEL.Inside the procedure,I am trying to get "name' from definitions table.But it always throws Data NOT Found exception.But table has relevant data and i am able to see the data by executing the same query outside the BPEL environment/flow(SQL PLUS).
Also,I kept dummy test table for Debugging purpose and it inserted with temp value '103'.
My procedure looks like below
temp:='103';
INSERT INTO test
VALUES ('Test-1' ||dummy,sysdate);
commit;
SELECT name
INTO p_name
FROM definitions
WHERE id =temp;
Please help me in this regards
Thanks in advance.Hi Frank,
Thanks for quick response.
My actual query is
dummy:=assume getting_valid_value from BPEL(also same dummy inserting into temp value);
SELECT organization_code
INTO p_warehousename
FROM org_organization_definitions
WHERE .organization_code = dummy;
What are the schemas involved? APPS
(Who owns the table?
Who own the procedure? APPS
Is it defined with "AUTHID CURRENT_USER"? NO IDEA
Who runs it when you get the error? Thru BPEL actually
What runs the same query in SQL*Plus and sees a row?). v*alid value(ALF)*
I checked with low level security query as it returns nothing.
thanks -
Select Into statement in db function - query from granted schema table
problem with "select into" in db function in 10.2
There are two schemas. 'mdbdev' is the master database and 'devusr' is granted SELECT table access to execute queries in mdbdev schema.
with devusr, in SQL, I'm able to execute the following query
select wm_concat(strConcatedCountryList)
from (select country_name as strConcatedCountryList from mdbdev.country_master mdbcm
where mdbcm.country_ship_status = <param?>
order by country_name)
but when I use the same query in function/procedure with "select into", the compilation failed with error *"table or view does not exist"*
FUNCTION GETCOUNTRYLISTTOSHIP (SHIP_STATUS IN NUMBER)
RETURN VARCHAR2
IS
var2CountryList VARCHAR2(1000);
BEGIN
select wm_concat(strConcatedCountryList) INTO var2CountryList
from (select country_name as strConcatedCountryList from mdbdev.country_master mdbcm
where mdbcm.country_ship_status = <value of SHIP_STATUS>
order by country_name);
return var2CountryList;
END;
Please advise/help/hint :)David, Justine, Thank you. The facts from this forum post helped a lot to get the solution.
The query helped a lot (select * from all_tab_privs_recd where owner = 'MDBDEV' and table_name = 'COUNTRY_MASTER").
there was a grant using ???(donno wht DBA said) and no direct SELECT grant on that country_master to "devusr". grant command executed. Now, it works :) -
Dynamic column name with SELECT INTO
I am trying to build a function that derives a pay amount from a set of business rules. There are about 40 columns that hold various pay amounts and their column names are variations of 4 indicators (day shift, vs night shift, etc.) that I have to dynamically look up, ie here is the ID number and a timecard, now figure out which of the 40 fields to look up to get the pay amount.
I can determine from the timecard and employee ID which field to look at, but I'm getting hung up with the syntax needed to construct and execute the statement inside the PL/SQL block. I need to RETURN the pay I extract using the function, and I can create the correct SQL statement, but the EXECUTE IMMEDIATE won't accept the SELECT INTO syntax.
Can someone please suggest a solution? Here is the function:
create or replace FUNCTION FN_GET_PAYRATE(tc in NUMBER, e in NUMBER, pc in VARCHAR2)
RETURN NUMBER
IS
e_id NUMBER;
tc_id NUMBER;
pl_cd VARCHAR2(7);
shft VARCHAR2(2);
lvl VARCHAR2(2);
typ VARCHAR2(2);
e_typ VARCHAR2(4);
proj NUMBER;
hrly VARCHAR2(4);
payrt NUMBER;
var_col VARCHAR2(10);
sql_select VARCHAR2(200);
sql_from VARCHAR2(200);
sql_where VARCHAR2(200);
sql_and1 VARCHAR2(200);
sql_and2 VARCHAR2(200);
sql_and3 VARCHAR2(200);
sql_orderby VARCHAR2(200);
var_sql VARCHAR2(2000);
BEGIN
e_id := e;
tc_id := tc;
pl_cd := pc;
SELECT NVL(SHIFT,'D') INTO shft
FROM TS_TIMECARD_MAIN
WHERE TIMECARD_ID = tc_id;
--DBMS_OUTPUT.PUT_LINE('SHIFT= ' || shft);
SELECT NVL(PAY_LVL, 1), NVL(PAY_TYPE, 'B'), NVL(RTRIM(EMP_TYPE), 'LHD'), NVL(PROJECT, 001)
INTO lvl, typ, e_typ, proj
FROM TS_EMPLOYEES
WHERE EMP_ID = e_id;
--DBMS_OUTPUT.PUT_LINE('Level= ' || lvl);
--DBMS_OUTPUT.PUT_LINE('PAY_TYPE= ' || typ);
--DBMS_OUTPUT.PUT_LINE('EMP_TYPE= ' || e_typ);
--DBMS_OUTPUT.PUT_LINE('PROJECT= ' || proj);
IF e_typ <> 'LHD' THEN
hrly := 'H';
ELSE
hrly := '';
END IF;
IF proj <> 001 THEN
var_col := shft || lvl || typ || hrly;
--DBMS_OUTPUT.PUT_LINE('RATE COLUMN= ' || var_col);
sql_select := 'SELECT NVL(' || var_col || ', .01) INTO payrt';
sql_from := ' FROM TS_PAYRATES';
sql_where := ' WHERE PROJECT_ID = ' || proj;
sql_and1 := ' AND ACTIVE = 1';
sql_and2 := ' AND JOB_TYPE = ' || CHR(39) || e_typ || CHR(39);
sql_and3 := ' AND PILE_ID = ' || CHR(39) || pl_cd || CHR(39);
var_sql := sql_select || sql_from || sql_where || sql_and1 || sql_and2 || sql_and3 || sql_orderby;
DBMS_OUTPUT.PUT_LINE('SQL: ' || var_sql);
EXECUTE IMMEDIATE var_sql;
DBMS_OUTPUT.PUT_LINE('RATE= ' || payrt);
RETURN payrt;
ELSE
DBMS_OUTPUT.PUT_LINE('ERROR');
RETURN 1;
END IF;
END;
I have alternately tried this:
SELECT NVL(var_col,.01) into payrt
FROM TS_PAYRATES
WHERE PROJECT_ID = proj AND ACTIVE = 1
AND JOB_TYPE = CHR(39) || e_typ || CHR(39)
AND PILE_ID = CHR(39) || pl_cd || CHR(39);
as a substitute for the EXECUTE IMMEDIATE block, but I can't seem to use a dynamic substitution for the column name.
Any help would be greatly appreciated.That's the most difficult part - the error messages seem to indicate a problem with the SQL statement in its execution context, because I can take the SQL string by itself and it executes perfectly.
Here are three variations:
SELECT INTO
select fn_get_payrate(21555, 30162, 15) from dual
ERROR at line 1:
ORA-00905: missing keyword
ORA-06512: at "PEOPLENETIF.FN_GET_PAYRATE", line 60
SQL: SELECT NVL(N4P , .01) INTO payrt FROM TS_PAYRATES WHERE PROJECT_ID = 701 AND ACTIVE = 1 AND JOB_TYPE = 'LHD' AND PILE_ID = '15'
Without SELECT INTO (returns NULL)
SQL> select fn_get_payrate(21555, 30162, 15) from dual;
FN_GET_PAYRATE(21555,30162,15)
SQL: SELECT NVL(N4P , .01) FROM TS_PAYRATES WHERE PROJECT_ID = 701 AND ACTIVE = 1 AND JOB_TYPE = 'LHD' AND PILE_ID = '15'
RATE=
EXECUTE IMMEDIATE USING
SQL> select fn_get_payrate(21555, 30162, 15) from dual;
select fn_get_payrate(21555, 30162, 15) from dual
ERROR at line 1:
ORA-01006: bind variable does not exist
ORA-06512: at "PEOPLENETIF.FN_GET_PAYRATE", line 61
SQL: SELECT NVL(N4P , .01) FROM TS_PAYRATES WHERE PROJECT_ID = 701 AND ACTIVE = 1 AND JOB_TYPE = 'LHD' AND PILE_ID = '15' -
After Trigger Select into issue
CREATE OR REPLACE TRIGGER "TAB2_AI"
AFTER INSERT ON Table2
FOR EACH ROW
DECLARE
t1ID number;
t3Seq number;
BEGIN
Select t.id INTO t1ID from Table1 t where trim(upper(name)) = trim(upper(:new.NAME))
SELECT Table3_SEQ.nextval into t3Seq from dual;
Insert into Table3(ID,t1ID,t2ID,Active,CreatedDate) Values
(t3Seq,t1ID,:new.ID,1,sysdate)
EXCEPTION
when others then
raise_application_error(-20004,
'Error occured! New Row ID = ' || :new.ID );
END TAB2_AI;
I am writing after Insert Trigger. I have 3 tables. I need to write after Insert on Table2.
But in my Table 3 i want to insert table1 ID and table2 ID and other info.
Now getting the table1 ID is giving the problem. Please See below statement. This is causing the problem.
Select t.id INTO t1ID from Table1 t where and trim(upper(Dname)) = trim(upper(:new.NAME))
Could you please tell me the work around how to put select into in a trigger? Any suggestions highly appreciated.
Edited by: Chris90909 on Jan 29, 2010 9:20 AM
Edited by: Chris90909 on Jan 29, 2010 9:29 AMYou said
Please See below statement. This is causing the problem.
Select t.id INTO t1ID from Table1 t where and trim(upper(Dname)) = trim(upper(:new.NAME))But in your code you are using following query
Select t.id INTO t1ID from Table1 t where trim(upper(name)) = trim(upper(:new.NAME))These are 2 different queries. In first one , in where clause you are using column name as Dname and the query you are using in your trigger has column name as name in where clause. -
Hello abap-gurus,
I have a small problem when doing a select into an internal table. As i select and append into an internal table, the program dumps as there is not enough memory for the internal table. The SAP-table i'm selecting from is simply too big. So I'm wondering if there is a way to stop or set the max lines in the internal table to say 10000 rows? I would appreciate any example.. the statement looks like this:
SELECT * INTO l_bdcpv
FROM bdcpv
WHERE not process = 'X'
AND mestype = 'ISM_MATMAS'.
APPEND l_bdcpv TO i_bdcpv.
ENDSELECT.
Best regards BalloHI,
DATA: I_BDPCV LIKE BDPCV OCCURS 0 WITH HEADER LINE.
SELECT * FROM BDPCV INTO I_BDPCV UP TO 100 ROWS WHERE PROCESS NE 'X' AND MESTYPE = 'ISM_MATMAS'.
APPEND I_BDPCV.
ENDSELECT.
Regards
CNU -
Using SELECT INTO statement to transfer data from one DB to another?
Hello,
I need to move data from an SAP table to another downstream SQL server box without flat file in between. I have set up the DBCON interface, so that my ABAP code on SAP can connect to the remote SQL Server, then I can run INSERT command as Native SQL inside the ABAP.
However, INSERT has performance problem. The best performer as I can find is SELECT INTO statement. But then I am stuck at how to use SELECT INTO to query my local SAP table and send (via INTO) to remote database. I am not even sure whether I should use Open SQL or Native SQL.
Any suggestion? BTW, I understand the limitation of Native SQL, but we are OK to use it.
Thanks!It appears that this is some kind of migration project due to the scope of the data contained in the single file? If so whatever you do is like ly to be trow away once the migration of data is completed.
You have a couple of options:
1) Get the data extracted from HFM in multiple files instead of one bulk file, broken down by scanario,year & period
2) Take the single data dump file produced by FDM and manipulate it yourself to get the data in a more usuable format for processing through FDM.
Option 2 could be achieved via any ETL tool or a custom file parsing script. What may be more attractive to you and allow you to fully leverage your investment in FDM is that you could use the PULL adapter that ships as part of the FDM adapter suite to perform this transformation exercise. The PULL adapter takes a flat file input and allows you to use all the in built functionality of FDM to transform it and output a modified flat file (or series of flat files). You could use it to produce multioload files or a series of files broken down by scenario,year,period.
Whatever you do I would suggest that break the single data file down into smaller chunks as this will help with the iterative debugging process you will inevitably have to undetake whislt migrating the data to the new application. -
Select Into code not working in Trigger
Hello there,
I was hoping somebody could give me the solution to this problem ,
I have a scenarior in which I was trying to insert into table B if an insert occurs on Table A by the use of a trigger on table A .
Here is the code:
BEGIN
IF INSERTING THEN
select MAX(Val1),MAX(Val2)
INTO localVar_1 ,localVar_2
from tableC,tableD
where <<some join condition>>
INSERT INTO TABLEB(col1 ,
col2,
col3,
col4,
col5,
col6,
col7,
col8,
col9)
VALUES(:new.someValue1,
:new.someValue2,
:new.someValue3,
localVar_1,
localVar_2,
:new.someValue4,
:new.someValue5,
:new.someValue6,
:new.someValue7);
END IF;
The Error I get is ORA-01400 "Cannot Insert Null Into" "Schema"."Table"."Column" . I suspect my localVar_1 to be nulled out ,which brings into question the SELECT INTO prior to this which is supposed to assign a value to these variables , If I do just a SELECT that seems to work but SELECT INTO seems to be having problems . Any suggestions?Check the NOT NULL constraint in TABLEB, and if you find any columns having it, try to insert a fixed value and see it it works.
thanks -
Select into aggregate function
Hi,
I have the following PL/SQL block that I am testing. The block reads a list of values from a local file and inserts the values into a select statement that uses an aggregate function. Here is my code:
DECLARE
f utl_file.file_type;
n COLa%TYPE; --holds values from the file
v COLb%TYPE; --holds value returned by select statement
BEGIN
f := utl_file.fopen(dir,file.txt,'R');
loop -- loop through file
utl_file.get_line(f,n);
if length(n) <> 0 then
SELECT max(A0.COLa) into v
FROM (SELECT AOB.COLa, A0.COLb
FROM TAB1 A0,TAB2 A0B
WHERE (A0.PK=A0B.PK) and A0B.COLa = n) A0;
IF SQL%rowcount = 0 THEN
dbms_output.put_line('no rows);
else
dbms_output.put_line(v);
end if;
end if;
end loop;
utl_file.fclose(f);
end;
Here is the error I get:
declare
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "SYS.UTL_FILE", line 98
ORA-06512: at "SYS.UTL_FILE", line 656
ORA-06512: at line 12
I checked the database for the first couple of values in the list and got rows. I also ran a simple PL/sql code to print values in the file successfully. So I dont know why it is returning no data found. From what I understand select into statement using aggregate functions will never raise this exception, so why I am getting this error?
Thanks.Hi,
Actually, the SELECT ... INTO isn't the problem here.
Look at the error message:
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at "SYS.UTL_FILE", line 98
ORA-06512: at "SYS.UTL_FILE", line 656
ORA-06512: at line 12The error is ocurring inside utl_file, which is being called at line 12 of your code. (That must be
utl_file.get_line(f,n);)
Utl_file.get_line raises NO_DATA_FOUND when it reaches the end of the file. (If it didn't you'd have an infinite loop, since your code doesn't have any exit strategy.)
You can put the call to get_line in its won BEGIN-EXCEPTION-END block, and trap the NO_DATA_FOUND error.
For example:
end_of_file := 0;
WHILE end_of_file = 0;
loop -- loop through file
BEGIN
utl_file.get_line(f,n);
if length(n) != 0 then -- Use !=, because you can't post <> on this site
SELECT max(A0B.COLa) -- No sub-query needed
into v
FROM TAB1 A0
, TAB2 A0B
WHERE (A0.PK = A0B.PK)
and A0B.COLa = n;
IF SQL%rowcount = 0 THEN -- Not needed: SELECT MAX ... without GROUP BY always returns 1 row
dbms_output.put_line('no rows);
else
dbms_output.put_line(v);
end if;
end if;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
end_of_file = 1;
END;
end loop;Edited by: Frank Kulash on Jul 17, 2009 2:51 PM -
Select by Location. Select Into.. No column was specified
Hello.. I am starting out as a new user with Sql Server Express 2012.
I'm using the information in the AdventureWorks2012 database and
http://msdn.microsoft.com/en-us/library/ff929109.aspx
I can run a select by location from the Person.Address table as illustrated in the documentation. I want to be able to run a 'SELECT INTO' and I'm stumped on the syntax.
-- selecting around a point the 7 most closest around a defined point.
USE AdventureWorks2012
GO
DECLARE @g geography = 'POINT(-121.626 47.8315)';SELECT
TOP(7) SpatialLocation.ToString(), City
INTO Person.AddressTest2
FROM Person.Address
ORDER BY SpatialLocation.STDistance(@g)
Problem is in the incorporation of the 'INTO Person.AddressTest2. I get the 'No column was specified for column1' ERROR. How do I give a default name to the (No column name)?Welll... Dog gone it..
Answer is this.. putting the 'location' as the alias into the statement did it.
I knew that asking would make it work.
Andy
-- selecting around a point the 7 most closest around a defined point.
USE AdventureWorks2012
GO
DECLARE @g geography = 'POINT(-121.626 47.8315)';
SELECT
TOP(7) SpatialLocation.ToString() location, City
INTO Person.AddressTest2
FROM Person.Address
ORDER BY SpatialLocation.STDistance(@g) -
Hello
I have entered the following statement into the SQL Command Processor in HTML Db:
select * into DEMO_CUSTOMERS_COPY from DEMO_CUSTOMERS
I get the following error:
ORA-00905: missing keyword
Can anyone tell me why I'm getting this error? I think the syntax of the statement looks ok to me but I may be wrong
Thanks,
SimonHi Simon,
No problem...glad to help.
Your original command (with a little modification) is the sort of thing you usually see in PL/SQL where you want to extract a column (or record) from a table, for example
SQL> set serveroutput on;
SQL> declare
v_value dual.dummy%TYPE;
begin
select
dummy
into
v_value
from dual;
dbms_output.put_line('The value is: ' || v_value);
end;
The value is: XNote that "select..into" requires only one row to be returned, so if multiple rows are returned then you'll get a TOO_MANY_ROWS exception.
Hope this helps. -
Using select * into within a function
What I'm wanting to do is to have a select query with many select fields and automatically create a new table (with the same schema) and insert the select result set in this new table.
I can't seem to figure it out and doing the EXECUTE 'select * into dest_table from orig_table'; wouldn't work (not implemented yet).
One reason I would like to do it this way is because the field attributes of orig_table may be different from one client to another.
Thanks for any advice.Thanks very much.
When I tried the execute immediate '...'; in the function I got an error stating: 'type "immediate" does not exist
I tried to do some research on 'execute immediate' to see what might be the problem but couldn't find anything substantial to my cause.
I just installed postgreSQL 8.2 this afternoon, and took all the installation defaults, so it may be something I need to configure.
Anways, however, I just took the actual sql from the execute immediate call and that worked for me.
Are there any pitfalls to doing it that way.
Again, thanks for your quick and helpful reply. -
Hello,Can I show the result of a SELECT .. FROM.. WHERE.. into a procedure?
For example:
CREATE OR REPLACE PROCEDURE nuova_ricerca (p_Stringa VARCHAR2)
AS
BEGIN
SELECT *
FROM ArchivioSoluzioni
WHERE Problema LIKE ConvertiPerLike(p_Stringa);
END;
why I can use
SELECT * INTO DUMMYArchivioSoluzione.Camp1, DUMMYArchivioSoluzione.Camp2..
If the result of my SELECT is constructed by 2 rows?
p.s
ConvertiPerLike is a simple function.
excuse for my bad englishDo not copy the record Operatore in emprec...Why?Because
SELECT * INTO emprec
FROM Operatore;
potentially returns MANY records (see my above post). If you want
to get the result you have to restrict the selection with WHERE caluse
which gaurantees you select ONE row, NOT MANY.
If you want to select many rows you have to think of the collection
and BULK COLLECT INTO statement:
SQL> create or replace procedure foo
2 is
3 type t1 is table of emp%rowtype index by pls_integer;
4 t t1;
5 begin
6 select * bulk collect into t from emp;
7 end;
8 /
Procedure created.
SQL> exec foo;
PL/SQL procedure successfully completed.or to think of the cursor using as it was pointed out above:
SQL>/* Just for illustration */
SQL> create or replace procedure foo
2 is
3 erc emp%rowtype;
4 begin
5 for v in (select * from emp) loop
6 erc := v;
7 end loop;
8 end;
9 /
Procedure created.
SQL> exec foo;
PL/SQL procedure successfully completed.Rgds.
Maybe you are looking for
-
ITunes insists on rearranging my iPad apps, even with 'Sync apps' unchecked
Here's an issue which I've noticed crop up on a few other forums, but which there doesn't seem to be a definitive answer for. I'm hoping that one of the veterens on this forum might have come across it and figured out a fix... Since iCloud launched,
-
I am getting unknown error -20 when trying to update or backup ipod touch
please help
-
What is the best way to install a SSD?
I'm sure this is answered somewhere but I'd like a confirmation as of Mavericks. I have a Samsung 840 Pro 256GB SSD I'd like to install in my Late 2011 Macbook Pro. I also have the HD Caddy to install my existing 750GB into the Superdrive bay. I r
-
Adobe Premiere Pro CS5 Dynamic Link not working as part of Production Premium CS5
I ran into a situation whereby I recently reinstalled my Production Premium CS 5 onto a new computer and when trying to run the Dynamic Link out of Premiere PRO CS 5 to create a new After Effects composition, After Effects tried to start up but then
-
Where is the best place to buy second hand iPhones?
Someone said that Melbourne had the longest turnaround times for Apple service work. Let me tell you the guys at the St Kilda Apple Service Centre turned my job around in 2 days... but my question is where is the best place to buy second hand iPhones