Using select inside in ()
Hi
I am trying to write an sql as below...
select row1, row2,row3 from table1 where row4 in (select row5,row6 from table2 where row7='string');
I know the above syntax is wrong. what i need is, i have to pass two values selected from another table as arguments in, 'in'
please suggest proper syntax to achieve this result.
Thanks,
Aditya
Hi,
872635 wrote:
Though your logic is correct. its not helping me.
This is going for full scan and taking 15mins to give result... normally it will take less than a secSo you already have some way of doing this that takes less than a second? Why not use that way?
If you're using Oracle 11, you can try UNPIVOT in an IN sub-query, liek this:
SELECT col1, col2, col3
FROM table1 t1
WHERE col4 IN (
SELECT col_5_or_6
FROM table2
UNPIVOT ( col_5_or_6
FOR label IN ( col5
, col6
WHERE col7 = 'string'
;
Similar Messages
-
How to use Select in nested Else if statement.
Hi ,
I am validating a file . for that I placed conditions through Nested ELSEIF statment.
Some fields in the file need to validate against a table.
Can some one help me how to organise my below code so that I can validate the file using all my conditions.
CALL FUNCTION 'RH_EXIST_OBJECT'
EXPORTING
plvar = '01'
otype = wa_1000-otype
objid = wa_1000-objid
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
wa_error-reason = 'Object does not exist '.
APPEND wa_error TO it_error.
APPEND wa_file TO it_1000.
ELSEIF wa_file-endda IS INITIAL.
wa_error-reason = 'End date missing'.
APPEND wa_error TO it_error.
ELSEIF wa_file-infty IS INITIAL.
wa_error-reason = 'Infotype Missing'.
APPEND wa_error TO it_error.
ELSEIF wa_file-begda IS INITIAL.
wa_error-reason = 'Begin date missing'.
APPEND wa_error TO it_error.
ELSEIF ( wa_file-sclas IS NOT INITIAL
OR wa_file-sobid IS NOT INITIAL )
AND wa_file-infty <> const_infty_1001. " Cosk Centre
wa_error-reason = 'Enter a valid infotype'.
APPEND wa_error TO it_error.
ELSEIF ( wa_file-persg IS NOT INITIAL
OR wa_file-persk IS NOT INITIAL )
AND wa_file-infty <> const_infty_1013. " Employee Group
wa_error-reason = 'Enter a valid infotype'.
APPEND wa_error TO it_error.
SELECT SINGLE * FROM t501 INTO wa_501 WHERE persg = wa_file-persg.
IF sy-subrc NE 0.
wa_error-reason = 'Invalid Employee Group'.
APPEND wa_error TO it_error.
ADD 1 TO gv_error.
gv_error_flag = 'X'.
ENDIF.
SELECT SINGLE * FROM t503 WHERE persk = wa_file-persk.
IF sy-subrc NE 0.
wa_error-reason = 'Invalid Employee SubGroup'.
APPEND wa_error TO it_error.
ENDIF.
ELSEIF ( wa_file-bukrs IS NOT INITIAL
OR wa_file-persa IS NOT INITIAL
OR wa_file-btrtl IS NOT INITIAL )
AND wa_file-infty <> const_infty_1008. " Company Code
wa_error-reason = 'Enter a valid infotype'.
APPEND wa_error TO it_error.
SELECT SINGLE * FROM t500p WHERE persa = wa_file-persa.
IF sy-subrc NE 0.
wa_error-reason = 'Invalid Personnel Area'.
APPEND wa_error TO it_error.
ENDIF.
ELSEIF wa_file-build IS NOT INITIAL
AND wa_file-infty <> const_infty_1028. " Building
wa_error-reason = 'Enter a valid infotype'.
APPEND wa_error TO it_error.
ELSEIF ( wa_file-trfar IS NOT INITIAL
OR wa_file-trfgb IS NOT INITIAL
OR wa_file-trfg1 IS NOT INITIAL
OR wa_file-trfs1 IS NOT INITIAL
OR wa_file-indda IS NOT INITIAL
OR wa_file-trfkz IS NOT INITIAL
OR wa_file-molga_pg IS NOT INITIAL )
AND wa_file-infty <> const_infty_1005. " Pay Scale
Endif.hi,
here is what you need.
LOOP AT itab INTO wa_itab.
SELECT maktx
APPENDING CORRESPONDING FIELDS OF TABLE it_makt
FROM makt
WHERE matnr eq wa_itab-matnr
ENDLOOP.
note: performance-wise, it is better to use FOR ALL ENTRIES that SELECT inside a LOOP.
here is a sample code
SELECT maktx
INTO CORRESPONDING FIELDS OF TABLE it_makt
FROM makt
FOR ALL ENTRIES IN itab
WHERE matnr EQ itab-matnr.
regards,
Peter -
Using Select statement in IF condition?
hi all,
Can i use select statement in IF COndition in pl sql ?
eg like- if( select 1 from ASD) then
end if;There is no way to do any kind of select statement inside if conditions.
Why don't test simple cases like this first?
An example to show it.
SQL> begin
2 if exists (select 1 from dual) then
3 dbms_output.put_line('ok');
4 end if;
5 end;
6 /
if exists (select 1 from dual) then
ERRORE alla riga 2:
ORA-06550: line 2, column 5:
PLS-00204: function or pseudo-column 'EXISTS' may be used inside a SQL
statement only
ORA-06550: line 2, column 2:
PL/SQL: Statement ignored
SQL> begin
2 if ( (select count(*) from dual) > 0 ) then
3 dbms_output.put_line('ok');
4 end if;
5 end;
6 /
if ( (select count(*) from dual) > 0 ) then
ERRORE alla riga 2:
ORA-06550: line 2, column 8:
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
( - + case mod new not null others <an identifier>
<a double-quoted delimited-identifier> <a bind variable> avg
count current exists max min prior sql stddev sum variance
execute forall merge time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string literal with character set specification>
<an alternativ
ORA-06550: line 2, column 33:
PLS-00103: Encountered the symbol ")" when expecting one of the following:
. , @ ; for <an identifier>
<a double-quoted delimited-identifier> group having intersect
minus order partition start subpartition union where connect
SQL> begin
2 if ( 0 in (select count(*) from dual) ) then
3 dbms_output.put_line('ok');
4 end if;
5 end;
6 /
if ( 0 in (select count(*) from dual) ) then
ERRORE alla riga 2:
ORA-06550: line 2, column 12:
PLS-00405: subquery not allowed in this context
ORA-06550: line 2, column 2:
PL/SQL: Statement ignoredBye Alessandro -
Error while using selection option variable in the selection screen
Hi All,
I am facing an issue while using selection option variable in the selection screen for one of my reports.
Scenario: For the field "Region From" we need to have wild card logic () in tes selection screen, for example if we put "BE" in the selection screen for the field Region From then the query should be executed only for those "Region From" values which begin from "BE".
Approach: For the above requirement I have made a selection option variable for "Region From". This allows use wild card
But when the report is executed we get the following error:
"System error in program CL_RSR_REQUEST. Invalid filter on ETVRGNFR".
(ETVRGNFR is technical name of the info object Region From)
Though the report is executed it displays all the values for the field "Region From" irrespective of the selection given in the selection screen.
Please give suggestions / alternate solutions to crack this issue.
Thanks in advance
Regards
Priyanka.Hi,
Try to use a variable of type Customer Exit and do the validation inside the exit to display according to your request.
This is just my view, i am not sure if u are already using this or Char. Variable.
Cheers.
Ranga. -
How to avoid data selection inside the loop?
Hello Experts,
I am working on one performance item and I have already applied some changes to the original version.
Now, If I compare my new program with old program, I have good improvement in performance. I am checking if I can do anything on statements that are top on the below list. I think 40% for Modify statement is acceptable after my research (Below run is updating around 20M records which is real time volume for this application).
As we can see 34% of run time to going for one SELECT query on custom table. Take a look at below high level flow of my program to understand above select query.
1. Select data from ZABC
2. Select data from Variant Table (Var1, Var2, Var3 etc.., 12 in real time)
3. Loop Variant Table
4. Select data from X, Y, Z table for Var<n>.
5. Populate final internal table from ZABC, X, Y and Z table
6. Modify ZTABLE with Final Internal table data
7. End Loop on Variant Table
As described in the flow of the program, ZABC table data is common for all the variants and need not to fetch multiple times. Hence I am doing it only once in my program. Below is that select query:
select rrcty ryear rbukrs racct rcntr sum( amt1) as amt1 "Like I have 32 amount fields in original query
from zabc
into table i_zabc
where ryear in r_year " Two records in ranges with I and EQ
and rvers = '001'
and rrcty in r_rrcty "Three records in ranges with I and EQ
and rldnr = 'DT'
group by rrcty ryear rbukrs racct rcntr
order by rrcty ryear rbukrs racct rcntr.
ZABC table is again having huge volume of data and we are fetching millions of records with above query. That is primary reason to take long time. May be that is okay as I am already using Indexes of this table. But, I am not comfortable with it as it can reach max. memory point and through run time error. Fetch Cursor is one reliable option that I can see here, but with that, I should move ZABC selection inside the variant loop which can cause fetching ZABC data 12 times (Let me know If I am missing anything here).
Now, third statement in my trace results, with 10% of overall time is this:
loop at i_abc assigning <fs_abc>.
loop at i_table assigning <fs_table> where low <= <fs_abc>-racct and high >= <fs_abc>-racct.
endloop.
endloop.
6 million executions with this complex WHERE condition is causing this statement to get 3rd position in trace results. I tried below two options which are, I think, taking even more time - (I am still monitoring these options)
1) Removed WHERE condition on LOW, HIGH and applied filter inside the loop.
2) Removed WHERE condition on HIGH only and applied filter inside the loop.
Any suggestions on how to proceed with ZABC selection and I_TABLE loop.
Let me know if you have any questions on above compose.Since I looked at this case before, let me try some quick suggestions:
Is table ZABC related to table X, Y and/or Z and can the selection be limited by applying those 12 selection variants?
If yes, try a join select involving these tables that could make your step 1 obsolete and replace steps 4 and 5.
This might also get rid of the "loop inside loop" problem. Generally, make sure that the inner table is declared as a sorted table with a key that consists of the fields as used in the WHERE-condition of the inner loop. Use secondary keys for internal tables if your ABAP release permits and the task at hand warrants it.
Finally, look at PACKAGE SIZE option for the (join) select to reduce memory consumption.
Thomas -
Number of rows inserted is different in bulk insert using select statement
I am facing a problem in bulk insert using SELECT statement.
My sql statement is like below.
strQuery :='INSERT INTO TAB3
(SELECT t1.c1,t2.c2
FROM TAB1 t1, TAB2 t2
WHERE t1.c1 = t2.c1
AND t1.c3 between 10 and 15 AND)' ....... some other conditions.
EXECUTE IMMEDIATE strQuery ;
These SQL statements are inside a procedure. And this procedure is called from C#.
The number of rows returned by the "SELECT" query is 70.
On the very first time call of this procedure, the number rows inserted using strQuery is *70*.
But in the next time call (in the same transaction) of the procedure, the number rows inserted is only *50*.
And further if we are repeating calling this procedure, it will insert sometimes 70 or 50 etc. It is showing some inconsistency.
On my initial analysis it is found that, the default optimizer is "ALL_ROWS". When i changed the optimizer mode to "rule", this issue is not coming.
Anybody faced these kind of issues?
Can anyone tell what would be the reason of this issue..? any other work around for this...?
I am using Oracle 10g R2 version.
Edited by: user13339527 on Jun 29, 2010 3:55 AM
Edited by: user13339527 on Jun 29, 2010 3:56 AMYou have very likely concurrent transactions on the database:
>
By default, Oracle Database permits concurrently running transactions to modify, add, or delete rows in the same table, and in the same data block. Changes made by one transaction are not seen by another concurrent transaction until the transaction that made the changes commits.
>
If you want to make sure that the same query always retrieves the same rows in a given transaction you need to use transaction isolation level serializable instead of read committed which is the default in Oracle.
Please read http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_sqlproc.htm#ADFNS00204.
You can try to run your test with:
set transaction isolation level serializable;If the problem is not solved, you need to search possible Oracle bugs on My Oracle Support with keywords
like:
wrong results 10.2Edited by: P. Forstmann on 29 juin 2010 13:46 -
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. -
ABAP WD application using Select Options & Adobe form :Don't see form data
Hi,
I am trying to get multiple PDF forms by passing multiple order numbers.I was able to get one PDF form successfully and now I am enhancing this application.
For doing this I have created nested WD Context .
1) Created a Node for Selections. ND_SELECT ,
Cardinality: 1..n ,
Selection: 1..n ,
Intialization lead Selection : Checked ,
Singleton : Checked
2) Created a Node for Output Structures ADOBE_DATA
Properties same as above
3) As we need Nesting Under ADOBE_DATA node I have created a subnode for Header: HEADER
Properties same as above
4) Under HEADER node I have created a items Node : ITEM
Properties same as above
As I have used Select-options and I am getting both header and Item data in to button search method .
DATA lo_nd_adobe_data TYPE REF TO if_wd_context_node.
DATA lo_nd_header TYPE REF TO if_wd_context_node.
DATA lo_el_header TYPE REF TO if_wd_context_element.
DATA ls_header TYPE wd_this->element_header.
* navigate from <CONTEXT> to <ADOBE_DATA> via lead selection
lo_nd_adobe_data = wd_context->get_child_node( name = wd_this->wdctx_adobe_data ).
* navigate from <ADOBE_DATA> to <HEADER> via lead selection
lo_nd_header = lo_nd_adobe_data->get_child_node( name = wd_this->wdctx_header ).
lo_nd_header->bind_table( new_items = it_header set_initial_elements = abap_true ).
DATA lo_nd_item TYPE REF TO if_wd_context_node.
DATA lo_el_item TYPE REF TO if_wd_context_element.
DATA ls_item TYPE wd_this->element_item.
* navigate from <CONTEXT> to <ADOBE_DATA> via lead selection
lo_nd_adobe_data = wd_context->get_child_node( name = wd_this->wdctx_adobe_data ).
* navigate from <ADOBE_DATA> to <HEADER> via lead selection
lo_nd_header = lo_nd_adobe_data->get_child_node( name = wd_this->wdctx_header ).
* navigate from <HEADER> to <ITEM> via lead selection
lo_nd_item = lo_nd_header->get_child_node( name = wd_this->wdctx_item ).
lo_nd_item->bind_table( new_items = it_item set_initial_elements = abap_true ).
Could you please tell me where I am doing wrong?
In adobe form
Created one MainForm and its properties are
Binding : $record.HEADER.DATA[*]
Repeat subform for each data item Checked , Min Count: 1
Subform Content : Flowed ,Western Text , Allow page breaks withing Content Checked
Accessibility /Subform Role: None
Inside this Mainform I have created a small table ITEMTABLE with 3 fields and mapped it item data.
Itemtable properties
Binding : ITEM
Uncheck Repeat table for Each Data item.
I have Itemtablerow inside Itemtable and its properties are:
Binding : DATA[*]
Repeat row for each data item Checked ,Min count: 1
Accesibility:/Subform Role: Body row
Row: body row, Check Allow page breaks within content
Still donu2019t see data on form.here is what i have in Hierarchy tab.
ADOBE_DATA (no Caption)
- (Master pages)(no caption)
Page1
Untitled Content Area(no caption)
- Mainform(no Caption)
PSPID {PSPID}
-ItemTable (No caption)
- ItemtableRow (no Caption)
PSPID(no Caption)
CJTDAT(no Caption)
CPERCO(no Caption)
What could be going wrong ?
Rgds
VaraHi John,
In the WD4A view, there is a button "Show/Hide Layout Preview".
Click on that button to be able to see the Layout.
Note that this button is next to the Pretty Print button.
regards,
Reema. -
hi ı want to ask about my code
SET SERVEROUTPUT ON
declare
sonuc float;
acildigi_yil NUMBER(4);
begin
SELECT AVG(GPA_RESULT)
into sonuc,acildigi_yil FROM (
SELECT oa.ogrenci_no,sum(n.sayisal*dt.kredi)/sum(dt.kredi+0.00000000000001) GPA_RESULT
FROM ders_aktif da,ders_tanim dt,ogrenci_akademik oa,ders_kayit dk, notlar n
WHERE da.acildigi_yil=2007 and
oa.ders_baslama_yil=2007 and
oa.birim like '1521%' and
(da.acildigi_donem='1'or
da.acildigi_donem='2')and
da.ders_kodu like '1521%' and
(dt.normal_yariyili=1 or
dt.normal_yariyili=2)and
dt.ders_kodu=da.ders_kodu and
da.acilan_ders_no=dk.acilan_ders_no and
oa.ogrenci_no=dk.ogrenci_no and
dk.harf_kodu is not null and
dk.y_yil is null and
dk.harf_kodu=n.tanim and
n.ortalamaya_kat='1' and
dk.durum='1' and
dk.yerine is null AND
dk.yil<=2007
group by oa.ogrenci_no);
dbms_output.put_line('GPA lerin ortalaması='||sonuc);
end;ı want to retrieve with select "da.acildigi_yil=2007 " . When da.acildigi_yil is what is, ı retrieve with select... is this possible ?
for example in above code. where da.acildigi_yil=2007 and ı want to retrieve 2007 with using select..thank you very much .this code was for using pivot .
it is ok .
how can ı use in pivot ? because calculate avg(gpa_result) in first select statement so
create or replace
PROCEDURE YILARALIKLIGPADAGILIMI(birimno number,sinif number,aranilan_yil number) AS
a_yil number(4):=aranilan_yil;
gpa_ortalama float;
acyil number(4);
begin
WITH PIVOT_DATA AS (
SELECT AVG(GPA_RESULT),acildigi_yil
INTO gpa_ortalama,acyil
FROM (
SELECT oa.ogrenci_no,sum(n.sayisal*dt.kredi)/sum(dt.kredi+0.00000000000001) GPA_RESULT ,da.acildigi_yil
FROM ders_aktif da,ders_tanim dt,ogrenci_akademik oa,ders_kayit dk, notlar n
WHERE da.acildigi_yil=aranilan_yil and
oa.ders_baslama_yil=a_yil and
oa.birim like birimno||'%' and
(da.acildigi_donem='1'or
da.acildigi_donem='2')and
da.ders_kodu like birimno||'%' and
(dt.normal_yariyili=1 or
dt.normal_yariyili=2)and
dt.ders_kodu=da.ders_kodu and
da.acilan_ders_no=dk.acilan_ders_no and
oa.ogrenci_no=dk.ogrenci_no and
dk.harf_kodu is not null and
dk.y_yil is null and
dk.harf_kodu=n.tanim and
n.ortalamaya_kat='1' and
dk.durum='1' and
dk.yerine is null
--and
--dk.yil<=aranilan_yil
group by oa.ogrenci_no, da.acildigi_yil
) GROUP BY ACILDIGI_YIL
SELECT * FROM PIVOT_DATA
PIVOT( AVG(GPA_ORTALAMA) RESULTT FOR ACILDIGI_YIL IN(2007,2006,2005,2004,2003));
DBMS_OUTPUT.PUT_LINE('gpa ortalaması'||gpa_ortalama);
DBMS_OUTPUT.PUT_LINE('yılı'||"2007_RESULTT");
DBMS_OUTPUT.PUT_LINE('yılı'||"2006_RESULTT");
DBMS_OUTPUT.PUT_LINE('yılı'||"2005_RESULTT");
DBMS_OUTPUT.PUT_LINE('yılı'||"2004_RESULTT");
DBMS_OUTPUT.PUT_LINE('yılı'||"2003_RESULTT");
END YILARALIKLIGPADAGILIMI;I use avg(gpa_result) in first select statment so ı know ı must use aggregate function inside pivot operation .
so if ı remove avg operaiton in first select statement so errors occurred ı know. -
How to get all values from an interval using select statement
Hi,
Is it possible to write a select statement that returns all values from an interval? Interval boundaries are variable.
something like this:
select (for x in 1,1024 loop x end loop) from dual
(this, of course, doesn't work)
The result in this example should be 1024 rows of numbers from 1 to 1024. These numbers are parameters, so it is not possible to create a table with predefined values.
Thanks in advance for your help,
Mia.For your simple case, with a lower boundary of 1, you can use:
SELECT rownum
FROM all_objects
WHERE rownum <= 1024For a set of number between say 50 - 100, you can use something like:
SELECT rownum + (50 - 1)
FROM all_objects
WHERE rownum <= (100 - 50 + 1)Note, that all_objects was used only because it generally has a lot of rows. Any table with at least the number of rows in your range will work.
TTFN
John -
Can we use select options in smartform
can we use select options in smartform if so can any one send me a sample code...
Thanks
bhaskharHi ,
Can u explain why u want to use select options in smartforms . U can try it in program lines .
Its better to use select options in the driver program and fetch data accordingly in the driver program or passing the selected values from select options to the smatfrom and fdetching the data there in smartform .
Regards -
Search help is not coming while using select-options?
Hi All,
I am using select options in my selection screen, i used wdr_select_options, also i coded some parameter values also
( non select-options ). For that field i am not getting search help. If i create as normal i am getting? Suggestions pelase?
Thanks,
Venkat.HI
what kind of search help is associated with the field.
ADD_SELECTION_FIELD method has some specific parametrs for value_help
give the input there and try again.
these parameters are
I_VALUE_HELP_TYPE
I_VALUE_HELP_ID
I_VALUE_HELP_MODE
I_VALUE_HELP_STRUCTURE
thanks
sarbjeet dingh -
I have a scenario in which our enterprise activation servers exist in a domain that is in a separate forest than our offices. Currently all our domain controllers are 2008 R2 with domain and forest functional levels at 2008 R2. We have set
up two-way forest trusts with our office domains using selective authentication. We then give the domain controllers from our licensing domain the "Allowed to Authenticate" right to the domain controllers in the office domain. On the
server 2008 R2 domain controllers in the office domain, we can browse to the appropriate objects in the licensing domain after being presented with an authentication window that allows us to enter credentials for the licensing domain. However, after
installing a 2012 R2 domain controller in an office domain, we can not use the 2012 domain controller to browse to the objects in the licensing domain. It never asks for credentials for the licensing domain when we specify the objects we want to add
from the licensing domain. I simply states that the object can not be found. When I look at the domain controller in the licensing domain, I see that the domain controller in the office domain is attempting to pass the credentials of the user that
is logged on and this is failing since this user has no rights in the licensing domain. I can still use a 2008 R2 domain controller in the office domain to add the rights and it works like it always has. Can somebody tell me why this is happening
and how to correct it?Hi,
Based on my research, this is a known issue in Windows Server 2012 R2.
According to the article below: “The Selective Authentication feature of selective trusts is
not functional. Access to resources enabled by “Allowed to Authenticate” will fail. There is no workaround at this time”.
Release Notes: Important Issues in Windows Server 2012 R2
http://technet.microsoft.com/en-us/library/dn387077.aspx
Best Regards,
Amy Wang -
Hi Friends,
I am using Oracle 8.1.6 Server, & facing problems while retrieving data from a PL/SQL Table:
CREATE or REPLACE PROCEDURE test_proc IS
TYPE tP2 is TABLE of varchar2(10); --declared a collection
dt2 tP2 := tP2('a','b','c');
i NUMBER(8);
begin
SELECT COUNT(*) INTO i FROM TABLE(CAST(dt2 as tP2));
DBMS_OUTPUT.PUT_LINE('**'||i);
end;
While executing the above procedure, I encountered foll. error:
ERROR at line 1:
ORA-00600: internal error code, arguments: [15419], [severe error during PL/SQL execution], [], [],
ORA-06544: PL/SQL: internal error, arguments: [pfrrun.c:pfrbnd1()], [], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [0]
Can anyone please help me, where the problem is??
Is it Possible to retrieve data from PL/SQL TABLE using SELECT statement? & How ?
Thanks in advance.
Best Regards,
Jay Raval.Thanks Roger for the Update.
It means that have to first CREATE TYPE .. TABLE in database then only I can fire a Select statement on that TYPE.
Actually I wanted to fire a Select statement on the TABLE TYPE, defined & declared in PLSQL stored procedure using DECLARE TYPE .. TABLE & not using CREATE TYPE .. TABLE.
I was eager to know this, because my organization is reluctant in using CREATE TYPE .. TABLE defined in the database, so I was looking out for another alternative to access PL/SQL TABLE using Select statement without defining it database. It would have been good if I could access a PLSQL TABLE using Select statement Declared locally in the stored procedure.
Can I summarize that to access a PL/SQL TABLE using SELECT statement, I have to first CREATE TYPE .. TABLE?
If someone have any other idea on this, please do let me know.
Thanks a lot for all help.
Best Regards,
Jay Raval.
You have to define a database type...
create type tP2 is table of varchar2(10)
CREATE OR REPLACE PROCEDURE TEST_PROC
IS
dt2 tP2 := tP2('a','b','c');
i NUMBER(8);
begin
SELECT COUNT(*) INTO i FROM TABLE(CAST (dt2 AS tP2));
DBMS_OUTPUT.PUT_LINE('**'||i);
end;
This will work.
Roger -
How to use GUI_DOWNLOAD inside BSP Application event
Hi All,
I am facing one issue while using GUI_DOWNLOAD inside BSP Application. When the processing goes at GUI_DOWNLOAD it gives me unknown error where as the same code is working when used in report program. My requirement is to save password into excel file at my local machine. I am using FM MS_EXCEL_OLE_STANDARD_DAT to save password in excel file but this function module fail when it reach at GUI_DOWNLOAD . Can you please help me out.
Thanks and Regards
Pradeep Kr. RaiDear Pradeep,
Find the below link which explains a simple data download to excel from a table view.
www.sapt echnical.com/Tutorials/BSP/Excel/Index.htm
Try to avoid the way your using in the BSP application and it is abdicable to use the standard methods / class available like "cl_bsp_utility"
Hope this will be helpful.
Regards,
Gokul.N
Edited by: Gokul on Oct 8, 2009 9:57 AM
Maybe you are looking for
-
Hi... I have been consistently facing a serious problem regarding the firefox I use. It's Firefox 20.0.1. I use Windows 7 and I have 8 gb of Ram. The problem is after I launch Firefox two dialogue boxes appear in quick succession one telling that "sv
-
Since yesterday my Iphone 4 does no longer connect to the Wifi. It recognises it, but doesn't connect. It is not the rooter, have checked that. Have restored iphone to factory settings and it still doesn't recognise the wifi connection. Any suggestio
-
Can't open any tables in 4.0EA3
I just upgraded to 4.0EA3 from version 1.5.5 (our company was a little out of date with its tools). Really love the ability to jump to a procedure body from the definition. Love a lot about the new IDE, except I used to be able to double click a tabl
-
Os 10.3.1 problems after update.
after updating my z10 stl100-1 to the latest official os 10.3.1, i have noticed a few problems with my phone. 1. when i receive a call and after i pressed answer it delays a while. 2. when i am using the default browser, randomly it will restart my p
-
HI, I have installed 10g and applied the patch p4163362_10104_WINNT. I am using AWM 10.1.0.4. I had imported the Global schema and tring to creating the workspace "GLOBAL" as per the give document. I am facing error while creating Workspace. Kindly h