Declaring a text field in ztable
dear all,
iam trying to declare a text field for inserting comments in a ztable. first iam declaring it in a code and updating it in to a ztable through program. this text field is given in alv as edit mode than tere some text is maintained in output(i.e in editable alv) than user when clicks save than total records r updated to ztable.
my problem is that this text field is taking only 5 to 6 letters as input.
With regards,
Prasadbabu.
Hi,
While building a fieldcatalogue for output table set the parameter OUTPUTLEN of fielcatalogue equal to the lenghth of the number of characters u want to enter.This will allow u to enter as much characters u want.
i_fieldcat TYPE STANDARD TABLE OF lvc_s_fcat,
wa_fieldcat LIKE LINE OF i_fieldcat.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
Hope this Helps!!!!!!!!
Edited by Tejaswini Khante
Similar Messages
-
Adding user-defined number of text fields.
Okay I am having problems, obviously. I am developing a program where the user will enter X and Y values and the program will calculate the relational data. However, I can't even get a start.
First of all, the user defines the number of pairs of points they want to define. For example, they have 20 points, each with its own X and Y, so they click on 20 and then okay in the first window.
The next window will then take their answer and display X and Y text fields for as many points as they defined. However, I can't figure out any way to do this.
Feel free to run the program, the problem lies in the method setTextFields(). Help please!
import javax.swing.*; //FOR SWING COMPONENT CLASSES
import java.awt.*; //FOR CONTAINER CLASS
import java.awt.event.*; //FOR EVENT HANDLING
public class RegressInput extends JFrame
private JComboBox listJComboBox; //COMBO BOX TO HOLD HOW MANY PAIRS OF DATA POINTS THE USER HAS TO ENTER
private JButton answerButton; //BUTTON TO CLICK AFTER SELECTING PAIRS OF DATA POINTS
private JPanel textFieldTopPanel; //TEXT FIELD TOP PANEL
private JPanel textFieldBottomPanel; //TEXT FIELD BOTTOM PANEL
private JPanel textFieldPanel; //TEXT FIELD PANEL
private CardLayout cardSelector; //DECLARE CARD LAYOUT OBJECT
private JPanel cardDeck; //DECLARE CARD PANEL OBJECT
public RegressInput(String title)
super(title); //CALL SUPERCLASS CONSTRUCTOR
//CREATE A CONTAINER
Container container = getContentPane();
//INSTANTIATE CARD LAYOUT OBJECT
cardSelector = new CardLayout();
//INSTANTIATE PANEL OBJECT
cardDeck = new JPanel();
//SET LAYOUT OF CARD DECK PANEL TO CARD LAYOUT
cardDeck.setLayout(cardSelector);
//DEFINE LABEL FOR FIRST CARD
Label question = new Label("How many PAIRS of data would you like to enter?");
//BUTTON TO SUBMIT NUMBER OF POINTS TO PLOT
answerButton = new JButton("OK");
listJComboBox = new JComboBox( getArray() );//USE getArray() METHOD TO SET ITEM LIST OF THE COMBO BOX
listJComboBox.setMaximumRowCount(10); //SETS THE VISIBLE NUMBER OF ITEMS TO THE USER
Label xValues = new Label("X Values"); //LABEL FOR X values
Label yValues = new Label("Y Values"); //LABEL FOR Y values
//BUILD CARD DECK
JPanel comboBoxCard = new JPanel(); //CREATE FIRST CARD
comboBoxCard.add(question); //ADD question LABEL TO FIRST CARD
comboBoxCard.add(listJComboBox); //ADD listJComboBox TO FIRST CARD
comboBoxCard.add(answerButton); //ADD answerButton TO FIRST CARD
textFieldTopPanel = new JPanel(); //CREATE TOP PANEL OF SECOND CARD
textFieldTopPanel.add(xValues); //ADD xValues Label TO SECOND CARD
textFieldTopPanel.add(yValues); //ADD yValues Label TO SECOND CARD
textFieldBottomPanel = new JPanel(); //CREATE BOTTOM PANEL OF SECOND CARD
textFieldBottomPanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,10)); //SET LAYOUT FOR BOTTOM PANEL
textFieldPanel = new JPanel(); //CREATE PANEL FOR SECOND CARD
textFieldPanel.setLayout(new BorderLayout(10, 10)); //SET LAYOUT FOR SECOND CARD
textFieldPanel.add(textFieldTopPanel, "North"); //ADD textFieldTopPanel TO NORTH
textFieldPanel.add(textFieldBottomPanel, "South"); //ADD textFieldBottomPanel TO SOUTH
cardDeck.add(comboBoxCard, "Step 1"); //ADD FIRST CARD TO DECK
cardDeck.add(textFieldPanel, "Step 2"); //ADD SECOND CARD TO DECK
container.add(cardDeck); //ADD CARD DECK TO CONTAINER
//DEFINE BUTTON HANDLER OBJECT
ButtonHandler buttonHandler = new ButtonHandler();
//ADD ACTION LISTENER FOR BUTTONS
answerButton.addActionListener(new ButtonHandler());
}//END RegressInput() CONSTRUCTOR
//METHOD TO CREATE AND RETURN AN ARRAY OF VALUES FOR JComboBox
private String[] getArray()
//CREATE ARRAY TO HOLD 30 VALUES
int numbers[] = new int[29];
//CREATE int IN ORDER TO START THE ARRAY AT 2 INSTEAD OF 1
int number = 2;
//ASSIGN VALUES FROM 2 TO 30 TO numbers[] ARRAY
for(int count=0; count < 29; ++count)
numbers[count] = number; //SETS EACH INDEX TO number
number++; //INCREMENTS number
}//END for LOOP
//CREATE pairs[] ARRAY TO HOLD 30 STRINGS
String pairs[] = new String[29];
//ASSIGN VALUES 1 TO 30 IN STRING ARRAY FOR COMBO BOX
for(int count = 0; count < 29; ++count)
pairs[count] = "" + numbers[count];
}//END for LOOP
return pairs;//RETURNS pairs[] ARRAY FOR THE LIST ITEMS IN listJComboBox
}//END getArray() METHOD8
//RETURNS THE ITEM SELECTED BY THE USER FROM THE JComboBox
private int getValue()
//ASSIGNS STRING VALUE OF THE JComboBox TO A WRAPPER
Integer v = new Integer((String) listJComboBox.getSelectedItem());
//ASSIGNS WRAPPER VALUE TO int
int value = v.intValue();
//RETURN VALUE OF SELECTED ITEM
return value;
}//END getValue()
private void setTextFields()
{//HERE LIES THE PROBLEM! WHAT GOES IN THIS METHOD????
for(int count = 0; count < (2 * getValue()); ++count)
}//END setTextFields()
//BUTTON EVENT HANDLER CLASS
private class ButtonHandler implements ActionListener
//PROCESS EVENT
public void actionPerformed(ActionEvent e)
//WHICH BUTTON CAUSED THE EVENT?
if(e.getSource() == answerButton)
cardSelector.last(cardDeck);
cardDeck.setSize(600,600);
}//END if STATEMENT
}//END actionPerformed()
}//END ButtonHandler CLASS
}//END RegressInput CLASSHere is main:
import javax.swing.JFrame;
public class TestSharpStats
public static void main(String[] args)
//DEFINE FRAME OBJECT
RegressInput window = new RegressInput("Hi"); //SETS TITLE BAR
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //CLOSES WINDOW
window.setSize(400, 600); //SET FRAME SIZE
window.setResizable(true); //PREVENTS USER FROM RESIZING WINDOW
window.setVisible(true); //SETS window TO VISIBLE
}//END main()
}//END TestSharpStats CLASSmuit-post: http://forum.java.sun.com/thread.jspa?messageID=4442652
-
How does APEX check for null values in Text Fields on the forms?
Hello all,
How does APEX check for null values in Text Fields on the forms? This might sound trivial but I have a problem with a PL/SQL Validation that I have written.
I have one select list (P108_CLUSTER_ID) and one Text field (P108_PRIVATE_IP). I made P108_CLUSTER_ID to return null value when nothing is selected and assumed P108_PRIVATE_IP to return null value too when nothign is entered in the text field.
All that I need is to validate if P108_PRIVATE_IP is entered when a P108_CLUSTER_ID is selected. i.e it is mandatory to enter Private IP when a cluster is seelcted and following is my Pl/SQL code
Declare
v_valid boolean;
Begin
IF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NULL THEN
v_valid := TRUE;
ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NOT NULL THEN
v_valid := TRUE;
ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NULL THEN
v_valid := FALSE;
ELSIF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NOT NULL THEN
v_valid := FALSE;
END IF;
return v_valid;
END;
My problem is it is returning FALSE for all the cases.It works fine in SQL Command though..When I tried to Debug and use Firebug, I found that Text fields are not stored a null by default but as empty strings "" . Now I tried modifying my PL/SQL to check Private_IP against an empty string. But doesn't help. Can someone please tell me how I need to proceed.
ThanksSee SQL report for LIKE SEARCH I have just explained how Select list return value works..
Cheers,
Hari -
Query a view w/data entered into a text field populated by 2 table fields
Hello, Looking for advise!!! I have a tabular canvas thats datablock uses a view to populate. In this canvas I have a text field that has been populated with first_name || ' ' || last_name in the database node of the property pallate column name. The text field is not in the table or view. I have created it in the data block and make it a database item. However, I would like to have the user push a search button to go into ENTER_QUERY mode then the user would enter the criteria to search on in this text field. The user would then push button to EXECUTE_QUERY. The result is I retrieve all records. I want any search criteria entered into this field to be used against the last_name field to retrieve any records equal to the search criteria entered, for example A%. Does anyone know if this is possible?
Hi!
You have to use PRE-QUERY trigger to compose the search criteria. Below I put an example of it. You have to have at least one item in the block wich is true database item (e.g. it has to exist in table or view on which your block is based). In the following example EMP_DESC is your non-database search item and EMP_ID is the database one.
Declare
Dummy VARCHAR2 (2000);
begin
if :EMP.EMP_DESC IS NOT NULL and :EMP.EMP_ID IS NULL
then
Dummy := '#IN (SELECT emp_id FROM Employees WHERE Upper (emp_first_name)||'' ''||Upper (emp_sec_name) LIKE Upper (''%'||:EMP.EMP_DESC||'%''))';
Copy (Dummy, 'EMP.EMP_ID');
end if;
end;
Thats it. Note the # sign in the first position of the Dummy assignment. This is required by forms to glue your search criteria and block's where clause. You may analize LAST_QUERY property of your block in order to understand how this work. Remember also to set the QUERY_LENGTH property of the EMP_DESC item to the value that could contain the whole Dummy string (otherwise it will give you an error and cut the mar the query).
Hope this helps.
Sergey.
P.S. And set your EMP_DESC database item property to NO. -
How to display the return value of a function in a text field
Hi,
I have 2 textfields in a page.
i> Empno
ii> Salary
The requirement is,
i. Enter an Employee No.
ii. On click of the 'SUBMIT' button a process would be executed which calls a function (or procedure with out parameter) which returns the Salary of the given Employee.
iii. Need to display the salary to the 2nd textfield (Salary).
Here is my process:
i. If procedure call-- :P2_X is a page text field and out parameter.
begin
Pri_test_PROC(:P2_EMPNO,:P2_X);
end;ii. If Function call --
begin
:P2_X:=Pri_test_PROC(:P2_EMPNO);
end;
Issue:
The process is not getting executed and returning the process error message.
Could anyone please give me a pointer, how to overcome the issue. Or if this is not the right way, then what is the work around.
Regards
AntaraAntara,
1. Clue about the error - yes, when I see the error message.
2. What happens if you try to create a procedure like this:
CREATE OR REPLACE PROCEDURE fetch_sal (in_emp IN NUMBER, out_sal OUT NUMBER)
IS
BEGIN
FOR c IN (SELECT sal
FROM emp
WHERE empno = in_emp)
LOOP
out_sal := c.sal;
END LOOP;
END;and then run this in SQL Plus:
DECLARE
v_sal VARCHAR2 (20);
BEGIN
fetch_sal (7839, v_sal);
DBMS_OUTPUT.put_line (v_sal);
END;What do you get displayed?
Denes Kubicek
http://deneskubicek.blogspot.com/
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Button Setting Variable - Text Field Not Updating
Hi,
I am working with Acrobat 9 Pro on Windows.
I am unable to make the following work: When the user clicks a Button, a Text Field appears with the text associated with the Button clicked. I have tried accomplishing this with a variable declared in the Document JavaScripts, buttons setting the value of the variable, and a Text Field containing a Custom Calculation Script that returns the text associated with the value of the variable.
Everything works - except the Text Field doesn't return the text associated with the value of the variable. I have an app.alert (for now) in the button scripts so I can see if the variable has the correct value - and it does - but when the Text Field appears - the text never changes.
What I have observed: if I go back into the Custom Calculation Script of the Text Field and do nothing, go back out, go to Preview, and click on a Button, the text updates to the previous variable value (not the Button variable value I just clicked).
So - I think - the Custom Calculation Script isn't seeing the new variable "on the fly". Even though the app.alerts are. I don't think this is a Field Calculation Order problem. But maybe it is. And this is where my brain power ends. Any suggestions would be greatly appreciated. Thank you.
I have this in the Document JavaScripts:
var ITrig = 1;
I have three Buttons (want to have more) that will set the ITrig variable.
Here is what I have in one Button:
var Inpopup = this.getField("PartASectionIIInstructions")
ITrig = 2;
app.alert(ITrig);
if (Inpopup.display == display.hidden) {
Inpopup.display = display.visible
Inpopup.setFocus();
} else {
Inpopup.display = display.hidden;
I have this in the PartASectionIIInstructions Text Field in the Custom Calculation Script:
if (ITrig == 2) {
event.value = "#2";
else if (ITrig == 3) {
event.value = "#3";
else if (ITrig == 4) {
event.value = "#4";Thank you. I had tried something like that earlier - without success. That is why I went to the calculation script. So - I went back to the "Acrobat Forms - JavaScript Object Specification" looking for an answer. It finally sunk in I was guilty of this:
var Inpopup = this.getField("PartASectionIIInstructions").value
Inpopup = "#3"
When I should have been doing this:
var Inpopup = this.getField("PartASectionIIInstructions")
Inpopup.value = "#3" -
Populating text field with pl/sql expression or function
Hi all,
I have a function which return an object.
create or replace type emp2_oty is object (server_name varchar2(20),
status varchar2(4),
refresh_on date,
dw_refresh date)
create or replace type emp2_nt is table of emp2_oty
create or replace function testserver12 return emp2_nt
is
v_emp2_nt emp2_nt:=emp2_nt();
a number;
b number;
c number;
begin
for r_emp in (select * from testing)
loop
a := extract(DAY FROM r_emp.dw_refresh);
c := extract(DAY FROM r_emp.refresh_on);
b := extract(DAY FROM SYSDATE);
if (a != b) or (c != b) or (r_emp.status != 'on') then
v_emp2_nt.extend; v_emp2_nt(v_emp2_nt.last):=emp2_oty(r_emp.server_name,r_emp.status,r_emp.refresh_on,r_emp.dw_refresh);
end if;
end loop;
return v_emp2_nt;
end testserver12;
The pl/sql code to get the return value displayed. It works very fine in sqlworkshop.
declare
v_temp_nt emp2_nt;
i number := 1;
begin
v_temp_nt:= testserver12();
for i in (v_temp_nt.first)..(v_temp_nt.last) loop
dbms_output.put_line(v_temp_nt(i).server_name||' '||v_temp_nt(i).status||' '||v_temp_nt(i).refresh_on ||' '||v_temp_nt(i).dw_refresh);
end loop;
end;
I want it to get display the output into the text field.
Please could any one help me to achieve this.
Thanks in advance
bye
SrikaviPretty easy, add a CHR(10) (ASCII for carriage return) in the string concatenation.
e.g.
l_result:= l_result || (v_temp_nt(i).server_name || ' ' ||
v_temp_nt(i).status || ' ' ||
v_temp_nt(i).refresh_on ||' ' ||
v_temp_nt(i).dw_refresh) || CHR(10);Also why over complicate the whole process by using objects and types by simplifying the code and also improving readability and maintenance by replacing the PL/SQL function body with something similar to (the conditions have been negated and may have not been what you meant in the first place)
DECLARE
v_text_return VARCHAR2(2000);
l_cur CURSOR IS
SELECT t.server_name,
t.status,
t.refresh_on,
t.dw_refresh
FROM testing t
WHERE To_Char(t.refresh_on, 'DD') = To_Char(SYSDATE, 'DD')
AND To_Char(t.dw_refresh, 'DD') = To_Char(SYSDATE, 'DD')
AND Upper(t.status) = 'ON');
BEGIN
FOR r_emp in l_cur
LOOP
v_text_return := v_text_return || r_emp.server_name || ' ' ||
r_emp.status || ' ' ||
r_emp.refresh_on || ' ' ||
r_emp.dw_refresh || CHR(10);
END LOOP;
RETURN v_text_return;
END;Hope this helps -
Hi,
I want to load a string of characters to a text field of a table. I'm using SQL Loader.
I've tried to declare the field in several types: varchar2(4000), clob, raw, etc, but when I run sql loader to load the text I get the same error: The data file exceeds maximum lenght. I've tried with a shorter text and it works.
My question is, why I can't load long characters in that field?
Thanks in advance.
Regards.Although you have made your table column up to size 4000, SQLLoader have not got a clue about that. You still need to tell SQLLoader that the text coming in is more than the default 255 in your control file. Strange isn't it?
Here is my table named testlog. Note that I changed the column names LOG, DAY, TIME and TYPE because they are reserved Words
SQL> CREATE TABLE TESTLOG
2 (LOG_1 CHAR(3) NOT NULL,
3 DAY_1 DATE,
4 TIME_1 CHAR(8),
5 SOURCE VARCHAR2(100),
6 EVENTID NUMBER(22),
7 TYPE_1 VARCHAR2(64),
8 CATEGORY VARCHAR2(64),
9 USER0 VARCHAR2(64),
10 COMPUTER VARCHAR2(64),
11 MESSAGE VARCHAR2(4000) NOT NULL)
12 /
Table created.
SQL> desc testlog
Name Null? Type
LOG_1 NOT NULL CHAR(3)
DAY_1 DATE
TIME_1 CHAR(8)
SOURCE VARCHAR2(100)
EVENTID NUMBER(22)
TYPE_1 VARCHAR2(64)
CATEGORY VARCHAR2(64)
USER0 VARCHAR2(64)
COMPUTER VARCHAR2(64)
MESSAGE NOT NULL VARCHAR2(4000)
SQL> select * from testlog;
no rows selected
SQL>
I saved the same data you have abvoe in a file named testlog.txt Here is my test controlfile named testlog.ctl
LOAD DATA
INFILE 'testlog.txt'
INTO TABLE testlog
FIELDS TERMINATED BY ','
TRAILING NULLCOLS
LOG_1 CHAR NULLIF (LOG_1=BLANKS)
, DAY_1 DATE "DD/MM/YYYY" NULLIF (DAY_1=BLANKS)
, TIME_1 CHAR NULLIF (TIME_1=BLANKS)
, SOURCE CHAR NULLIF (SOURCE=BLANKS)
, EVENTID INTEGER EXTERNAL NULLIF (EVENTID=BLANKS)
, TYPE_1 CHAR NULLIF (TYPE_1=BLANKS)
, CATEGORY CHAR NULLIF (CATEGORY=BLANKS)
, USER0 CHAR NULLIF (USER0=BLANKS)
, COMPUTER CHAR NULLIF (COMPUTER=BLANKS)
, MESSAGE CHAR(4000) NULLIF (MESSAGE=BLANKS)
Here is the Result of my test run
D:\DBMSDIRECT\DBA\Test>sqlldr userid=test control=testlog.ctl
Password:
SQL*Loader: Release 11.1.0.6.0 - Production on Fri Nov 5 15:36:05 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Commit point reached - logical record count 1
D:\DBMSDIRECT\DBA\Test>
Here is the Result in the table
SQL> col message format a50
SQL> col source format a50
SQL> col category format a10
SQL> col source format a10
SQL> col user0 format a10
SQL> col type_1 format a10
SQL> col computer format a10
SQL> set pasge 20
SQL> select * from testlog;
LOG DAY_1 TIME_1 SOURCE EVENTID TYPE_1 CATEGORY USER0 COMPUTER MESSAGE
SEC 04-NOV-10 12:26:02 Microsoft- 4656 Success 12800 server1.it A handle to an object was requested.^`^`Subject:^`
Windows-Se acasa-sa.c Security ID: S-1-5-21-3830471607-3036766313-42914
curity-Aud om 15205-2156^` Account Name: mbelles^` Account Domai
iting n: ITACASA-SA^` Logon ID: 0x38988bbc^`^`Object:^`
Object Server: Security^` Object Type: File^` Obje
ct Name: K:\AMBIENTE^` Handle ID: 0x1e18^`^`Proces
s Information:^` Process ID: 0x4^` Process Name: ^
`^`Access Request Information:^` Transaction ID: {
00000000-0000-0000-0000-000000000000}^` Accesses:
%%4416^` ^` Access Mask: 0x1^` Privileges Used for
Access Check: -^` Restricted SID Count: 0
1 row selected.
SQL> -
Text Field with multiple lines
I am trying to create a text field in the selection screen where it can insert a text with multiple lines for instance those text fields which you can see online where you can key in text lines after lines.
How do you do that in ABAP?Hi
See any Std program code for CREATING long Text lines
See any application document HEADER or ITEM text and copy that code
first declare a field with some table field
like
PARAMETERS: p_text like Tline-tdname.
then keep a button (for Long text) and in the program write a code such that when you press on that line it will take you to text ediotr
using the CREATE_TEXT fun module
copy it from a std program text..
<b>Reward points for useful Answers</b>
Regards
Anji -
How to set "Display as Text" field with AJAX select list
thanks Denes for your posting. I'm trying to use the Denes Kubicek code to populate a "Display as Text" field. It works for Text Field (disabled), but not "Display as Text" field(saves state) . In my applciation I need to show this field only (not the disabled text box) when a select list value is changed. any ideas to modify the code below are appreciated.
http://htmldb.oracle.com/pls/otn/f?p=31517:80:3418128396960418::NO
here is the code from the url above
1. Create an Application Process - getDet:
DECLARE
my_det VARCHAR2 (200);
BEGIN
SELECT ename || CHR(10) || job || CHR(10) || mgr
INTO my_det
FROM emp
WHERE empno = :P80_EMPLOYEES;
HTP.prn (my_det);
END;
2. Put the following in the Region Header of your page:
<script language="JavaScript" type="text/javascript">
function f_getDet ()
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getDet',0);
get.add('P80_EMPLOYEES',html_GetElement('P80_EMPLOYEES').value)
gReturn = get.get();
if(gReturn)
{ html_GetElement('P80_DETAILS').value = gReturn }
else
{ html_GetElement('P80_DETAILS').value = 'null' }
get = null;
</script>
3. Put the following in the HTML Form Element Attributes of :P80_EMPLOYEES:
onChange="f_getDet()";Arie,
this works fine on normal page, except page zero. I have the AJAX select list and "Display as Text" field on page zero. The "Display as Text" field doesn't show the the value when AJAX select is changed. I'm using similar code as used in my other APEX page on OTN site. I tired to display the gReturn value, just before calling "setDisplayOnlyNode" function in the code below and it's showing correct value, but fails to display the value in the APEX field on page zero. Any ideas are appreciated.
Thanks,
Surya
<script language="JavaScript" type="text/javascript">
function setDisplayOnlyNode(pItem, pValue)
{ var textNode = pItem + '_DISPLAY'; $x(textNode).innerText = pValue; }
function f_getDet ()
var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=getDet',0);
get.add('P1_EMPLOYEES',html_GetElement('P1_EMPLOYEES').value)
gReturn = get.get();
if(gReturn)
{ setDisplayOnlyNode('P1_DETAILS',gReturn)}
{ html_GetElement('P1_TEST').value = gReturn }
get = null;
</script> -
We have a Text field which saves Xml data (not too big, 20 to 40 lines usually), in one of the stored procedures, we are receiving the Xml, which needs to be either inserted or updated based on whether that record already exists in table or not. We are doing
that match based on other non-xml fields but in one case we don't have any other option but to compare xml, so here is my question.
What's the most performance efficient way to compare Xml (which is passed as input parameter to SP as Text) to the one already saved in Table as Text? We are running Sql 2005.
Thanks
SyedHi Syed_Sajid,
Regarding your description, are you looking for approach to compare xml structured TEXT fields? If so, you can reference the below sample.
DECLARE @Tab TABLE(id INT, content TEXT)
INSERT INTO @Tab SELECT 1,'<catalog>
<book>
<author>Gambardella, Matthew</author>
<title>XML Developer''s Guide</title>
<genre>Computer</genre>
<price>44.95</price>
<publish_date>2000-10-01</publish_date>
<description>An in-depth look at creating applications
with XML.</description>
</book>
</catalog>'
DECLARE @XML1 XML,@XML2 XML;
SELECT @XML2= content FROM @Tab WHERE id=1
SET @XML1 = '<catalog><book>
<author>Corets, Eva</author>
<title>Maeve Ascendant</title>
<genre>Fantasy</genre>
<price>5.95</price>
<publish_date>2000-11-17</publish_date>
<description>After the collapse of a nanotechnology
society in England, the young survivors lay the
foundation for a new society.</description>
<extra>a</extra>
</book>
</catalog>'
;WITH XML1 AS
SELECT T.N.value('local-name(.)', 'nvarchar(max)') AS NodeName,
T.N.value('.', 'nvarchar(max)') AS Value
FROM @XML1.nodes('/catalog/book/*') AS T(N)
XML2 AS
SELECT T.N.value('local-name(.)', 'nvarchar(max)') AS NodeName,
T.N.value('.', 'nvarchar(max)') AS Value
FROM @XML2.nodes('/catalog/book/*') AS T(N)
SELECT ISNULL(XML1.NodeName, XML2.NodeName) AS NodeName,
XML1.Value AS Value1,
XML2.Value AS Value2
FROM XML1
FULL outer join XML2
ON XML1.NodeName = XML2.NodeName
WHERE ISNULL(XML1.Value, '') <> ISNULL(XML2.Value, '')
The different nodes between two xmls will be listed in the result above.
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support -
Populating Multirecord text fields from Tlists value's combinations
I have a UI wherein there are two T lists, one on the Left and other on the Right. The left one contains
From values and the Right one contains To values. There's one Button which when Pressed should populate
a Data Block which has multi record text fields just below the button with all the possible combinations of
the T lists elements. The Text fields have the values From, To, Time, Unit. When populated From and Two will
get the values from the combinations and the user will enter the values in other fields i.e. Time and Unit,
Then the user can save the Records.
e.g. If the Left T list contains Red, Blue and the Right T List contains Green, Black. Then on pressing
the button below the T lists, the text fields From and Two of a data block displayed in the same window
should get populated with all the possible combinations as:
From || To || Unit || Time
Red Green
Red Black
Blue Green
Blue Black
Now the user can enter the values for Unit as well as Time and when he does save the Records should be inserted
for the Data Blocks DML Source that's some table.
What I'm trying is:
On pressing the Button i'm writing code that will have Two PL/SQL Tables(Index by binary_integer). One will have
all the values of the left T List and the other with all the values of right T List.
I do it as in the WHEN BUTTON PRESSED as:
DECLARE
TYPE varchar_table IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
from varchar_table;
to varchar_table;
v_count1 NUMBER;
v_count2 NUMBER;
v_count3 NUMBER;
v_count4 NUMBER;
BEGIN
v_count1 := Get_List_Element_Count('CONTROL.FROM_TYPE');
FOR i IN 1..v_count1 LOOP
from(i) := Get_List_Element_Value('CONTROL.FROM_TYPE', i);
END LOOP;
v_count2 := Get_List_Element_Count('CONTROL.TO_TYPE');
FOR i IN 1..v_count2 LOOP
to(i) := Get_List_Element_Value('CONTROL.TO_TYPE', i);
END LOOP;
END;
Now how will I populate the text fields with the values in the tables that i got with the piece of code above.
Any help would be appreciated. Any other method other than the one i'm trying is also welcome. Please note that
i'm not using any table to store the elements in the T Lists. The lists get values at runtime by
user's selection.
Thanks,
Abhishek.Try and stay civil in your postings. The solotion should be to simply issue a GO_BLOCK, followed by a CREATE_RECORD followed by setting the approriate values :block.value = <value from list>
-
Disallow non digit input in a text field?
Is there a class method in Java SDK to do this easily like in Visual Basic or has it to be coded completely manually?
If the user presses a non digit character then that character should not be printed into the text field.K this is easy!
I have a class:
import java.awt.event.*;
public class AlphaNumConsumer extends KeyAdapter
//this class is used to consume any alpha letters
public void keyTyped(KeyEvent ent)
char ch = ent.getKeyChar();
if('0' < ch && ch > '9')
ent.consume();
and all you do when you declare the textfield anywhere else you do the following:
JTextField field = new JTextField();
AlphaNumConsumer kCon = new AlphaNumConsumer();
field.addKeyListener(kCon);
this will consume and Alpha numeric characters!
Gluck!! -
Regarding fieldcatalog to store a text field
Hi friends,
I want to store a text field in field catalog .so that it won't effect in field catalog . when if loop at fieldcatalog depending on that value i need to perform.
regarding
anilyu can use this variable s_fieldcatalog-reptext_ddic = 'Sche qty'. for example to give your own text .Declare it in it_ekpo
and use accordingly.
s_fieldcatalog-col_pos = '9'.
s_fieldcatalog-fieldname = 'MENGE'.
s_fieldcatalog-reptext_ddic = 'Sche qty'.
s_fieldcatalog-tabname = 'lT_EKPO'.
s_fieldcatalog-rollname = 'MENGE'.
APPEND s_fieldcatalog TO t_fieldcatalog.
CLEAR: s_fieldcatalog. -
Hi all,
I am a bit confused here. In my page I have three text boxes, they are - P10_YEAR, P10_MONTH, P10_TOTAL. I am using LOV for year and months field. LOV is like for year 2000;2000, 2001;2001 and for month June;June,July;July and so on. Month field is set to textbox with submit.
So I want to retrieve the data in the P10_TOTAL when user select the month. Interestingly it always return 0 but it should be more than that. I have set the Source for P10_TOTAL as PL/SQL Expression *0=( SELECT count(*) from rtv_metro_count where record_month=:P10_month);* but it does not work. However it does work in toad and sql query. I have tried to change the expression to SQL query but did not work either.
Is there any other way, I can do this task, retrieve data from table in a specific text field? Please provide your suggestions.
Thanks in advanced.
TajuddinCreate a page process - on Submit using the following code:
DECLARE
v_count NUMBER;
BEGIN
SELECT COUNT (*)
INTO v_count
FROM rtv_metro_count
WHERE record_month = :p10_month;
:p10_total := v_count;
END;
and remove the pages source by setting it to static assignement - only when current value in session state is null.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
Maybe you are looking for
-
Looking for a specific title...
Hi, I have been scouring the usual plug-in sources for iMovie looking for a specific kind of title. Since I have not found it, I thought I would describe it here to see if anyone knows if it exists or where I can get it. I am looking for a title whic
-
External HPw20 monitor & maverick
Using Maverick, my HPw20 display is not permitted to use its optimal resolution of 1680 x 1050. It's either 1600 x 1200 or 1400 x 1050. The result is awkward, squashed images. Please advise fix for this. BTW, I cannot use my DVI-D cable with Maverick
-
Hi, maybe you guys can help me with a similar problem. I'm on the o2 uk network, and have a BB Curve 9630 (I think lol, can't check as I'm using it to write this) my problem is my phone is letting me acess the net, send receive emails and use bbm, bu
-
Manipulating data between 2 tables
Hi Everyone, Scenario: Having two tables displayed and being able to add a row of data from table 'A' to table 'B' and also be able to remove a row of data from table 'B'. (similar to out of the box UME functionality in adding/removing roles to a us
-
Hi Gurus, I am currently undergoing the 11g upgrade for my client and we are using ebMS messaging, the setup is very simple. I am using the default b2b.jar file. I added in a callout and specified the absolute path for the callout but it fails. I hav