Select into statement returns 0 or 1
Hello, when i run the select statement below ,the result in count field is 0 when the record is not exist and 1 when the record is exist
but the real value doesn't appear in the field , what the problem exactly .........i want to show the real value in the field.
when_button_pressed
BEGIN
SELECT count into :add.count FROM storge
where barcode=:add.barcode;
END;
M3ATH wrote:
SELECT count into :add.count FROM storge
where barcode=:add.barcode;
END;Try this...
BEGIN
SELECT count(barcode) into :add.count FROM storge
where barcode=:add.barcode;
END;Hope this helps
If someone's response is helpful or correct, please mark it accordingly.
Similar Messages
-
Where clause in SELECT INTO statement
Hi,
I am using multiple conditions in where clause for my SELECT INTO statement as follows.
SELECT count(DTLA.LOCATION_ID)
INTO LOCATION_ID_count
FROM DOC2_MGR.DOC_TYPE_LOB_ASSOC DTLA
WHERE (DTLA.DOC_TYPE_ID = 'XYZ' AND DTLA.lob_code = 'ABC');
It considers only first condition and returns the result i.e. DTLA.DOC_TYPE_ID = 'XYZ' only.
Does select into statement suppose to consider only one condition in where clause???
Thanks in advance!
--SandeepI got it resolved. Here is list of things I noted
1. I was using variable names same as column names. It was mixing up temp variable names with column name on the table, which doesn't make sense as I was referring column names in table.column format
2. I had mixed few datatypes. Input param was suppose to be number where as I was passing it as Text
Thanks anyway!
--Sandeep -
Can i include variable in select into statement?
Hi all,
Is it possible to include a variable name in the "select into" statement ? For ex:
"Select empname into variable_Name from employee" In this case variable_Name is the variable.Will this statement work by assigning empname to variable_Name if there is only one record in the employee table?please reply....c ya.Surely you have to? You can hardly SELECT INTO a constant. Perhaps I'm missing something,
-
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. -
How to modify a Procedure "select into" statement to use a cursor
The below code fails with exception too many rows. How do I modify the Procedure's Select Into statement to use a cursor?
CREATE OR REPLACE PROCEDURE Track_Asset(
business_date IN NUMBER DEFAULT NULL,
missing_table_name OUT VARCHAR2)
IS
ln_business_date NUMBER;
incorrectdateformat EXCEPTION;
BEGIN
IF business_date < 0
THEN
RAISE incorrectdateformat;
ELSE
DECLARE
ln_business_date NUMBER;
BEGIN
SELECT MAX(business_date)
INTO ln_business_date
FROM sproof ;
EXCEPTION
WHEN NO_DATA_FOUND THEN
dbms_output.put_line('NO MATCH FOUND');
WHEN OTHERS THEN
dbms_output.put_line('ORACLE ERROR :' || SQLERRM);
END;
DECLARE
missedfeedfnd EXCEPTION;
BEGIN
SELECT 'Missing Value : ' || table_name
INTO missing_table_name
FROM (
SELECT UPPER(table_name) table_name
FROM filespec
WHERE data_table_name IN ('TABLE1','TABLE2','TABLE3')
MINUS (
SELECT DISTINCT UPPER(first_table_name)
FROM dpca
WHERE business_date = ln_business_date
AND first_table_name IN ('TABLE1','TABLE2','TABLE3')
GROUP BY UPPER(first_table_name) UNION
SELECT UPPER(first_table_name)
FROM dpca
WHERE business_dt_num = TO_NUMBER( SUBSTR('201111', 1, 6) || '01' )
AND first_table_name = 'TABLE4'
GROUP BY UPPER(first_table_name) ));
IF missing_table_name IS NOT NULL THEN
dbms_output.put_line('Missing Value : '|| missing_table_name);
RAISE missedfeedfnd;
ELSE
NULL;
END IF;
EXCEPTION
WHEN TOO_MANY_ROWS THEN
DBMS_OUTPUT.PUT_LINE (' SELECT INTO statement retrieved multiple rows');
WHEN missedfeedfnd THEN
raise_application_error ( - 20003, 'Missed Feed');
END;
END IF;
EXCEPTION
WHEN incorrectdatevalue
THEN
raise_application_error ( - 20001, 'Incorrect/Bad Date Entered');
END;ok try this - OUT param will be populated with comma separated list of table names:
PROCEDURE Track_Asset(
business_date IN NUMBER DEFAULT NULL,
missing_table_name OUT VARCHAR2)
cursor c_table_names is
select datatablename
from ( select upper(datatablename) datatablename
from filespec
where data_table_name in ('TABLE1','TABLE2','TABLE3' )
MINUS
( select upper(first_table_name)
from dpca
where business_dt_num = [-- this date is retrieved by getting the MAX(business_date) from sproof table]
and fus_data_table_name in ('TABLE1','TABLE2','TABLE3'
group by
upper(first_table_name)
UNION
select upper(first_table_name)
from dpca
where business_dt_num = to_number( substr('201111',1,6) || '01' )
and first_table_name = 'TABLE4'
group by
upper(first_table_name)
begin
for rec in c_table_names
loop
missing_table_name := missing_table_name || rec.datatablename ||',';
end loop;
missing_table_name := rtim(missing_table_name , ',');
end ;HTH
Edited by: user130038 on Dec 28, 2011 8:46 AM -
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. -
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 :) -
Question on select into statement
hi,
all oracle gurus,
my requirement is as follows
i have a select statement that should be executed dynamically.
The records fetched by the select statement should be stored in a pl/sql table.
my select statement is like this.
Execute immediate'
select null,rh.rec_no,p.lot,pr.each_qty,sl.color_zone,:p_comp_id,pr.unit_cube*(nvl(p.qty,0)/nvl(pr.each_qty,1)),
sysdate,pr1.each_qty,p.prod_no,:p_ebiz_user_no,nvl(sl.wdth,0) * nvl(sl.dpth,0),decode(s.haz_mat_class,null,''N'',''Y''),
sl.home_zone,''N'',r.line_no,p.end_loc, p.lp, nvl(p.access_aisle,''N''),round(nvl(p.qty,0)/nvl(pr.each_qty,1)),
1, p.pkg_no, r.p_line_no, rh.po_no,r.putaway_strategy,p.qty,rh.rec_type,:p_site_id,s.sku, s.sku_desc1_35,
s.prod_fam,s.prod_cat,p.prod_stat,2,sysdate, ''Handling'', bt.task_type,nvl(sl.type_stor_equip,''100''),
p.uom,pr.unit_wght*(nvl(p.qty,0)/nvl(pr.each_qty,1)),:p_ebiz_appown_no
from [email protected] s,mast_abbtype bt,mast_company bc,[email protected] pr,[email protected] sl,
[email protected] r,[email protected] rh,[email protected] p,[email protected] pr1
where p.end_time is not null
and decode(bt.comp_id,null,:p_comp_id,bt.comp_id)= :p_comp_id
and decode(bt.site_id,null,:p_site_id,bt.site_id)=:p_site_id
and bt.task_type = :p_task_type
and bc.comp_id = :p_comp_id
and p.proc_cntrl_no =r.rec_cntrl_no
and bc.ebiz_appown_no=61
and bt.delete_flag=''N''
and r.rec_cntrl_no = rh.rec_cntrl_no
and p.proc_cntrl_no = nvl(:p_po_no,p.proc_cntrl_no)
and p.prod_no = nvl(:p_ebiz_sku_no, p.prod_no)
and nvl(p.prod_stat, ''~'') =nvl(:p_sku_status, nvl(p.prod_stat, ''~''))
and p.lp = nvl(:p_lp, p.lp)
and nvl(p.lot, ''~'') = nvl(:p_batch_no, nvl(p.lot, ''~''))
and r.lp = p.lp
and p.prod_no = s.prod_no
and p.prod_no = pr.prod_no
and p.pkg_no = pr.pkg_no
and pr.logical_case_flg = ''Y''
and p.end_loc = sl.loc
and nvl(p.sku_key3,''A'') != ''1''
and decode(''COMP'',''BYID'',s.buyer_id,s.comp_code) = bc.comp_id
and bc.comp_id =:p_comp_id
and r.cart_lp is null
and trunc(p.date_time_created) between trunc(nvl(SYSDATE-10000,p.date_time_created))
and trunc(nvl(SYSDATE,p.date_time_created))
and trunc(p.date_time_created) >= trunc(bc.effective_date)
and pr.prod_no = pr1.prod_no and pr.pkg_no = pr1.pkg_no and pr1.logical_plt_flg = ''Y'' '
using p_comp_id,p_ebiz_user_no,p_site_id,p_ebiz_appown_no,p_comp_id,p_comp_id,p_site_id,p_site_id,p_task_type,p_comp_id,
p_po_no,p_ebiz_sku_no,p_sku_status,p_lp,p_batch_no,p_comp_id;'
what i want is the records selected by the select statement should be stored in a pl/sql table.
pls treat this as urgent.
ur valuable suggestions are always most welcome.
regards
RRHi,
Here's an exmaple that will help you do it :-
DROP TABLE TABLE1;
CREATE TABLE TABLE1( SYMBOL VARCHAR2(2) PRIMARY KEY, NAME VARCHAR2(10), QUANTITY NUMBER, PRICE NUMBER, DATE_ DATE);
INSERT INTO TABLE1(SYMBOL,NAME,QUANTITY,PRICE,DATE_) VALUES('10','Apples',100,10,SYSDATE);
INSERT INTO TABLE1(SYMBOL,NAME,QUANTITY,PRICE,DATE_) VALUES('20','Oranges',100,10,SYSDATE);
INSERT INTO TABLE1(SYMBOL,NAME,QUANTITY,PRICE,DATE_) VALUES('30','Mangoes',100,10,SYSDATE);
COMMIT;
DECLARE
RC1 SYS_REFCURSOR;
ln_NAME TABLE1.NAME%TYPE;
BEGIN
OPEN RC1 FOR 'SELECT NAME FROM TABLE1';
FETCH RC1 INTO ln_NAME;
WHILE( RC1%FOUND )
LOOP
DBMS_OUTPUT.PUT_LINE(ln_NAME);
FETCH RC1 INTO ln_NAME;
END LOOP;
CLOSE RC1;
END;
Apples
Oranges
MangoesRegards,
Sandeep -
"select into" query statements using the DI API
I am trying to use the DI API (6.5) t create a temp table based on an existing table. For example, here is a query string....
select * into ORDR_TEMP from ORDR
Code...
oRecordSet := IRecordset(oCompany.GetBusinessObject(BoRecordset));
oRecordset.DoQuery(sSql);
Error I get...
1). [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot use SELECT INTO in browse mode. 2). [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared
For any other regular select statements the previous code works. Does anyone know for sure if a "select into" statement is not possible using the DI API?Hi Bill,
I´m not really sure if select into is avaiable. But here you´ve got a hint: You could use a user defined function to do it, and just call the function from your code.
SELECT dbo.MyFunction()
Having this function defined in your SQL Server:
CREATE function MyFunction ()
returns char(2)
AS
Begin
select * into ORDR_TEMP from ORDR
Return ('OK')
End
Hope this helps,
Ibai Peñ -
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 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 -
A severe error occurred on the current command - select into
Hi
I am making a backup of a table before working on the original, but when I try a simple select into statement I receive 'Msg 0, Level 11, State 0, Line 0 - A Severe error occurred on the current command. The results, if any, should be discarded.'
I am able to run a select query on the original table with the same where clause I am using in the select into statement and it runs without error.
Does anyone know why this is happening?
Server 2008 64bit, SQL Server 2008r2
Thank you for any helpThis is a generic message that informs you that something went very wrong, either in SQL Server itself or in the client API.
If open a command promptt and try the same command running from SQLCMD or OSQL, what happens? If things seems to work well, run a simple second command like "SELECT 1" to make sure that this works. (The use a different API from SSMS, why it is
worth testing.)
Also look in the SQL Server error log. If you see a stack dump which appeared at the same time as you ran the SELECT INTO statement, then it's clear that the accident was in SQL Server.
I would recommend that you run DBCC CHECKDB on the database, as the root cause could be corruption.
Erland Sommarskog, SQL Server MVP, [email protected] -
Select * into Table1 from Table not working
Hi,
How to copy data from one table to other new table using select * into statement.
I am getting missing keyword error when I use the statement
select * into Table1 from Table
Thanks a lot in advance.
Regards,
Praveenthe syntax is
INSERT INTO table1 SELECT * FROM table2; -
Hi,
I have a button on a form which, when pressed, uses the built-in "GET_FILE_NAME" to locate a comma-delimited flat file. I use TEXT_IO to open the file and process the rows in a FOR LOOP. In the loop, I parse each comma delimited field into it's own variable. One of these fieldsis a week-ending-date, which is converted to a DATE variable. I need to get the year and week # from a support table called "Week" (I could justget the year from the date, but the week number is arbitrary when crossing over years). I have tried using a SELECT..INTO statement and an explicit cursor with the same results - none. The select into I use is:
SELECT year, week
INTO v_year, v_week
FROM schema1.week
WHERE TRUNC(end_date) = TRUNC(v_edate);
--where v_year and v_week are the same %TYPE as their corresponding columns
-- and v_edate is the week-ending-DATE from the flat file
When I do this from SQL*PLUS, it comes out fine, but no data is found when run in the form. I don't get it... if there is nothing wrong with the syntax, shouldn't this work in both places? Or is there some limitation on using cursors while processing a TEXT_IO file? If anyone knows the why of this or can think of a workaround, please let me know.
Oracle Version: 8.1.7.0.0
Server: IRIX - Unix
Forms Version: 6.0.5.35.3
Client: Win 98
Thanks much,
JasonDECLARE
v_filename VARCHAR2(100);
temp_file TEXT_IO.File_Type;
linebuff VARCHAR2(1800);
v_edate DATE;
v_year schema1.week.year%TYPE;
v_week schema1.week.week%TYPE);
str_start NUMBER;
str_end NUMBER;
CURSOR week_cur (p_edate IN DATE) IS
SELECT year, week
FROM schema1.week
WHERE TRUNC(end_date) = TRUNC(p_edate);
BEGIN
v_filename := GET_FILE_NAME ('c:\files\');
temp_file := TEXT_IO.Fopen (v_filename, 'R');
FOR i IN 1..3 LOOP
TEXT_IO.Get_Line (temp_file, linebuff);
IF i > 1 THEN
GO_BLOCK ('DATA_DUMP');
NEXT_RECORD;
END IF;
str_end := INSTR(linebuff, ',') - 1;
:DATA_DUMP.stnum := SUBSTR (linebuff, 1, str_end);
str_start := str_end +2;
str_end := INSTR(linebuff, ',', 1, 2);
:DATA_DUMP.dnum := SUBSTR (linebuff, str_start, str_end - str_start);
str_start := str_end +1;
str_end := INSTR(linebuff, ',', 1, 3);
:DATA_DUMP.spp := SUBSTR (linebuff, str_start, str_end - str_start);
str_start := str_end +1;
str_end := INSTR(linebuff, ',', 1, 4);
v_edate := TO_DATE (SUBSTR(linebuff, str_start, str_end - str_start), 'MM/DD/YYYY');
str_start := str_end +1;
str_end := INSTR(linebuff, ',', 1, 5);
:DATA_DUMP.lbs_land := SUBSTR (linebuff, str_start, str_end - str_start);
str_start := str_end +1;
str_end := LENGTH(linebuff);
:DATA_DUMP.date_in := TO_DATE (SUBSTR(linebuff, str_start, str_end - str_start), 'MM/DD/YY HH:MI');
OPEN week_cur (v_edate);
FETCH week_cur INTO v_year, v_week;
CLOSE week_cur;
:DATA_DUMP.year := v_year;
:DATA_DUMP.week := v_week;
END LOOP;
END; -
SELECT-INTO prepared statement?
Hi,
I have a single-row select to execute. I don't know if the multi-row select functionality (ResultSets, etc.) should be used for a single-select.
Here's from the Oracle JDBC Documentation on a prepared statement with input variables:
PreparedStatement pstmt =
conn.prepareStatement ("insert into EMP (EMPNO, ENAME) values (?, ?)");
pstmt.setInt (1, 1500); // The first ? is for EMPNO
pstmt.setString (2, "LESLIE"); // The second ? is for ENAME
pstmt.execute ();
What I would like to do is have a PreparedStatement for output variables in a SELECT-INTO:
pstmt= conn.prepareStatement("select max(sal) into ? from emp;");
but there appears to be no bind variable functionality.
Callable statements apparently are only for stored procedures.
Basically, should I just use the multirow select for this?
Thanks,
Glenpstmt= conn.prepareStatement("select max(sal) into ?
from emp;");
but there appears to be no bind variable
functionality.You might be able to bind this as an output parameter, but it seems like extra work (just getting a ResultSet for "select max(sal) from emp" would be a lot more straight forward).
>
Callable statements apparently are only for stored
procedures.Not really, I execute PL/SQL blocks using prepared statements all the time. Sometimes it's the only way to get the data into a format that JDBC can handle.
Here's an example:
/** This is the SQL used to call the API ... */
public static final String spSQL =
"declare " +
"t_warranty_tbl apps.cib_devo_wrapper.wartbltyp; " +
"x_warranty_tbl apps.cib_devo_wartbltyp; " +
"x_return_text VARCHAR2(2000); " +
"begin " +
"apps.cib_devo_wrapper.cib_get_warranty_info(" +
"P_SERIAL_NUMBER => ?,"
"X_WARRANTY_TBL => t_warranty_tbl," +
"X_RETURN_TEXT => x_return_text," +
"x_row_count => ?); " +
// Convert to a table of objects ...
"x_warranty_tbl := apps.cib_devo_wrapper.cib_warranty_casttowartbltyp(t_warranty_tbl); " +
// Get the cursor with order by ...
"OPEN ? FOR SELECT * FROM TABLE(CAST(x_warranty_tbl AS apps.CIB_DEVO_WarTblTyp)) tbl " +
"WHERE tbl.entitlementReturnCode != apps.cib_devo_wrapper.g_ent_ret_code_08 " +
"ORDER BY tbl.INSTALLEDAT_CUSTOMER_NAME, tbl.SITE_NAME, tbl.SITE_ID, " +
"tbl.PRODUCT_FAMILY, tbl.PRODUCT_NAME, tbl.SERIAL_NUMBER; " +
"?:=x_return_text; " +
"end;";In this example, I declare a few variables, call a stored procedure,
do some more PL/SQL to reduce the results before I finally bring them back.
The first placeholder (question mark) is the input serial number, the second one is an output parameter that gives the row count. The third
question mark is the cursor that contains the data I need, and the fourth is a reference to a status message.
As you can see, the PL/SQL isn't exclusively stored procedure calls.
>
Basically, should I just use the multirow select for
this?I think you'd need code that looks something like:
DECLARE
myCount NUMBER;
BEGIN
select max(sal) into myCount
from emp;
? := myCount
END;Although wrapping the select in a BEGIN..END block may be enough.
Maybe you are looking for
-
How can I use custom colors and not presets when using Smart Brush Tool Color?
I don't see a way to use the color picker tool or change the color to custom colors. Please help.
-
Can nested IIf be created in custom workflow (in Designer)?
I need to explore building a custom workflow in Designer that will allow me to update a hidden field in the list. Is it possible for me to recreate the nested IIf statement I have written below? I'm not seeing how to do get an AND operator in the w
-
I get error 5002 when trying to redeem gift cards , what do I need to do to fix this.
I get error 5002 when trying to redeem gift cards, what can I do to fix this?
-
Help Installing Raw 6.2 plug in photoshop elements 8
Hi All trying to update raw plug 6.2 in elememts 8 . My OP system is 64 bit Window 7 I have followed adobe instrtuctions and manged to not get very far. Problems:- I have installed on c:\prgrom files\common files\adobe\plug-ins\elements 8\file format
-
PROBLEMS!!!-- COMP NOT BOUND
Hi All... Im am fairly new to EJB's... Im having problems trying to run my program... Im using JBOSS builder to run my programs. The following is the error report. meridian.lib.exception.SystemException: comp not bound at meridian.lib.delegate.Delega