Select statement without into
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,
Rishav
Hi
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
Similar Messages
-
Using temporary tablespace for sort in select statement without spacifying
how can i use some particular temporary tablespace in select statement for sording without allocating any temporary tablespace to that user
Try to set for the current session the in memory sorting space to 0 before running your query:
SQL> alter session set sort_area_size = 0;The query should use the temporary tablespace.
Message was edited by:
Pierre Forstmann -
Case sensitivity select statement without using native sql
please help me ,
i have a selection screen as select-options : s_vbeln, s_kunnr(mandt),s_matnr and
p_name as a parameter (type name1) which is case sensitive in sap abap database and i want to get
output from these fields in an alv.[vbeln,kunnr,name1,audat,auart,matnr,kwmeng,netwr]
How to do it? Can any one give me solution please.[i have to handle case sensitivity plz give me solution]this is my code : but its not working as i expected plz tell me where did i went wrong...
type-pools slis.
tables : vbak , vbap.
select-options : s_vbeln for vbak-vbeln,
s_kunnr for vbak-kunnr,
s_matnr for vbap-matnr.
parameters p_name1 type NAME1_GP.
ranges r_name for kna1-name1.
types : begin of ty_vbak,
vbeln type vbeln_va,
audat type audat,
auart type auart,
kunnr type kunnr,
end of ty_vbak,
begin of ty_vbap,
vbeln type vbeln_va,
matnr type matnr,
netwr type netwr_ap,
kwmeng type kwmeng,
end of ty_vbap,
begin of ty_kna1,
kunnr type kunnr,
name1 type name1,
end of ty_kna1,
begin of ty_final,
vbeln type vbeln_va,
audat type audat,
auart type auart,
matnr type matnr,
netwr type netwr_ap,
kwmeng type kwmeng,
kunnr type kunnr,
name1 type name1,
end of ty_final.
data : t_vbak type standard table of ty_vbak initial size 1,
t_vbap type standard table of ty_vbap initial size 1,
t_kna1 type standard table of ty_kna1 initial size 1.
data : t_final type standard table of ty_final initial size 1,
w_final type ty_final,
w_vbap type ty_vbap,
w_kna1 type ty_kna1,
w_vbak type ty_vbak.
data : t_fcat type slis_t_fieldcat_alv,
w_fcat type slis_fieldcat_alv.
DATA T_FINAL2 TYPE STANDARD TABLE OF TY_FINAL INITIAL SIZE 1.
data v_name1 type name1.
if p_name1 is not initial.
r_name-sign = 'I'.
r_name-option = 'EQ'.
if p_name1 ca '*'.
r_name-option = 'CP'.
endif.
r_name-low = p_name1.
append r_name.
endif.
start-of-selection.
select vbeln audat auart kunnr from vbak
into table t_vbak
where vbeln in s_vbeln and
kunnr in s_kunnr.
if sy-subrc <> 0.
message 'plz enter a valid entry' type 'I'.
leave list-processing.
endif.
if t_vbak[] is not initial.
select vbeln matnr netwr kwmeng from vbap
into table t_vbap
for all entries in t_vbak
where vbeln = t_vbak-vbeln and
matnr in s_matnr.
if sy-subrc <> 0.
message 'no rec found' type 'I'.
leave list-processing.
endif.
select kunnr name1 from kna1
into table t_kna1
for all entries in t_vbak
where kunnr = t_vbak-kunnr.
if sy-subrc = 0.
sort t_kna1 by kunnr.
endif.
endif.
end-of-selection.
loop at t_vbap into w_vbap.
read table t_vbak into w_vbak with key vbeln = w_vbap-vbeln binary search.
read table t_kna1 into w_kna1 with key kunnr = w_vbak-kunnr binary search.
w_final-vbeln = w_vbak-vbeln.
w_final-audat = w_vbak-audat.
w_final-auart = w_vbak-auart.
w_final-matnr = w_vbap-matnr.
w_final-netwr = w_vbap-netwr.
w_final-kwmeng = w_vbap-kwmeng.
w_final-kunnr = w_kna1-kunnr.
w_final-name1 = w_kna1-name1.
append w_final to t_final.
endloop.
delete t_final where name1 not in r_name.
perform sub_fill_fcat using 'VBELN' 'SALE ORDER NUM'.
perform sub_fill_fcat using 'KUNNR' 'CUSTOMER NUMBER'.
perform sub_fill_fcat using 'NAME1' 'NAME OF A CUST'.
perform sub_fill_fcat using 'AUDAT' 'SALE ORDER DATE'.
perform sub_fill_fcat using 'AUART' 'SALE DOC TYPE'.
perform sub_fill_fcat using 'MATNR' 'MATERIAL NUM'.
perform sub_fill_fcat using 'KWMENG' 'QUANTITY'.
perform sub_fill_fcat using 'NETWR' 'PRICE'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IT_FIELDCAT = T_FCAT
TABLES
T_OUTTAB = T_FINAL
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
*& Form SUB_FILL_FCAT
* text
* -->P_0389 text
* -->P_0390 text
FORM SUB_FILL_FCAT USING P_FNAM P_TEXT.
clear w_fcat.
w_fcat-fieldname = p_fnam.
w_fcat-seltext_m = p_text.
append w_fcat to t_fcat.
ENDFORM. -
Select statement without using Rownum or Rowid
Hi,
I have a requirement where I have delete the first 100 records from table without using the rownum or rowid.
Thanks to all for your time
NarainHi
delete from yourtab x where (select count(*) from yourtab where yourpk <= x.yourpk) < 101;HTH
Laurent Schneider
OCM DBA -
How to pull only column names from a SELECT query without running it
How to pull only column names from a SELECT statement without executing it? It seems there is getMetaData() in Java to pull the column names while sql is being prepared and before it gets executed. I need to get the columns whether we run the sql or not.
Maybe something like this is what you are looking for or at least will give you some ideas.
public static DataSet MaterializeDataSet(string _connectionString, string _sqlSelect, bool _returnProviderSpecificTypes, bool _includeSchema, bool _fillTable)
DataSet ds = null;
using (OracleConnection _oraconn = new OracleConnection(_connectionString))
try
_oraconn.Open();
using (OracleCommand cmd = new OracleCommand(_sqlSelect, _oraconn))
cmd.CommandType = CommandType.Text;
using (OracleDataAdapter da = new OracleDataAdapter(cmd))
da.ReturnProviderSpecificTypes = _returnProviderSpecificTypes;
//da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
if (_includeSchema == true)
ds = new DataSet("SCHEMASUPPLIED");
da.FillSchema(ds, SchemaType.Source);
if (_fillTable == true)
da.Fill(ds.Tables[0]);
else
ds = new DataSet("SCHEMANOTSUPPLIED");
if (_fillTable == true)
da.Fill(ds);
ds.Tables[0].TableName = "Table";
}//using da
} //using cmd
catch (OracleException _oraEx)
throw (_oraEx); // Actually rethrow
catch (System.Exception _sysEx)
throw (_sysEx); // Actually rethrow
finally
if (_oraconn.State == ConnectionState.Broken || _oraconn.State == ConnectionState.Open)
_oraconn.Close();
}//using oraconn
if (ds != null)
if (ds.Tables != null && ds.Tables[0] != null)
return ds;
else
return null;
else
return null;
}r,
dennis -
Query regarding Oracle SQL select statement
Hi,
How does Oracle ensures a consistent snapshot with the select statement
without locking the table. My question is summarized with an example below:
1. At time T1, Oracle select statement is fired and is fetching the result.
2. At time T2, some DML operation is performed on the same table on which
the select was executed and a commit was fired.
3. At time T3, The Oracle select statement (Step 1) completes.
My question is whether the records of transaction at time T2 will be visible at time T3 or not?
If "not", then does it mean that Oracle retrieves the rows from the time of last commit.
I would also like to know if for the above mechanism, Oracle would make use of the rollback segemt to access the rows at a particular instant of time.
TIA
Regards,
RajThis is called Read Consistency in the oracle. Its all about SCN before starting the transaction.
Lets say
1. T1 executs SELECT statement on EMP table.
2. T2 made an update on the EMP and commited.
But, T1 only still sees only old image of the data not the new one. This is called read consistency.
You will be having two images in the buffer, one is consistent and changed image.
When the T1 give SELECT statement it notes the SCN of the transaction. Read oracle document about read consistency.
SJH. -
Three select statement data in to One Internal table
HI All,
By using 3 select statement, data is displying by using work area (classical report). Now i want define three internal table for three select statements, and finally get the data in one final itab, and pass this to function module (ALV Report).
looking for responsehi,
just go through this simple example. no need of declaring 3 itabs.
data: begin of st1,
a1 type c,
a11 type i,
end of st1.
data: begin of st2,
a2 type i,
a22 type c,
end of st2.
data: begin of st3,
a3 type i,
a33 type i,
end of st3.
data: begin of fin_struct.
include structure st1.
include structure st2.
include structure st3.
data: end of fin_struct.
data: fin_itab like table of fin_struct with header line.
*1st structure values
move 'a' to fin_itab-a1.
move 1 to fin_itab-a11.
*2nd structure values
move 11 to fin_itab-a2.
move 'b' to fin_itab-a22.
*3rd structure values
move 15 to fin_itab-a3.
move 12 to fin_itab-a33.
*appending 1st record.
append fin_itab.
*1st strcuct values
move 'b' to fin_itab-a1.
move 3 to fin_itab-a11.
*2nd structure values
move 22 to fin_itab-a2.
move 'c' to fin_itab-a22.
*3rd structure values
move 20 to fin_itab-a3.
move 30 to fin_itab-a33.
*appending 2nd record.
append fin_itab.
loop at fin_itab.
write:/ fin_itab-a1, fin_itab-a11, fin_itab-a2, fin_itab-a22, fin_itab-a3, fin_itab-a33.
endloop.
here structre1,2,3...
i used move statement.
here u write select statement.. into struct1,2,3....
using move u move all the values ...
finally append it to final itab...
rest of and all common for ALV...
Regards,
Shankar. -
Hello ,
I have very strange issue, Any select statement on few tables takes very long time( in fact it hangs) often but the same SQL runs in a second all other times in the same database. Please note that it is a simple select statement without any 'for update' clause.
After recycling the database, the select statement runs faster but this situation comes back after couple of days on the same set of tables.
We are using 9i release 2.
Can you please advise how to go about solving this type of issue.
Thanks.438628, Robert is correct in that the board would need to see an explain plan to have any chance of narrowing the problem down. If bind variable peeking is involved the plan may not match what Oracle is actually doing to solve the query.
When the problem occurs try looking in v$plan_table and see if the plan matches the explain plan output. A difference would be a clue that a reparse of sometype is being done so the plan could be different for each execution. The presence of child cursors would also point to something causing reparses.
Do any of the columns for this table involved in the where clause has histograms on them? What is the value of the spfile/init.ora parameter cursor_sharing?
If cursor_sharing is EXACT then bind variable peeking should not be the problem. If the parameter is SIMILAR or FORCE then it could be. On 9.2 I believe there is a bug that causes a reparse for every execution when SIMILAR is used so evey execution could be a different plan.
To check for skewed data just count the values in the column and then count by value. If the max(value_count) / count(*) is greater than a small percentage of the data then the column is skewed. The worse the skew the more likely that a plan chosen for a distinctive value is not a good plan for a non-distinctive value.
HTH -- Mark D Powell -- -
Hi All,
I been working with databases (ORACLE, MSSQLSERVER, SQLANYWARE) for last couple of years. SELECT statement comes into picture very frequently.
But yet I am unable to find any template, tool or hint to document the SELECT statement, so that other developers can understand its flow and relationships among source files. Every time a source given to developer (other than who actually write it) with SELECT statement, it takes long time to understand.
Any hint/help would be highly appreciated.
Regards.For 90-some percent of the SQL statements you're likely to come across, this would seem to be an issue of developer training rather than of documentation. If your developers are accostomed to thinking in terms of set-based processing rather than procedural-based programming, the structure of a SQL statement ought to be rather self-explanatory. If there are a lot of DECODE statements or the SQL statement is doing something unusual, putting an explanatory comment nearby might be helpful.
Of course, this assumes that the developers are reasonably familiar with the data model of the underlying tables. If not, make sure they have the necessary ERD(s) and other documentation.
Justin
Distributed Database Consulting, Inc.
www.ddbcinc.com/askDDBC -
Need to create a transaction for multiple select statements?
Hello,
I am a newbie and have a question about database transaction, e.g. whether/not to enclose multiple select statements (and select statements only) into a transaction.
My database is set to transaction isolation level 2: REPEATABLE READ, where dirty read & non-repeatable read are not allowed, only phantom read is allowed.
Now, in my code I have a number of methods that only contain select statements only. Since they are merely select statements, which don't do any modifications to the data, I am not sure if I am supposed to enclose them into a transaction.
However, if I don't put them into a transaction will the transaction isolation level takes into effect automatically when another user is modifying the data that I am reading? In other words, I need to make sure the select statements will never do either dirty read or non-repeatable read. But I am not sure if it is necessary to enclose multiple select statements in a transaction, since I believe putting the select statements into a transaction will put some locks to the data being read which may reduce the concurrency of my application.
Any help/advice would be very much appreciated.
DuaneYou might want to try asking this on a forum that specific to your database. I suspect the answer can vary depending on the database and probably requires in depth knowledge of what the database does.
-
Table or view does not exists error while executing select statement
Hi,
I am new to Oracle. I am getting a error while executing the select statement if i give table name without double quotes.
Ex: Select * from Customer;
But working fine when the table name is enclosed within a double quotes.
Ex: Select * from "Customer";
Is there any way to execute the select statement without the double quotes?
Actually I am using NHibernate objects for data access.
Thanks,
SaiActually I am using NHibernate objects for data access.And probably that's the problem:
SQL> select * from mytab;
A
1
SQL> select * from mYtAb;
A
1
SQL> select * from MYTAB;
A
1
SQL> select * from MYTAb;
A
1Oracle statements are case insensitive and doesn't require double quotes unless the object names are reserved words.
As wrote by others if table is created using double quotes it's name bacomes case-sensitive... and this could be the problem...
Max
[My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/02/05/gestione-degli-errori-in-sql-con-log-errors/]
Edited by: Massimo Ruocchio on Feb 5, 2010 7:08 PM
Added last comment.. -
Help with a simple select statement
$x = oci_parse($c, "select quantity from balance where item_num=101");
oci_execute($x);
echo "the quant is: ".$x;
I try to run this select statement without success
then I tried...
$x = oci_parse($c, "select quantity from balance where item_num=101");
$y= oci_execute($x);
echo "the quant is: ".$y;
and it didn't work either...
What should I change?
thanks!The Oracle library operates a bit differently from some other PHP libraries, notably MySQL/MySQLi. With Oracle (OCI8), you have to execute the statement, and then afterward use an oci_fetch...() function to pull things from your $statement variable. Here's a small example that hopefully will illustrate the basic usage:
<?php
$conn = oci_connect('hr','hr','xe');
if(!$conn) {
echo 'Could not connect!';
exit;
$sql = 'select * from jobs';
$stmt = oci_parse($conn, $sql);
if(!$stmt) {
echo 'Could not parse query.';
exit;
$result = oci_execute($stmt, OCI_DEFAULT);
if(!$result) {
echo 'Could not execute query.';
exit;
echo "Query ran successfully.\n";
// Fetch rows as associative arrays, so
// we can ask for values by column name.
// Other options include oci_fetch_row(),
// oci_fetch_array(), and oci_fetch_object().
// Note that oci_fetch_assoc() will create
// an associative array using upper-case
// column names for the keys.
while(($row = oci_fetch_assoc($stmt)) != null)
echo $row['JOB_ID'] . ': ' . $row['JOB_TITLE'] . "\n";
echo "All data returned.\n";
oci_close($conn);
?>When I run this, I get the following:
C:\workspace\php>php select.php
Query ran successfully.
AD_PRES: President
AD_VP: Administration Vice President
AD_ASST: Administration Assistant
FI_MGR: Finance Manager
FI_ACCOUNT: Accountant
AC_MGR: Accounting Manager
AC_ACCOUNT: Public Accountant
SA_MAN: Sales Manager
SA_REP: Sales Representative
PU_MAN: Purchasing Manager
PU_CLERK: Purchasing Clerk
ST_MAN: Stock Manager
ST_CLERK: Stock Clerk
SH_CLERK: Shipping Clerk
IT_PROG: Programmer
MK_MAN: Marketing Manager
MK_REP: Marketing Representative
HR_REP: Human Resources Representative
PR_REP: Public Relations Representative
All data returned.
C:\workspace\php>For more information, take a look at the OCI8 library documentation in the PHP manual online:
OCI8
http://us.php.net/manual/en/book.oci8.php
Some other examples
http://us.php.net/manual/en/oci8.examples.php
Kind regards,
Christopher L. Simons -
Disable logging of SELECT statements
I would like to disable the logging of SELECT statements without disabling the logging of other SQL. From what I can see in the documentation, I am limited to a level of all SQL or no SQL.
Reasoning: There are 100X as many SELECT statements as INSERT or UPDATE generated by TopLink for my app, and it bloats my log files enormously. I use the INSERT / UPDATE statements for debugging from time to time so I still want to log them, but the SELECTS are never useful.
Can I define some custom logger class that handles this?
Thanks,
StuccoYou could write your own SessionLog subclass for this. You would need to overwrite the log method and search the SessionLogEntry message for SELECT and ignore the message.
-
Getting Username to pass into LOV select statement
Hello!
I'm wondering if its possible to get the username of the current user logged in and pass it as a variable into a select statement used in a dynamic LOV in Oracle AS Portal?
What I'm attempting to do is pull all the values from a table that equal the current user's username to user on a portal report
so (as a rough example)
select color from mytable where username = 'whatever the user name is would be here'
And then the current user would get a list of values from which to select based off of the values entered in this table.
The issue I'm having is determing how to fill the 'whatever the user name is would be here' portion with the actual logged in user's username (or even if its possible). I know on the actual portal one can do #USER.FULLNAME# to display their username, is there a similar "variable" one may use to get the username for a LOV sql call?
I can get it to work if I statically fix the username to a particular value (ex: where username = 'Joe.Hacker') but I'm unsure if theres a variable or bind value (for lack of a better term) to grab the username on the fly.. dynamically.portal.wwctx_api.get_user can be used in the SQL query of your portal report to get the user_name of the currently logged-in portal user. For more info on wwctx_api, see the 10.1.2 or 10.1.4 portal API docs at http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1012/index.html or http://www.oracle.com/technology/products/ias/portal/html/plsqldoc/pldoc1014/index.html
-
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;
Maybe you are looking for
-
I am using SAP 4.7C Can somebody please tell me if I want to email Payment Advice to my vendor, can I do it through SAP. Please keep this thing in mind that I DONT WANT to use automatic payment method F110. But still needs to generate Payment advice
-
Hi all, I can not manage to set the title of my output ZMAI, which is a mail automatically tigger when the RFQ is saved. I've already try Messages>Output Control >Message Types > Define Message Types for Request For Quotation > Maintain Message Type
-
Hi need to map EDI 4030 version to IDOC. I completed BIC but, When i comes to PI There is no Seeburger Standard mappings for EDI 4030 varsion there is only 4010 Version mappings are available. So my Question is: Ii need to import 4030 version if Yes:
-
Transaction ii views limitaions
while processing the transaction iview we will provide user with one transaction code in the details of iview,so my issue is when i see the preview of it i must be able to see only that transaction i have provide in the iview details .if i give /n <o
-
Can I have 2 systems on 1 computer?
Can I have firefox and internet explorer on the same computer?