Using dymanic table name for running select queries
Hi there. Currently got a problem with performing the following task:
Perform fulltext search on all tables that have created fulltext indexes in specific schema. Result should look like this:
<TABLE_NAME1> <ID_FROM_TABLE>
<TABLE_NAME1> <ID_FROM_TABLE>
<TABLE_NAME2> <ID_FROM_TABLE>
<TABLE_NAME2> <ID_FROM_TABLE>
At the moment all tables have the same ID column UOI_ID.
What I've tried so far is the following:
PROCEDURE "tuser"."dam.test.db.procedures::textSearch" ( in keyword NVARCHAR(300), out search_results "tuser"."dam.test.db::tuser.procedures.tt_search_results" )
LANGUAGE SQLSCRIPT
SQL SECURITY INVOKER
DEFAULT SCHEMA "tuser"
AS
BEGIN
Write your procedure logic
DECLARE counter Integer := 1;
DECLARE row_count Integer;
DECLARE table_name NVARCHAR(300);
DECLARE schema_name NVARCHAR(300) := 'tuser';
indexed_tables = SELECT row_number() OVER (ORDER BY "TABLE_NAME") AS ROW_NUMBER, "TABLE_NAME"
FROM (
SELECT DISTINCT "TABLE_NAME"
FROM "SYS"."FULLTEXT_INDEXES"
WHERE "SCHEMA_NAME" = :schema_name
SELECT COUNT(*) INTO row_count FROM :indexed_tables;
WHILE counter < row_count + 1 DO
SELECT '"tuser"."'||"TABLE_NAME"||'"' INTO table_name FROM :indexed_tables WHERE "ROW_NUMBER" = :counter;
temporary_results = SELECT :table_name AS TABLE_NAME, "OUI_ID" AS ID
FROM :table_name
WHERE contains(*, :keyword, fuzzy(0.5));
search_results = CE_UNION_ALL(:search_results, :temporary_results);
counter := counter + 1;
END WHILE;
END;
At this point it's impossible to perform the:
... FROM :table_name ...
The error is:
Could not create catalog object: scalar type is not allowed
Tried doing it with CE functions.
temporary_table = CE_COLUMN_TABLE(table_name);
The error is:
Dependent object not found: SqlScript; tuser.TABLE_NAME
So the question is: How to dynamically put table name into "FROM ..." statement?
Hello. Thx for response.
I have tried something like
exec 'INSERT INTO "tuser"."dam.test.db::tuser.procedures.search_result" SELECT '''||table_name||''' AS TABLE_NAME, '||column_name||' AS ID, SCORE() AS SCORE FROM '||table_name||' WHERE contains(*, '''||keyword||''', fuzzy(0.5))';
but here i have "tuser"."dam.test.db::tuser.procedures.search_result" created before the execution. What i really want is to make it as a local variable. Something like:
DECLARE schema_name NVARCHAR(300) := 'tuser';
indexed_tables = SELECT DISTINCT "TABLE_NAME" FROM "SYS"."FULLTEXT_INDEXES" WHERE "SCHEMA_NAME" = :schema_name ;
but i can not transform the top 'exec ...' statement into 'result = SELECT ...' because it always says that it can not pass the scalar value into the 'FROM ...' part.
Similar Messages
-
How to use a table name in the select statement using a variable?
Hi Everybody,
I got a internal table which has a field or a variable that gets me some tables names. Now I need to retrieve the data from all these tables in that field dynamically at runtime. So could you suggest me a way out to use the select query which uses this variable as a table ?
Regards,
Mallik.Hi all,
Actually i need some more clarification. How to use the same select statement, if i've to use the tabname in the where clause too?
for ex : select * from (tab_name) where....?
Can we do inner join on such select statements? If so how?
Thanks & Regards,
Mallik. -
Using a derived table name in a select ...
In SQL or PL/SQL am I able to use the derived value of a colu,n (which holds a table name) to run an SQL.
Basically I want to perform a "select count(*) from table" where table is a list of tables held in another, eg all_tables.
EG:
all_tables has
TABLE1
TABLE2
TABLE3
and I want to get
TABLE1 100
TABLE2 50
TABLE3 110
ThanksSQL> ed
Wrote file afiedt.buf
1 declare
2 cursor cur_tables is
3 select table_name
4 from user_tables;
5 v_cnt NUMBER;
6 begin
7 for t in cur_tables
8 loop
9 execute immediate 'select count(*) from '||t.table_name into v_cnt;
10 dbms_output.put_line('Table: '||t.table_name||' ('||v_cnt||')');
11 end loop;
12* end;
SQL> /
Table: PRE_MAP_LOG (150935)
Table: LOG_SRC (126)
Table: SRC_LOOKUP (10)
Table: T (1)
Table: MYDONORS (22)
Table: CHANGE_LOG (347)
Table: CHANGE_VARCHAR2 (461)
Table: DO_MAP_LOG (50)
Table: CHANGE_DATE (96)
Table: CHANGE_NUMBER (561)
PL/SQL procedure successfully completed. -
Use Of Numeric Table Names For Performance
Just a question if anyone has any experience using numeric table names(ie... 100, 200, 300... etc) instead of the typical naming conventions (ie... data_user_statistics, statsUser etc....) in their databases.
I had a database admin advise me that by using the short numerical names, you could potentially see a measurable gain in performance. Not sure how much that would be on a smaller 30-50 table database. I would think however, that if the database is heavily utilized, that you would see some performance gains. Just curious if anyone had any thoughts on this.user10887160 wrote:
Just a question if anyone has any experience using numeric table names(ie... 100, 200, 300... etc) instead of the typical naming conventions (ie... data_user_statistics, statsUser etc....) in their databases.
I had a database admin advise me that by using the short numerical names, you could potentially see a measurable gain in performance. Not sure how much that would be on a smaller 30-50 table database. I would think however, that if the database is heavily utilized, that you would see some performance gains. Just curious if anyone had any thoughts on this.Does your admin suggest the same for columns ?
Imagine having to work out the (otherwise obvious) error in something like:
select
"100"."302",
"200"."707"
from
"100",
"200"
where
"100"."305" = 104395
and "200"."709"="100"."303"
;(And I have seen it in a production system - except the tables started with a "T" and the columns with a "C" - and it was a complete pain in the backside to do performance trouble-shooting.)
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.
"Science is more than a body of knowledge; it is a way of thinking"
Carl Sagan -
Does any one know table names for Payroll Elements that can be used in WF
How can one get the table names for ORACLE Payroll Elements and how can one use those table names in order to create a workflow that will automatically update the payroll balances.
I have created 3 elements for LOAN:-
One being Direct Payment as its Primary Classification---------------->Loan Amount
Two being Voluntary Deductions as its Primary Classification------->Recovery Amount
Three being Information as its Primary Classification--------------------->Reducing Balance.
Would like to create a work flow that will do automatic updation of the DB items in the Balances. So i want to know what all tables get updated once the transaction is made in Payroll. I am not sure if it really can happend.
Please PEOPLE i need some 1 to help me.
Thanking you all in advance,
ChetanTheoretical and acual speeds for all types data connections can differ due to several variables. I cannot tell you if my eSata connection has ever achieved the theoretical maximum speed because I have never measured it. However I have compared transfer times against Firewire with large files and it is noticeably faster (at least by 50%+). Therefore I highly recommend having it if you need to transfer large files from one HDD to another.
If you have a recent MBP, you already have a Thunderbolt connection. I do not believe that there will be a Thunderbolt Express Card for older MBPs because they are not configured to accept that technology.
Ciao. -
Import Data using Full Table Name
Is there a way to run the import data wizard so when pulling data from a csv it generates an insert statement not only using the table name but using the Oracle Schema name -- ie fully qualified table name?
Hi Nilanjan,
I need help ASAP.
About this dump-load task, how does it works? Because I was checking out a package called Import SQL and this one only imports data from a table, however this table has to be allocated within the database that is being used, and I right? Are these 2 related somehow?
Does this task order BPC to find data from a SQL Table (allocated in a different server, different instance for SQL) and import it to SQL Fac2 table?
Can you help me with a simple explanation what do I need to do to run this task? The page help.sap.com talks shows a section within DumpLoad Task Usage which is called Importing Into SQL Server...
* Processing the Application using DumpLoad -
Importing into SQL
You can use DumpLoad to process the application as a standalone procedure, or with data import, export, or clear.
Prerequisites
The DumpLoad task (OsoftTaskDumpLoad2008.dll) is registered with Microsoft SSIS. See Registering Custom Tasks.
Procedure
1.Open a package or create a new package in Microsoft SSIS on the Planning and Consolidation server. i already did this for the DumpLoad task ... should I do this for the Import SQL task also ?
2.Select the task and add it to the package. WHAT DOES SELECT THE TASK MEAN?
3.Open the task, and choose Data Management None .
4.Enter the application set, application, and user ID.
Im getting confused, can you please provide more details about the whole procedure. Thanx in advance
Velázquez -
Hi export,
how to find out the table name for Infor type, such as I want to know IT0041 and IT0002 store in which table.All personnel administration tables start with PA and the infotype number behind it.
All personnel development/OM tables start with HRP and infotype (e.g. 1000) behind it.
All recruitment tables start with PB and infotype number behind it.
There also are HR tables that start with HRA, HPD, HRT, etc. The easy way to get a list is to use SAP's 'Application Hierarchy', transaction SE81 (select all HR modes in the tree that you are want a list of tables for, click on the 'Information System' button, under Abap Dictionary --> Basic Objs, double click on 'database tables', increase your 'maximun no. of hits' and execute).
Use transaction se11...type in PA* do dropdown and enter, do the same for HRP* and you will have most of the HR transaparent Tables. To access them look for RP_read_* and RP_provide* in Table TRMAC to read a infotype or use the 'select' statement to access the Transparent table.
Transaction SE16 (data browser) is also useful. As mentioned above, the PA infotype tables all begin with PA and are followed by the infotype number e.g. PA0001 for the Org Man infotype.
PA* - PA infotype tables
PCL* - HR clusters
PB* - recruitment tables
PCERT - payroll posting runs
I hope this will help you in future too
Thanks -
Cannot use duplicate table name error in AMDP
Hi Experts,
I'm developing an application which has the following architecture
SAP UI5->Gateway->ABAP Managed DB procedures(AMDP)->HANA SP(Stored Procedure)
We are having a very peculiar problem where the gateway service works inconsistently for the same input data.
i.e If I execute the same service n number of times, I get the results successfully for say n-3 times but the other 3 times I get a "RFC Error :Error while executing Database procedure"
There is no change in the input data or DB table data during all the executions.
Running the stored procedure stand alone in HANA studio works all the time.
We tried executing the AMDP from SE24 and the same behavior occurred.
When trouble shooting we found that the exception occurs inside the AMDP when the call db procedure statement is executed.
Could you please advise what could be the possible reason for this any tuning parameter/unavailability of db connections?
Or could you please suggest some other troubleshooting mechanism by which we can zero in on the cause?
When I go in the debug mode I can see the exact error as
cannot use duplicate table name: [288] SAPXXX.ZCL_PLAN_MAINTENANCE=>GET_COMP_TYPE#stub#20140905055908: line 15 col 3 (at pos 492): cannot use duplicate table name exception:
where ZCL_PLAN_MAINTENANCE=>GET_COMP_TYPE is the AMDP class and method. SAPXXXis the schema.I reported this to Adobe customer support on 11/29, and here is their response:
Wednesday, December 5, 2007 12:51:27 PM PST
Hello John,
Thank you for contacting Adobe® Web Support for assistance with Adobe
Photoshop Elements® 6.0.
I understand that images are deleted if you accidentally try to move
them to a folder that already includes a file of the same name.
Thank you for bringing this to our attention. I was able to replicate
this behavior as well. The best method to report errors of this nature
is using the following form on our website:
http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
I will report this to the product team through my channels. You may want to submit this issue through the web form as it goes directly to the product development team.
I hope this information helps to resolve your issue. If you require
further assistance with this issue, please update your web case with
complete details, including what steps you have applied and any error
messages you are receiving.
You may also call Technical Support at (800) 642-3623. We are available from 6:00 am to 5:00 pm Monday - Friday, Pacific Time.
Kind regards,
Alan C.
Adobe Web Support -
How to find table name for the fields from Standard Extractor in CRM system
How to find table name of fields from the standard extractor in CRM system ?
e.g. We use LBWE TCode in R/3 system to find table name for the field from Extractor VCSCL(e.g.).
Likewise is there any way to find table name for the fields from Standard extractor like 0CRM_LEAD_I.Hi ,
Please find the link below for understanding BW CRM analysis.
http://help.sap.com/bp_biv135/html/bw.htm
activate the CRM DSs by scenario:
1) Activate the application component hierarchy (tcode RSA9). Changes made to the application component hierarchy in the CRM system can be transferred to the BW using the "Edit Application Component Hierarchy" (SBIW - Postprocessing of DataSources).
SAP Note 434886 must be implemented in CRM 3.0 before the application component hierarchy is activated.
2) Activate the Business Content DataSources (tcode RSA5).
Select/enter the application component and choose Execute (F8).
To compare the shipped and active versions, choose the 'Select Delta' pushbutton. If there is no active version of the DataSource, it is selected automatically.
To activate the shipped version, choose the 'Transfer DataSources' pushbutton.
3) Management of the versions of the BW-Adapter metadata (tcode BWA5). All DataSources are displayed that are managed by the BW Adapter.
As in transaction RSA5 (Service API Metadata Activation), the 'Select Delta' function can be used to select the inactive DataSources or compare shipped and active versions.
You can also go directly to the screen for maintaining DataSources that are managed by the BW Adapter.
The 'Compare Version' function makes a detailed comparison of the shipped and active versions.
All BW-Adapter metadata is considered when versions are compared:
Header information (Table SMOXHEAD)
Mapping information (Table SMOXRELP)
Global selection conditions (Table SMOXGSEL)
Attribute key fields (Table SMOXAFLD)
Hope this helps.
Regards,
csm reddy -
Table name for the field FAEDT(net due date)
hi every body,
plz can any body tell me the table name for the field net due date(FAEDT).
its very very urgent
thanq.Hi mark chalfen,
thanq very much ur reply.
actually my client want to change the payment term for all the vendor invoices.so wt we did is... we created aprogram to change the old payment term to new payment term in the vendor line items(fbl1n).
when we run the program its changing the payment term and the base line date and the NO of days in the vendor linitems.but it not changing the net due date based on the new baseline date.
i think with out changing the net due date only changing the payment term is use less.coz the item again show as due in the same date.
so how can we change the net due date based on the new baseline date.?from which table we can take the field FAED and update with the new date.
plz advise me?
thanq. -
Hi Experts,
I want to find out total queries for some data targets for this i am using "RSBCTCB_QUERY" table but i am getting Query technical name only, i want Description also.. so can you please give me table name for this?
Many thanks
DavidHi Naida,
solved my problem with your solution, thanks
I have only info provider name and i need to find out total queries along with description, so which table gives full information.
RSBCTCB_QUERY----- this table gives only total info provider query technical names only ( not description)
RSBCTCB_QRY_T_V----
> this table gives description only what ever we provide query technical name
but,
if i give info provider name i want to know the total queries with description.
Thanks
David
Edited by: david Rathod on Jan 19, 2011 12:37 PM
Edited by: david Rathod on Jan 19, 2011 12:38 PM
Edited by: david Rathod on Jan 19, 2011 12:38 PM -
MD04 table name for stock statistics
hi, all
i'm wondering how can i find out the table name for MD04- stock statistics - Fixed receipts, the structure's name MDSTA-SUM02.
I tried use ST05 to trace the update table name, i created a Production order, this "fixed receipts" field is updated. but i counldn't find out the right updated table for this particular field.
does anyone know how to find it or if anyone knows the right table name for it! thanksDepending what you're trying to do, you can do a test run on MD_STOCK_REQUIREMENTS_LIST_API. The only information you need to enter is the plant and material. You'll want the results in E_MDSTA. That will only be reasonable if you're trying to find the value for a single plant and material, though (or a handful). If you need this information for all materials at all plants and need it frequently, which would seem more likely, your ABAPers can use this function in their report. Again, the only info they'll need to pass to it are the plant and material. Hope that works out for you.
-
What are the table names for CRM and APO?
hi friends,
what are the table names for CRM and APO?
Regards
suneel.hi Suneel,
check in crm forum
Re: SAP-CRM Tables
BUT051 BP Relationship: Contact Person Relationship
Similar to BUT050 , additionally contains Contact Persons Address data
BUT0BK Business Partner: Bank Data & Details
BP Number, Bank Key, Bank Country Key, Bank Account Number
BNKA Bank Master Data
BUT100 BP: Roles
ADR2 Telephone Numbers (Business Address Services)
ADR6 SMTP Numbers (Business Address Services)
Contains Email Id of the BP.
ADRC Addresses (Business Address Services)
BPs Complete Address Details- City, Country, Post Code, District, Street, Title No Etc
TSAD3T Table containing the Title text against a Title No.
COMM_PRODUCT Master Table for Product
CRMM_BUAG Master table for Business Agreement
CRMM_BUAG_H Header Data for Business Agreement such as Tax Category, Tax Characteristic, Form key, Business Agreement Class. Data in this table correspond to ISU CRMD_ORDERADM_H Contains the Header Information for a Business Transaction.
Note:
1. It doesnt store the Business Partner
responsible for the transaction. To
get the Partner No, link it with
CRM_ORDER_INDEX.
2. This table can be used for search
based on the Object Id(Business
Transaction No).
CRMD_CUSTOMER_H Additional Site Details at the Header Level of a Business Transaction
CRMC_PROC_TYPE Master table Business Transaction Type
CRMC_PARTNER_FCT Definition of Partner Functions
SCPRIOT Priorities for Activities with priority text.
CRMC_PROC_TYPE_T Text for a transaction type
CRMC_ACT_OBJ_T Objective Number and Text for Activities
TJ30T All the status code and text
CRMC_PR_ASSIGN : Transaction Type and its Transaction Type Object.
IBIB : Installed Base/Ibase
IBIN : Installed Base Components
COMM_PRODUCT : Products
CRMC_T077D : customer account groups
CRMD_ORDERADM_H (for header) CRMD_ORDERADM_I (Item data)
CRMD_ORDERADM_H Business Transactions CRM
CRMD_ACTIVITY_H Activity
CRMD_OPPORT_H Opportunity
BUTOO : Customer details
BUT001 BP: General data II
BUT100 BP: Roles
BUT150 BP relationship: Attribute table (test
different
BUT_HIER_TREE Business Partner Group Hierarchy
CDBC_T_PRODUCTID Mapping: Product Id
CDBD_ORGMAN Business transaction - organizational unit -
set
COMC_PRODUCT General Product Settings
COMC_R3_FIELDS Assignment of R/3 material master fields to
CFOP
COMM_CATEGORY Category
COMM_CFGMAT Basic Data for Materials
COMM_HIERARCHY Category Hierarchy
COMP_TYPES Hierarchy Tool: Comparison Type Check
Table
CRMC_CPRICPROC Customer Pricing Procedures
SMOKVBEZ15 Assignment employees to positions
CRMMLSGUID: GUID entry (should match GUID in CRMPRLS)
CRMM_BUT_CUSTNO : Also GUID table (GUID here should match GUID in R/3 table CRMKUNNR)
SMOFSUBTAB : Mapping & Parameters
SMOFDSTAT : Download Monitor (R4AM1)
SMOFFILTAB : Filters (Should match filters in R3AC1 & R/3 Table CRMFILTAB)
SMOFOBJECT Definition of Objects for Download
SMOFOBJPAR Parent Objects of an Object in Table
SMOFPARSFA Middleware Parameter
SMOFQFIND Queue Finder Table for MW-Queue finder
SMOFTABLES Definition of Tables for Download -
HI All,
i want the table names for below items :
customer number , customer name , slaes order number , item , quantity , tottal value and schedule date.
i need to select these items. any body pls tell me the table names .
Regards,
panduDear Pandurangarao,
For your future requirements,
You may also check the same (i.e. Table Name/ Field Name/ Program Name/ Screen Field) by yourself.
There are few requirements:
1. You have to decide from where (i.e. Document..???, say Sales Order in VA02) you want to fecth the data for your requirement.
2. Go in to that document (say, you wanna all data to be fetch from Sales Order; then VA02).
3. Click one within the field and Press F1. This will open an Overview window. In to the same window, down there, you will find on e Tab: Technical Information. Click the Tab.
4. Now, you may get all technical informations for your inputs.
Best Regards,
Amit -
Need Table name for some fields..
Dear Friends
Please help me to find Table names for for the following fields :
1. Document Currency
2. Cleared / Open Item Symbol
3. Transaction
4. Fixed
5. Payment Date
6. Payment Order
7. Payment Sent
thanx in advance..Hi,
Press F1 on the screen where you have seen the fileds.You will get techncail information.click on that button.It will show you the table and field names.
Please let me know if you need more information.
Assign points if useful.
Regards
Sridhar M
Maybe you are looking for
-
Compatibility of Sony HC1 to Capture in FCE 3.0.1
I'm attempting to Capture HD video from a Sony HC1 camcorder to my iMac G5, EyeSight, Pre-Intel, 2.1 Ghz, 250G Built-In Hard Drive via Firewire. (No external FW hard drives are involved.) I'm using FCE 3.0.1 which Apple considers compatible with the
-
trying to take photos off my 3G since the upgrade,,, I am not seeing the popup to take photo's off and store them on my computer
-
How do I change text size in auto-page tabs
Now I'm trying to make the page tabs fit across my page. I've got several pages and will probably have more. I don't want all of them on the bar as they'll be linked in my text. I would also like to make the text smaller and maybe reformat to another
-
Unable to initiate BPM process despite using script task
Hi, I've created a BPMN process which I want to initiate through a script task - I followed the steps given in section 3.7 of the following doc - https://stbeehive.oracle.com/content/dav/st/HP%20personal%20workspace/Public%20Documents/BPMN_03_SalesQu
-
Hi Gurus In the main dataset query i created a parameter "where k.jlocat=:LOC or :LOC is null". These are ORACLE Parameters and hence the :. In another dataset i created a simple query as select distinct jlocat as LOC FROM TABLE1 Every thing works f