How to write select within select in ABAP
Hi Guys
I want to write a select statement in ABAP to select from 2 tables below is my code I want to write select within select statment in --->A and replace with ---> B
FORM sales_production_order USING p_vbeln TYPE vbeln_va
CHANGING p_aufnr TYPE aufnr
p_rtcod TYPE sysubrc.
CLEAR: p_rtcod,
p_aufnr.
A *******
SELECT aufnr FROM aufk INTO p_aufnr UP TO 1 ROWS
WHERE kdauf EQ p_vbeln .
B *******
SELECT kdauf from aufk into p_aufnr UP TO 1 ROWS
WHERE KDAUF IN ( SELECT VBELN FROM VBAP where vbeln EQ p_vbeln) .
ENDSELECT.
p_rtcod = sy-subrc.
ENDFORM. " sales
T
Hi Eslam,
In select statements, ENDSELECT must be added when single line returned without the addition 'SINGLE'.
The innner query in your code, returns a single record but with the addition 'UP TO 1 ROWS'. The outer query also like this only. But the outer query ended with 'ENDSELECT', not for inner query.
Else you can add 'SINGLE' keyword.
SELECT aufnr FROM aufk INTO p_aufnr UP TO 1 ROWS
WHERE kdauf EQ '10' .
SELECT SINGLE kdauf from aufk into p_aufnr
WHERE KDAUF IN ( SELECT VBELN FROM VBAP where vbeln EQ p_vbeln) .
ENDSELECT.
SELECT aufnr FROM aufk INTO p_aufnr UP TO 1 ROWS
WHERE kdauf EQ '10' .
***** It assigns Nth record's KDAUF to p_aufnr provided N records satisfy the condition.
SELECT kdauf from aufk into p_aufnr UPTO 1 ROWS
WHERE KDAUF IN ( SELECT VBELN FROM VBAP where vbeln EQ 'p_vbeln) .
ENDSELECT.
ENDSELECT.
Regards,
R.Nagarajan.
Similar Messages
-
How to write select statement in XSL-FO type XML program
Hi All,
Could you please anyone explain briefly how to write select statement in XSL-FO XML Program.
Requirement:
In the seeded program, OAF page is creating one XML file and through XSL-FO type XML Pulisher loading data and generating PDF output. as per the requirement some of the informations are missing in the XML file and for modifing the OAF page will be taking someting. we are planing to write a select query inside the XSL-FO program to get the required information.
Could you please help me how to write a select statement inside the XSL-FO type programs.
Please give me some example program for this...
Thanks in Advance.
Regards,
SenthilHi ,
Please check the below code and modified plant as select-option
Check the below code :
tables : mara,
mast.
data : begin of i_data occurs 0,
matnr like mara-matnr,
end of i_data.
select-options : s_matnr for mara-matnr,
<b>S_werks for mast-werks.</b>
start-of-selection.
select a~matnr into table i_data
from mara as a inner join mast as b on amatnr = bmatnr
where <b>b~werks in s_werks</b>
and a~matnr in s_matnr
and a~mtart = 'AA'
or a~mtart = 'UT'
and b~stlan = '1'.
loop at i_data.
write:/ i_data-matnr.
endloop.
Hope you got it.
Thanks
Seshu -
How to write Select statement for this codition
I need to check whether SGTXT contains BELNR value.
SGTXT is a text field and It should be matched with BELNR
How to write select statement for this.
Select AUGBL AUGDT into t_BSAD
from BSAD
where SGTXT should have the given BELNR Value.
Plz note : Here I cannot give as SGTXT = BELNR as coz BELNR have only 10 digits.Hi,
data temp(12).
concatenate '%' belnr '%' into temp.
Select AUGBL AUGDT into t_BSAD
from BSAD
where SGTXT like temp.
If belnr is having multiple values,just create a internal table as follows.
types : begin of ty,
belnr....
temp(12),
end of ty.
data itab_ type standard table of ty.
data wa type ty.
loop at itab into wa.
concatenate '%' wa-belnr '%' into wa-temp.
modify itab from wa index sy-tabix transporting temp.
endloop.
Change your select statement accordingly.
Kindly reward poits if it helps. -
How to write SELECT statement using tables ekko,ekpo and eket?
Hi,
I got a problem in performance tuning using below tables?
how to write SELECT statement using tables EKKO,EKPO and EKET and in conditon ( WHERE clause) use only fields
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0
eket~rsnum NE space.
Thanks in Advance.
bye.Hi,
ekko~ebeln IN ebeln
ekko~loekz EQ ' '
ekko~lifnr IN lifnr
ekko~ekorg IN ekorg
ekko~ekgrp IN ekgrp
ekpo~werks IN werks
ekpo~pstyp EQ '3'
ekpo~loekz EQ space
ekpo~elikz EQ space
ekpo~menge NE 0 " Remove this from where clause
eket~rsnum NE space. " Remove this from where clause
' instead delete the entries after fetching into the table
DELETE it_itab WHERE menge EQ '0' AND rsnum EQ ' '.
Regards
Bala Krishna -
How to write select statement before the loop and how to use read statemnt
Hi,
Recently our system has changed from 4.6 to ECC6.
As its migrated its showing lots of errors like in between loop and endloop there should be no select statemnt........
Can any one please tell how to write that coding in ECC6 , how can i change the code......
In between loop and endloop i am having lots of select statemnts.....ple tell thye coding how can i select before the loop starts and
how to read that internal table in loop.Hi Deepthi,
You can do as per below:
1) Select the required entries from the tables you need (VBAK, VBAP, KNA1, etc)
SELECT VBELN ERDAT KUNNR
into table it_vbak
from VBAK
where VBELN = S_VBELN. "Selection criteria
If sy-subrc = 0.
SELECT VBELN POSNR MATNR
into table it_vbap
from VBAP
for all entries in it_vbak
where VBELN = it_vbak-vbeln
SELECT KUNNR NAME1
into table it_vbak
from VBAK
where VBELN = it_vbak-vbeln.
endif.
2) Loop at the entries, and read internal table it-kna1 for customer info.
Loop at it_vbak into wa_vbak.
read table it_kna1 into wa_kna1 with key kunnr = wa_vbak-kunnr.
if sy-subrc = 0.
endif.
loop at it_vbap into wa_vbap where vbeln = wa_vbak-vbeln.
endloop.
endloop.
This is the basic idea and short example of how to extract entries and read internal table.
Hope this helps.
Regards,
Patrick -
How to write select statement directly in java file instead of using vo
Hi,
I have written the following code in my java file:
if(empvo==null)
empvo=worklistamimpl2.createViewObject("InvoiceVO", "xxetfc.oracle.apps.icx.icatalog.shopping.server.InvoiceVO");
if(empvo!=null){
OAViewObject oaviewobject2 = (OAViewObject)worklistamimpl2.findViewObject("InvoiceVO");
OAViewObjectImpl oaviewobjectimpl = (OAViewObjectImpl)oapagecontext.getApplicationModule(oawebbean).findViewObject("InvoiceVO");
oaviewobject2.setWhereClause("Invoice_num="+" ' " + s + " ' ");
oaviewobjectimpl.executeQuery();
String abc = (String)oaviewobjectimpl.first().getAttribute("Invoice_id");
It is giving me error as
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (select invoice_id from ap_invoices_all) QRSLT WHERE (Invoice_num='ERS15022012_3')
1. Why is this error coming.. how to solve this
2. Instead of using vo how can i write select statement directly in the above code
Thanks,
Edited by: user10873676 on Apr 9, 2012 1:18 AM
Edited by: user10873676 on Apr 9, 2012 1:21 AMit says java.sql.SQLSyntaxErrorException: ORA-00904: "INVOICE_NUM": invalid identifier
where as invoice_num column is present in my table -
How to write select query for this
Hi,
I had a html form and in the for i had drop down box and it needs to select multiple values from the drop down box. When i select multiple values then i have to write the SQL select statement query .
When i try to write the select statement and trying to run i am getting error.
select * from Table
where emo_no = '1,2,3'
this is how i write query please suggest me how to write query for selecting multiple values from the drop down box.
Thanksselect * from Table
where emo_no in ( 1,2,3)
for integer values
select * from Table
where emo_no in ('1','2','3')
for characters
If we talk about large scale applications that may have millions of records, I would suggest this.
declare @t table (v int)
insert into t (v) values (1)
insert into t (v) valves (2)
insert into t (v) values (3)
select *
from table
inner join @t t on table.emo_no = t.v
Using "in" for a where clause is not so bad for filtering on a few values, but if you are filtering a lot of rows and a lot of values (emo_no) the performance degrades quickly for some reasons beyond the scope of this.
This is just one solution, I'll through this out as well, instead of an in memory (@t) table, doing a disk based temp table (#t) and creating an index on the column "v".
create table #t (v int)
insert into #t (v) values (1)
insert into #t (v) valves (2)
insert into #t (v) values (3)
create index ix_t on #t (v)
select *
from table
inner join #t t on table.emo_no = t.v
drop table #t
Pardon any syntax errors and careful using a drop statement.
Sometimes in memory tables work better than disk temp tables, it takes some testing and trial and error depending on your datasets to determine the best solution.
Probably too much info ;-)
Byron Mann
[email protected]
[email protected]
Software Architect
hosting.com | hostmysite.com
http://www.hostmysite.com/?utm_source=bb -
How to write selection-screen block on 15th position?
Hello all,
I want to write selection-screen block on 15th position, How can I do this?
I know that we can write parameter/select-option on perticuler position using following code.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE t7.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 15.
PARAMETERS: fdat LIKE SY-DATUM,
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b1.
It writes parameter(FDAT) on 15th position. How can I write whole block on 15th position?Hi,
For this u have to use comment lines. See the below simple program...
SELECTION-SCREEN COMMENT /2(50) TEXT-001 MODIF ID SC1.
SELECTION-SCREEN SKIP 2.
SELECTION-SCREEN COMMENT /10(30) COMM1.
SELECTION-SCREEN ULINE.
PARAMETERS: R1 RADIOBUTTON GROUP RAD1,
R2 RADIOBUTTON GROUP RAD1,
R3 RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN ULINE /1(50).
SELECTION-SCREEN COMMENT /10(30) COMM2.
SELECTION-SCREEN ULINE.
PARAMETERS: S1 RADIOBUTTON GROUP RAD2,
S2 RADIOBUTTON GROUP RAD2,
S3 RADIOBUTTON GROUP RAD2.
SELECTION-SCREEN ULINE /1(50).
INITIALIZATION.
COMM1 ='Radio Button Group 1'.
COMM2 ='Radio Button Group 2'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'SC1'.
SCREEN-INTENSIFIED = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP. -
How to write select statement ?
Hi,
i have requirement like below :
In selection screen we have material number as selection options and plant as single entry.
Based on the input.
We have to extract the material number and plant based on MTART = AA or UT in MARA table and STLAN = 1 in MAST table.
how to write a select statment to pick values from selection option and extract those material and plant which fullfill above conditions.
Please let me know..
its urgent
please help..
i have written code like below..
types: begin of x_it_mat,
matnr type mkal-matnr,
werks type mkal-werks,
stlan type mast-stlan,
end of x_it_mat.
types: begin of x_it_mat1,
matnr type mkal-matnr,
werks type mkal-werks,
mtart type mara-mtart,
end of x_it_mat1.
data : it_mat type table of x_it_mat,
wa_mat like line of it_mat.
data : it_mat1 type table of x_it_mat1,
wa_mat1 like line of it_mat1.
TABLES: MKAL , MAST , MARA.
SELECTION-SCREEN BEGIN OF BLOCK matnr
WITH FRAME TITLE TEXT-001.
select-options :
so_matnr for mkal-matnr.
SELECTION-SCREEN END OF BLOCK matnr.
SELECTION-SCREEN BEGIN OF BLOCK plant
WITH FRAME TITLE TEXT-002.
parameter p_werks type mkal-werks.
SELECTION-SCREEN END OF BLOCK plant.
select matnr
werks
stlan
from mkal INTO table it_mat
where matnr in so_matnr
and werks = p_werks.
after this how to write another select statement to extract material by satisfiying above 2 conditions..Hi ,
Please check the below code and modified plant as select-option
Check the below code :
tables : mara,
mast.
data : begin of i_data occurs 0,
matnr like mara-matnr,
end of i_data.
select-options : s_matnr for mara-matnr,
<b>S_werks for mast-werks.</b>
start-of-selection.
select a~matnr into table i_data
from mara as a inner join mast as b on amatnr = bmatnr
where <b>b~werks in s_werks</b>
and a~matnr in s_matnr
and a~mtart = 'AA'
or a~mtart = 'UT'
and b~stlan = '1'.
loop at i_data.
write:/ i_data-matnr.
endloop.
Hope you got it.
Thanks
Seshu -
How to write selected text in JTextArea in selected location
iam using JTextArea ...
i want to writer selected text in selected location,,,,,,use
JTextArea.getSelectedText() and
JTextArea.replaceRange(String str, int start, int end)
methods. -
How to write select statement into SCRIPT editor
hello,
i build a sap script for purchase order printing for exporting.
now after all po order print fine then our client want some more should be print into layout regarding po header.
At the soul my q is can i write select query into script editor itself.
thanks and regards
amit.You cannot write your select statement inside your SAPscript, to overcome this SAP has provided us an option of calling sub-routines.. go through the below example
Go through this example
Ex. SAPSCRIPT
/: PERFORM <Subroutine name> IN PROGRAM <subroutine prog name>
/:USING &<field name>&
/:CHANGING &<field name1& "It will be returned back from sub-routine
/:ENDPERFORM
Then create subroutine pool program(of your own name) and you have to write the code.
FORM ><subroutine name> tables int_cond structure itcsy
outt_cond structure itcsy.
data : value(20), value1(20). "do your own declarations
Read int_cond table index 1.
value = int_cond-value.
value1 = value1 + value.
*****Write your select statement
Read outt_cond table index 1.
outt_cond-value = value1.
Modify outt_cond index 1.
ENDFORM.
Just rough idea given above.
Regards,
SaiRam -
How to write macro's in hr abap
Hi,
All
I am new to HR ABAP .Does any body give links to write macro's in HR ABAP
Thanks in advance.
regards
Ramh,
adding to the aboce post.
chk this.
Macros:
Introduction
Programs that process the cluster data (for example, RX) do not access the cluster independently. The data is accessed using a defined interface created with macros.
Macro contains some part of source code which it will be useful for number of applications. Macro is module which is stored
Naming Conventions of Macro:
RP-aaa-bb-cc
aaa is the type of Macro. It takes two values
o IMP Import Macro
o EXP Export Macro
bb is the Database table where the data is saved:
o C1 Database object PCL1
o C2 Database object PCL2
o C3 Database object PCL3
o C4 Database object PCL4
Cc is the cluster, it may take
o RX Cluster object RX
o RD Cluster object RD
o B2 Cluster object B2 and so on.
Defining and Calling the Macros
Defining:
There are two options for defining the Macros
Macros are defined using the ABAP Commands DEFINE .END-OF-DEFINITION. A macro can be used within a report or within include. If a macro is used in a report, and the macro is defined in include with the DEFINE command, include must be integrated.
Macros can also be defined as RMAC macros. The source code of these modules is stored in the function section of the control table TRMAC. The coding is grouped under a specific name in the table key.
According to conventions, the first two letters of the name must stand for the application. The rest of the name is freely definable.
Difference between the two methods is:
If a macro is changed, each report using this macro is automatically regenerated when it is executed.
When you change a RMAC macro in the table TRMAC, the reports that use this macro are not regenerated automatically. You must regenerate them manually.
Standard HR Macros
o The macro RP-PROVIDE-FROM-FRST retrieves the first(start) data record which is valid in the data selection period.
o The macro RP-PROVIDE-FROM-LAST retrieves the last(latest) data record which is valid in the data selection period.
o The macro RP-READ-INFOTYPE retrieves the data record(s) which is valid in the data selection period.
How to check whether the macro operation is successful or not
For every macro, whether the operation was successful or not will be checked with
PNP-SW-FOUND.
If PNP-SW-FOUND = 1, then the operation is successful.
Where exactly the Macro code is stored
The program code pertaining to this macro is stored in the control table RMAC
Guidelines for how and when to use the Standard Macros
o RP_PROVIDE_FROM_FRST
Use macro RP_PROVIDE_FROM_FRST in programs for the logical databases PNP and PAP where the first data record for a period (can be a subtype) is read from an infotype table. The infotype table has been filled earlier (for example, with GET PERNR or RP_READ_INFOTYPE). This macro is only helpful if the infotype has time constraint 1 or 2.
Prerequisites
The validity begin date of the time period must be before or the same as the validity end date.
Validity start and end dates are correct (preferably of the type DATE).
The infotype table is sorted in ascending order. Otherwise, you would receive the first fitting table entry that might not necessarily correspond to the first time entry.
Features
The first entry for a specified period is placed in the table header entry from an internal infotype table.
Parameters
RP_PROVIDE_FROM_FRST inftytab subty beg end
IN : 1) Name of the internal table
2) Subtype required or SPACE if no subtype is being specified
3) Validity start date of the time interval
4) Validity end date of the time interval
OUT: 1) PNP-SW-FOUND: has the value 0 if there is no matching entry in the infotype table in the given time period. Otherwise it has the value 1.
2) The matching table header entry if PNP-SW-FOUND = 1 or
the initial table header entry if PNP-SW-FOUND = 0
Example
(RP_PROVIDE_FROM_FRST inftytab subty beg end)
RP_PROVIDE_FROM_FIRST P0021 '1' PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
ENDIF.
or
RP_PROVIDE_FROM_FRST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Error: Org. assignment is missing' REJECT.
ENDIF.
o RP_PROVIDE_FROM_LAST
You use macro RP_PROVIDE_FROM_LAST in programs for the logical databases PNP and PAP where the last data record for a period (can be a subtype) is read from an infotype table. The infotype table has been filled earlier (for example, with GET PERNR or RP_READ_INFOTYPE). This macro is only helpful if the infotype (or subtype) has time constraint 1 or 2.
Prerequisites
The validity begin date of the time period must be before or the same as the validity end date.
Validity start and end dates are correct (preferably of the type DATE).
The infotype table is sorted in ascending order. Otherwise, you would receive the last fitting table entry that might not necessarily correspond to the last time entry.
Features
The macro RP_PROVIDE_FROM_LAST makes sure that the last entry for a specified period is placed in the table header entry of the report output list.
Parameters
RP_PROVIDE_FROM_LAST inftytab subty beg end
IN : 1) Name of the internal table
2) Subtype required or SPACE if no subtype is being specified
3) Validity begin date of the time interval
4) Validity end date of the time interval
OUT: 1) PNP-SW-FOUND: has the value 0 if there is no matching entry in the infotype table in the given time period. Otherwise it has the value 1.
2) The matching table header entry if PNP-SW-FOUND = 1 or
the cleared table header entry if PNP-SW-FOUND = 0
Example:
RP_PROVIDE_FROM_LAST P0021 '1' PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
ENDIF.
OR
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Error: Org. assignment is missing'. REJECT.
ENDIF.
RP_READ_INFOTYPE
You can use the macro in all programs at any point. You can also use it in function modules. In database PNP, an infotype is usually read with GET PERNR. Using macro RP_READ_INFOTYPE is an exception.
You can also use the function module HR_READ_INFOTYPE. For information on how to use the function module, see the documentation on Function Modules.
Prerequisites
The validity begin date of the time period must be before or the same as the validity end date.
Validity begin and end are correct date specifications (preferably of the type DATE).
The infotype table must match the infotype number.
The program using the macro must contain the include DBPNPMAC.
Features
The macro RP_READ_INFOTYPE makes sure that all data records for a person for the specified period are placed in an internal infotype table.
Parameters
RP_READ_INFOTYPE pernr infty inftytab beg end
IN : 1) Personnel number of the person requested
2) Infotype number of the required infotype
3) Name of the internal infotype table
4) Validity start date of the time interval
5) Validity end date of the time interval
OUT: 1) PNP-SW-FOUND = 0, if there is no matching record in the dataset
PNP-SW-FOUND = 1, if there is no matching record in the dataset
2) PNP-SW-AUTH-SKIPPED-RECORD = 0, if the HR authorization check has not retained any records due to incorrect authorizations.
PNP-SW-AUTH-SKIPPED-RECORD = 1 , if the HR authorization check has retained at least one record due to lack of authorization
3) Internal infotype table, containing all matching records for which the user is authorized (this table can also be empty).
Example
(RP_READ_INFOTYPE pernr infty inftytab beg end)
INFOTYPES: 0001.
RP-LOWDATE-HIGHDATE.
DATA: PERNR LIKE P0001-PERNR.
DATA: BEGDA LIKE P0001-BEGDA, ENDDA LIKE P0001-ENDDA.
PERNR = '12345678'.
BEGDA = LOW-DATE + 15
ENDDA = HIGH-DATE - 5.
RP-READ-INFOTYPE PERNR 0001 P0001 BEGDA ENDDA.
IF PNP-SW-AUT-SKIPPED-RECORD EQ '1'.
WRITE: / 'Insufficient authorization'. STOP.
ENDIF.
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Infotype 0001 missing'. STOP.
ENDIF. -
How to write select options with extension in module pool program
hi,
M having the following fields through screen painter.
1. sales offfice
2.sales district
3.customer no
for those three fields no extension is not provided and no search help is there.
i want write seletion options to get extension in that module pool
screen.
plese send coding for me , please let me know how to get that
select options with the above all three fields.
Thanks & Regards
RajiCheck it
In top include
DATA: number(4) TYPE n VALUE '9005',
PROCESS BEFORE OUTPUT.
MODULE status_9001.
CALL SUBSCREEN AREA1 INCLUDING SY-REPID number.
PROCESS AFTER INPUT.
MODULE user_command_9001.
CALL SUBSCREEN AREA1.
*& Module status_9001 OUTPUT
text
MODULE status_9001 OUTPUT.
SELECTION-SCREEN BEGIN OF SCREEN 9005 AS SUBSCREEN.
PARAMETER pa_bukrs TYPE t001-bukrs.
select-options matnr for wa_matnr.
SELECTION-SCREEN END OF SCREEN 9005.
ENDMODULE. " status_9001 OUTPUT -
How to write selection Query for the following requirment.
Hi All,
I am new to ABAP, I need a help ,
I need to select all plants(WERKS) from MARC at Plant/Material level,
then I need to take all sales organozation(VKORG) from T001w,
then I need the company code(BUKRS) from TVKO based on VKORG,
then I need the currency key(WAERS) from T001 based on BUKRS,
Can any one help me in writing selection Query for the same?
Thanks All,
Debrup.Hi,
Its easy for you if you learn SELECT with JOIN to complete your task. So SEARCH the forum with SELECT statement and you will get a lot of examples using which you can write your own.
If you struck up anywhere revert back.
Regards
Karthik D -
How to write select query for all the user tables in database
Can any one tell me how to select the columns from all the user tables in a database
Here I had 3columns as input...
1.phone no
2.memberid
3.sub no.
I have to select call time,record,agn from all the tables in a database...all database tables have the same column names but some may have additional columns..
Eg: select call time, record,agn from ah_t_table where phone no= 6186759765,memberid=j34563298
Query has to execute not only for this table but for all user tables in the database..all tables will start with ah_t
I am trying for this query since 30days...
Help me please....any kind of help is appreciated.....Hi,
user13113704 wrote:
... i need to include the symbol (') for the numbers(values) to get selected..
eg: phone no= '6284056879'To include a single-quote in a string literal, use 2 or them in a row, as shown below.
Starting in Oracle 10, you can also use Q-notation:
http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/sql_elements003.htm#i42617
...and also can you tell me how to execute the output of this script. What front end are you using? If it's SQL*Plus, then you can SPOOL the query to a file, and then execute that file, like this:
-- Suppress SQL*Plus features that interfere with raw output
SET FEEDBACK OFF
SET PAGESIZE 0
-- Run preliminary query to generate main query
SPOOL c:\my_sql_dir\all_ah_t.sql
SELECT 'select call time, record, agn from '
|| owner
|| '.'
|| table_name
|| ' where phone_no = ''6186759765'' and memberid = j34563298'
|| CASE
WHEN ROW_NUMBER () OVER ( ORDER BY owner DESC
, table_name DESC
) = 1
THEN ';'
ELSE ' UNION ALL'
END AS txt
FROM all_tables
WHERE SUBSTR (table_name, 1, 4) = 'AH_T'
ORDER BY owner
, table_name
SPOOL OFF
-- Restore SQL*Plus features that interfere with raw output (if desired)
SET FEEDBACK ON
SET PAGESIZE 50
-- Run main query:
@c:\my_sql_dir\all_ah_t.sql
so that i form a temporary view for this script as a table(or store the result in a temp table) and my problem will be solved..Sorry, I don't understand. What is a "temporary view"?
Maybe you are looking for
-
For BSID- Accounting Document Number corresponding PO Number is required
Hi Gurus, I have got a requirement to develop a report similiar to 'FBL5N' . I am getting the details of open and cleared items of a customer from BSID and BSAD tables respectively. My requirement is also to fetch the corresponding PO nu
-
Since Comcast will no longer allow me to "send" from my AOL Address I need to change my "from:" address on every e-mail I send. I thought I could make my Comcast outgoing server the default one and that would take care of it - it didn't. Then I thoug
-
Sharing Aperture library with another user on the same mac
Hi I just upgraded to Aperture 3.3, on a MBP running Lion (10.7.4) - I am trying to share the library with my wife so that each of us can retain our separate accounts and preferences and be able to edit/print/add pictures to the library I've seen som
-
Can't seem to get my workspace to save CS3
Seems that no matter what I try, my "Swatch" window never opens with my saved workspace, but everything seems to just fine. Additionally, after having to open it, then I have to add my pallettes, which I like to have a few at my fingertips and can g
-
Startup problem on Macbook Pro // Problème de démarrage sur Macbook Pro
Hi, Following a troubleshooting on Macbook Pro, the computer stuck at boot and the fan runs at background. Would you have a solution ? I am entrepreneur in troubleshooting. Best regards, Skoove - IT consultant Bonjour, Suite à un dépannage sur un Ma