Find table column pattern in a variable
I have a variable @a. There is a table B with column A,C. I need to find out those values of column A where column C values are a subset of @a.
For example @a='123456abcd'table
Table B
A C
1 abcd
2 xyzt
In the above case I need to get A=1 since value C pattern belongs within @a.
Hi John_nn,
I’m confused about what’s the desired result you want. Are you want to find out all matched values of column A where column C values are a subset of @a, or find out all matched values of column A where @a is a subset of column C values? If in the first scenario,
you can refer to the first reply of Prashanth and the second reply of Tom. If in the second scenario, you can refer to the first reply of Tom and the second reply of Prashanth.
If there are any misunderstanding, please elaborate the issue for further investigation.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Similar Messages
-
How i pass table column value to string variable or return to java applete
Hi Master,
How do I pass a table column value into string variable. See my code below:
import java.sql.*;
public class Waheed {
public Waheed() {
public static void main (String args [])
String s = "9 23 45.4 56.7";
System.out.println ("going for connection");
// DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn =
DriverManager.getConnection("jdbc:oracle:thin:@fahim:1521:aamir","muhammad","mfa786");
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select accid from accbal");
System.out.println ("going for connection");
while (rset.next())
s= rset.getString("accid"); this line give me error
System.out.println (rset.getString("accid"));
System.out.println (s);
catch(Exception e){
e.printStackTrace();
This line give me an error:
s= rset.getString("accid");
s is string variable
Plese give me an idea how I can pass accid in s variable.
Thanks.
AamirSee the code sample in the following thread (try using upeercase).
JDBC connection
Kuassi -
LOV table column filter with bind variable
Greetings everyone,
I am using JDev version: 11.1.2.3.0
I have a table which has all it's columns with filterable property set to 'true'. I have already created a filter for the first one which displays the total list of users registered in the system. But the second one is a bit more complex.
I want to display a LOV which takes it's values from a VO with a bind variable. In a normal situation there is a another VO which links one of it's properties to this bind var in the View Accessor section of the LOV configuration dialog just like this:
http://2.bp.blogspot.com/_OSq71i5oy0c/SUa6qdnkkoI/AAAAAAAABnY/QnBPmGFgLI4/s400/3.PNG
But i want to be able to display this LOV in a column filter, the code i used is this:
<f:facet name="filter">
<af:selectOneChoice value="#{vs.filterCriteria.Debtor}"
label="Debtor" unselectedLabel=""
id="soc104">
<af:forEach items="#{bindings.ContractPartiesView1.rangeSet}"
var="debtors">
<f:selectItem id="si104"
itemLabel="#{debtors.Name}"
itemValue="#{debtors.PartyNumber}"/>
</af:forEach>
</af:selectOneChoice>
</f:facet>
Where Name is the name of the items to display, and PartyNumber is the value by which the table property (column) Debtor is connected to ContractPartiesView1 (the DC of the first VO).
It doesn't display nothing, and i suppose this is due the fact that ContractPartiesView1 has that bind variable which stays uninitialized.
I need to find a way to initialize this bind variable to get the filtered values for the LOV. I've tried to use a listOfValue binding insted of a tree, but with no result. Am i missing something?
Thanks in advanceI had resolved this, the very next day, but i didn't have chance to reply.
I've simply created another VO, which didn't have a bind variable to get that ID, it was simply linked with a master detail relationship with the one it should get the ID from (via FK). I've created this other VO because the first one was already in use for some other requirement. -
How can I obtain the value of a database column in a JSP variable ?
How can I obtain the value of a table column in a JSP variable?
For example the <jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>
I need to have it in a variable like this:
<% String cnt=<jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>; %>
But it is not workig this way.
Please help me to obtain the value.
I am using JDev RC2.
Thanks.Try something like
String cnt = c1.getRowSet().getCurrentRow().getAttribute("Cont").toString();
-A
How can I obtain the value of a table column in a JSP variable?
For example the <jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>
I need to have it in a variable like this:
<% String cnt=<jbo:ShowValue datasource="cl" dataitem="Cont" ></jbo:ShowValue>; %>
But it is not workig this way.
Please help me to obtain the value.
I am using JDev RC2.
Thanks. -
Finding source database table/column name for a column in a view
Hi i need to be able to identify the original database table/column name for a column in a view.
e.g. say i have a view like this
create v1 as select a.name fname, b.name bname, c.name cname,......
from u1.names a, u2.names b. u3.names c
where .....
Now I want to find out that the database table/column name for the fname, bname and cname columns in the view v1, which in this instance is u1.name.name, u2.names.name, u3.names.name.
But i need to be able to do it for any view. Short of parsing the SQL is there an easy way of doing this?
Now obviusly I can't do this for virtual columns but I will know my column is not virtual as it has an index on it.But i need to be able to do it for any view. Short of
parsing the SQL is there an easy way of doing this?No, parsing the SQL is the only way. Good luck it is not something I would want to attempt. -
How to find the column name and table name with a value
Hi All
How to find the column name and table name with "Value".
For Example i have value named "Srikkanth" This value will be stored in one table and in one column i we dont know the table how to find the table name and column name
Any help is highly appricatable
Thanks & Regards
Srikkanth.M2 solutions by Michaels (the latter is 11g upwards only)...
michaels> var val varchar2(5)
michaels> exec :val := 'as'
PL/SQL procedure successfully completed.
michaels> select distinct substr (:val, 1, 11) "Searchword",
substr (table_name, 1, 14) "Table",
substr (t.column_value.getstringval (), 1, 50) "Column/Value"
from cols,
table
(xmlsequence
(dbms_xmlgen.getxmltype ('select ' || column_name
|| ' from ' || table_name
|| ' where upper('
|| column_name
|| ') like upper(''%' || :val
|| '%'')'
).extract ('ROWSET/ROW/*')
) t
-- where table_name in ('EMPLOYEES', 'JOB_HISTORY', 'DEPARTMENTS')
order by "Table"or
SQL> select table_name,
column_name,
:search_string search_string,
result
from cols,
xmltable(('ora:view("'||table_name||'")/ROW/'||column_name||'[ora:contains(text(),"%'|| :search_string || '%") > 0]')
columns result varchar2(10) path '.'
where table_name in ('EMP', 'DEPT')
TABLE_NAME COLUMN_NAME SEARCH_STRING RESULT
DEPT DNAME ES RESEARCH
DEPT DNAME ES SALES
EMP ENAME ES JONES
EMP ENAME ES JAMES
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES SALESMAN
EMP JOB ES PRESIDENT
EMP JOB ES SALESMAN
9 rows selected. -
Finding a column in the database tables
Hi,
I am new in databases and I just started on a project which was already half done.
Sometimes I find it difficult to find out where a column is, i.e. in which table is?
Is there a query to find it out?
For e.g, there are 100 tables. I want to find a column "Description". I want to know in which table the column "Description" is.
Any help would be appreciated.If you are connect to the schema where you want to search use, user_tab_columns with the following query:
SELECT table_name,column_name FROM user_tab_columns
WHERE column_name like '%STRING%'
ORDER BY 1;
If you want to find out in all the schemas (entire database), use dba_tab_columns.
Jaffar -
How to find a column name in tables
Hello Guys,
I need to find a column name "company_id"
in all the tables in my schema. How can i dont this?
Is there any view that search for coulmns in a table. Please help.
Regards, ImranQuestions about the dictionary are best answered by querying DICT.
In this case
select * from dict where table_name like '%COL%'
Alternatively you can look in the Oracle reference manual for your version.
The information is online, there is little need to ask around here.
Sybrand Bakker
Senior Oracle DBA -
How to find the columns and tables used in a stored procedure?
Hi,
Can someone suggest how to find the columns and tables used within a stored procedure?
Thanks
VBKFor example:
SQL> create or replace
2 procedure p1
3 is
4 cnt number;
5 begin
6 select count(*) into cnt from emp;
7 end;
8 /
Procedure created.
SQL> select referenced_owner,
2 referenced_name
3 from dba_dependencies
4 where owner = 'SCOTT'
5 and name = 'P1'
6 and referenced_type = 'TABLE'
7 /
REFERENCED_OWNER REFERENCED_NAME
SCOTT EMP
SQL> SY. -
Function module to find the columns in Internal table
Hi Group,
Is there any function module which displays the columns of the internal table. I guess there is one cos when we debug any program and select the "Tables" button while debugging and enter an internal table and then do a "Find" the pop up which comes up shows the internal table columns. As this functionality is in the debugger which I cannot debug hence was wondering if some one has come across any such function module. Thanks in advance.
Regards,
Ankur Bhandari
[email protected]Hi again,
1. In the above FM
Pass Program as SY-REPID (U cann pass other prg name also)
in FieldName Pass the name of the internal table
eg. 'ITAB'
2. This FM will give u the details of the
internal table.
The u can display the COMPONENTS table
using ALV or anyother method u like.
Regards,
Amit M. -
How to find out to find by which procedure a table column was updated
Hi All,
We have an attribute10 column of a table used in a DFF.
This attribute is being updated for a specific reason in a code, but some other procedure is also updating the same column which is causing issue with the functionality. The update might be using an API or some other way.
Can anyone help me with a query or some other way to in find out the procedures which might be updating a particular column (attibute10) of that table.
Regards,
ShrutiShruti,
If you can replicate in non-production environment, one way is to create an update trigger on the table/column,and have the trigger do something with any environmental info you can query (select SYS_CONTEXT('USERENV','OS_USER'), etc.) and write it using utl_file or insert it into a custom table. Perhaps have the trigger enable trace, query the above and disable trace.
-Vince -
Show the presentation variable on table column header
hi, experts,
is it possible to show the presentation variable on the table column header.
I have created a edit box with presentation variable on the prompt.
I would like to show the value the user entered on the column header because the values under that column are driven by the presentation variable.
Thank you very much!You cannot put variables in the column headers, as they get considered as text and the same shows in the reports.
However, you can use the session or repository variables in the alias field in the presentation layer.
You should make sure, that in this case, all the calculations are done in the BMM layer and not in answers, for the columns where you will be using the variables. -
Where can I find the column declarations of table X$BH? or X$ tables?
Hi all,
does anyone know where can I find the column declarations for each X$ tables?
I did some googling and with no luck.
So, hoping that I can get some help here!
Thanks in advance!PhoenixBai wrote:
does anyone know where can I find the column declarations for each X$ tables?X$ tables are not "real" tables. They are similar to the +/proc+ file system on Linux that looks like a file system with directories and files, but is actually a view into kernel memory structures.
X$ tables are a view of internal Oracle kernel memory structures. And you need to be careful how you use these - not just how you interpret the data in them. Some structures when touched (using a select against that X$ table), will actually reset the values in the struct. (e.g. <i>X$KSMLRU - LRU flushes from the shared pool - (7.3 - 8.1) [ID 43600.1]</i>).
The basic question you need to ask yourself is what are you looking for using the X$ views into the internals of Oracle? Why are you not using the V$ and GV$ views instead? - these are what 99% of all dba admins and experts and tools use. The times that one need to dig into X$ views (that are mostly undocumented and can have major changes from version to version) are very rare. And requires at least some basic knowledge of how databases and operating systems work internally. -
How to find real owner.table.column in a view
This seems pretty easy but I haven't been able to locate a way using the dba_views or all_views to pinpoint the exact owner.table.column that a given view column is based on.
I can retrieve the text of the view from dba_views, but I don't see something like all_tab_columns that has a second set of owner, table and column_name columns to show what the underlying column in a view is.
e.g. create me.view zz as select a.acp,b.acno from tom.tab1 a, fred.tab2 b where a.key = b.key
desc me.zz
acp varchar2(4)
acno number
Now I would like to select something like the following from all_tab_columns:
select column_name,orig_owner, orig_table, orig_column from all_tab_columns where owner = 'ME' and table_name = 'ZZ'
acp tom tab1 acp
acno fred tab2 acno
Does such a view exist to extract this information?Robert,
By hosed do you mean there is no way to get this information from an Oracle view? I'm not sure what you mean by sys.all_views.owner, that just tells the owner of the view itself, not the owner.table.column of each column in the view. If the view is all based on a single table then obviously I can figure out the information, but many/most views join several tables, even from different schemas.
What I am looking for is the equivalent of all_view_columns which has view column information as well as the base table owner.table.column. -quinn -
Move Table Column with AppleScript in Microsoft Word
Microsoft Word has a flaw (in my opinion) with tables in that it aligns the left and right text with the margins rather than aligning the table columns with the margins. This results in sloppy tables, because the left and right borderlines lie outside the margins.
I would like to fix the word tables by
calculating the left cell padding and right cell padding in points and setting them to variables {left_pad,right_pad} respectively
move left column by left_pad to the right
move right column by right_pad to the left
The script I was working on does not work, but I will post it to show my thought process as I hone in on my solution.
tell application "Microsoft Word"
--595 points is width of A4 paper
-- Set page margin in points to variables
set {l_margin, r_margin, t_margin, b_margin} to {(get left margin of page setup of active document), get (right margin of page setup of active document), get (top margin of page setup of active document), get (bottom margin of page setup of active document)}
get {l_margin, r_margin, t_margin, b_margin}
-- Set specific Paragraph margins
-- NOTE: If you select a table thinking you wish to drag just the left margin to the right, or the right margin to the left, this code does not accomplish this because each cell has its own paragraph formatting. This code will set the margin for every single cell, because each cell has its own margins! (separate from padding).
set para_sel to paragraph format of selection
set paragraph format left indent of para_sel to (centimeters to points centimeters 0.5)
-- Aligning left and right columns of table with the margins
-- NOTE: There is a command to set left row indent, but not right row indent (very stupid of Microsoft)
end tellI have worked up something that seems to work (although I cannot promise it is the best way). Hope it helps anyone else who has this need.
tell application "Microsoft Word"
activate
set findRange to find object of selection
clear formatting findRange -- clear any previous formatting used in a find operation
set forward of findRange to true -- find forward
set style of findRange to "List Bullet" -- the style to look for
tell findRange
set gotIt to execute find find text "" -- do the search w/o matching any text
end tell
if gotIt is true then -- if a match was found
copy object selection -- copy it to the clipboard
set mySelection to (the clipboard) -- then put clipboard into a variable
set myOffset to ¬
(get selection information selection information type ¬
(horizontal position relative to page)) -- now put selection info into a variable
display dialog mySelection & return & (myOffset as text) -- then display it
end if
end tell
Maybe you are looking for
-
What size SSD? Swapping Optical Drive for gen. storage.
I'm planning on buying a smaller SSD and was looking for suggestions on the best size to buy. I have a 13" Late 2011 Macbook Pro, i5. 8gb RAM. 500gb HDD. What I'm doing is replacing my 500gb HDD and moving that to my optical bay just for general stor
-
How do you save and email an edited photo in iPhoto 08?
I've been using 08 since the beginning with no problems. I want to mail an edited photo but when I try the process fails. A normal photo mails fine, but there is no "save as" option with non-destructive editing. Surely there is a work-around.
-
SCEP manager is not showing current logs for any SCEP clients
I have installed SCEP manager on one machine and it is managing one client, which is on another machine. Client is showing virus detected logs in SCEP client UI, but the same events/logs are not getting stored in SCEP manager database, i tried pullin
-
Cat hit random keys on keyboard
I have a 2007 iMac running an up-to-date version of snow leopard. This evening, my cat ran across my keyboard, hitting who knows what keys. Now my iMac behaves as if it perpetually zoomed in. Control '0' does not work, and neither does control 'Z'. A
-
CAPTURING VIDEO AND AUDIO FROM THE DESKTOP
I AM USING A PAVILION DV 7-6163 WINDOWS 7 OS. WHEN I CAPTURE VIDEO OF MY DESKTOP, I ALSO CAPTURE ANY NOISE MY MICROPHONE PICKS UP. A COUGH OR SNEEZ. HOW DO I PREVENT THIS? THANK YOU, This question was solved. View Solution.