Retrive Multiple Records Into A database Block
hi, all
i would like to know if there is any document or references wich illustrait the way of retriving Multi records from a procedure built on database side into a database block using form 6i ??
My Problem is : i create a procedure in the database which retrive a multiple records and the variable from procedure (out) are the same value from Form side (in). but it always fetch the whole records at the same record position in the block as the cursor raised on . i found a way explian how to mintain a set or record using a record type and create a table of that record type , but still don't' know how deal calling the procedure from the form side .
Any advice of this issue will be greatfull and if sample of code provided will be better
Thanks in Advance
Regards
Omar
You can try something like this:
PROCEDURE POPULATE_BLOCK IS
cursor c1 is
SELECT <your column names>
FROM <your table name>
where <your where condition>
BEGIN
open c1;
go_block('<your block name');
first_record;
loop
fetch c1 into
:<your block name>.<your column name 1>,
:<your block name>.<your column name 2>,
etc,etc
exit when c1%NOTFOUND;
next_record;
end loop;
close c1;
first_record;
END;
so your code might actually look something like this:
PROCEDURE POPULATE_BLOCK IS
cursor c1 is
SELECT distinct
a.pog_dept
,a.pog_number
,a.pog_level
,a.pog_id
,a.start_date
,a.transmit_date
,a.deactivate_date
,b.pog_description
FROM pog_stores_msi a, pog_master_msi b
where a.pog_dept = :b_main.bi_dept
and a.pog_number = :b_main.bi_pog_number
and a.pog_level = :b_main.bi_pog_level
AND A.POG_ID = :B_MAIN.I_POG_ID
and a.pog_dept = b.pog_dept
and a.pog_number = b.pog_number
and a.pog_id = b.pog_id;
BEGIN
open c1;
go_block('b_main');
first_record;
loop
fetch c1 into
:b_main.bi_dept
,:b_main.bi_pog_number
,:b_main.bi_pog_level
,:b_main.i_pog_id
,:b_main.i_start_date
,:b_main.i_transmit_date
,:b_main.i_deactivate_date
,:b_main.i_pog_desc;
exit when c1%NOTFOUND;
next_record;
end loop;
close c1;
END;
Hope this helps,
NumbNutz
Similar Messages
-
Can you use ESB to insert multiple records into a Database
We have an XML file that has a Parent/Child relationship.
In situation 1 we have a single parent record in the xml file. We can insert the record into the database successfully.
In situation 2 we have a parent and a an associated child record. By using a filter expression to identify the existence of the child record we can route to the first DB Adapter to insert the parent then to the second DB Adapter to insert the child.
Is this final scenario logical and also possible.
Situation 3 we have multiple child records associated to a single parent. So we would first insert the parent record then insert all the child records.
ThanksI use PL/SQL for this if you are using Oracle.
Have a look at this post, it is for AQ but the concept can be used for PL/SQL
Re: Can I pass a pl/sql table as a parameter from a database adaptor
I will send you an example
cheers
James -
Inserting multiple records into a database from a table
I have a dynamic table with rows upto 10. i am trying to insert all the records in these rows into a database ( msaccess)
table name: Table1 ( in my form )
Database table : movies_comments ( as posted in stefan's forums ).
table columns: username, movieid, comments
i am using the following code.
Database.ExecSQL() function is as posted in stefcamerons forums.
var tlength = xfa.resolveNode("form1.#subform[0].Table1.Row1[*]").length;
xfa.host.messageBox("tlength is :" +tlength);
for ( var i = 1; i <= tlength; i++)
var username = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].user_name").rawValue;
var movieID = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].movie_id").rawValue;
var commentS = xfa.resolveNode("form1.#subform[0].Table1.Row1["+i+"].comment_").rawValue;
Database.ExecSQL("INSERT INTO movie_comments (username, movieId, comment) VALUES ('username','movieID', 'commentS');");
i am trying to insert multiple records using the code above. But i am getting error
GeneralError: Operation failed.
XFAObject.resolveNode:1:XFA:form1[0]:#subform[0]:Button1[0]:click
SOM expression returned list when single result was expected
suggest me an alternate way to insert multiple records from a table into a database.
thank Qfigured it out. I changed the ...OR (alternative names = colname) in the recordset to ...OR (alternative names LIKE %colname%). Works like a charm now- the result of a good night's sleep.
-
Entering multiple records into one database
Hi Guys,
I have created a form that repeats the text fields. I want to
record all the entries into an access database. I am trying to use
the SQL Insert Command but I am receiving a mismatch criteria
error. Here is the command:
Command1.CommandText = "INSERT INTO tblWeek (Classdate, Week,
Day, Activity, Location) VALUES ('strDate', 'strWeek', 'strDay',
'strActivity', 'strLocation') "
Any help would be greatly appreciatedIf you have multiple fields with the same name, they pass a
single form
value across that contains a comma delimited list.
You need to pick up this and loop through it to grab each
value.
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver
Valleybiz Internet Design
www.valleybiz.net
"sham!" <[email protected]> wrote in message
news:e4fd6b$a16$[email protected]..
> Hi Guys,
> I have created a form that repeats the text fields. I
want to record all
> the
> entries into an access database. I am trying to use the
SQL Insert Command
> but
> I am receiving a mismatch criteria error. Here is the
command:
> Command1.CommandText = "INSERT INTO tblWeek (Classdate,
Week, Day,
> Activity,
> Location) VALUES ('strDate', 'strWeek', 'strDay',
'strActivity',
> 'strLocation') "
>
> Any help would be greatly appreciated
> -
Inserting multiple records in to database table using webdynpro abap
Hi all,
I have created a username inputfield,a button and a table
with one coloumn.
If i enter names in the input field then the values should be
displayed in that table.
Even i have got the answer i am not able to insert
the values in to database(ztable) table.
i.e. only one value(1st) was inserted the second value was
not inserted ....
so kindly send me the coding to insert multiple records
into the database table......
by,
ranjithhi Ranjith,
If you want to insert multiple records from the webdynpro view table to database table then try the following code.
DATA lo_nd_tablenode TYPE REF TO if_wd_context_node.
DATA lo_el_tablenode TYPE REF TO if_wd_context_element.
DATA ls_tablenode TYPE wd_this->element_tablenode.
DATA it_tablenode LIKE STANDARD TABLE OF ls_tablenode.
navigate from <CONTEXT> to <tablenode> via lead selection
lo_nd_tablenode = wd_context->get_child_node( name = wd_this->wdctx_tablenode ).
get element via lead selection
lo_el_tablenode = lo_nd_tablenode->get_element( ).
get all declared attributes
lo_nd_tablenode->get_static_attributes_table(
IMPORTING
table = it_tablenode ).
MODIFY databasetablename FROM TABLE it_tablenode.
here it_tablenode is the internal table which holds the value from webdynpro view..
Regards,
Shamila. -
Insert multiple records into database through internal table
Hi
please help me how to insert multiple records into database through internal tableHi,
Welcome to SCN.
Press F1 on INSERT statement and you will teh syntax as well the docu for the same. -
Insert multiple rows of records into the database
The codes below allow me to insert a row of record into the database. How would I changed these to insert multiple rows at once? Please help!
String sql = "INSERT INTO EMPLOYEES" +
"(First_Name, Last_Name, Title, Phone) " +
" VALUES " +
PreparedStatement statement = conn.prepareStatement(sql);
statement.setObject (1, First_Name);
statement.setObject (2, Last_Name);
statement.setObject (3, Title);
statement.setObject (4, Phone);
boolean returnValue = statement.execute();Hi mystiqueX,
As wmolosho has suggested in his answer to this very same question that you also posted to the JavaServer Pages forum, you can create a batch of inserts and perform them using the "executeBatch()" method. I will use Craig's sample code to demonstrate:
(Note that this code is untested!)
conn.setAutoCommit(false);
PreparedStatement statement = conn.prepareStatement(sql);
// assume you have an array of objects here
for (int i = 0; i < data.length; i++) {
statement.setString(1, data<i>.getFirstName());
statement.setString(2, data<i>.getLastName());
statement.setString(3, data<i>.getTitle());
statement.setString(4, data<i>.getPhone());
statement.addBatch();
statement.executeBatch();
conn.commit();If you are not familiar with it, allow me to suggest looking at the Making Batch Updates lesson on the Java Tutorial.
Hope it helps.
Good Luck,
Avi. -
Locking multiple records in a database table at a time
Hi Experts,
I have a requirement to lock multiple records in the database table for writing. I have created lock object in SE11. But with this we have only 2 possibilities either lock entire table or lock a single record at a time.
My requirement is, i have table with key field PROJECTID. I want more than one project to be locked, but not the complete table. I dont have any other field in the table to compare.
Thanks in advance..
Regards,
AsrarHi ,
Try with FOR UPDATE in the SELECT sentence.
SELECT FOR UPDATE *
INTO Internal_Table
FROM Table
WHERE Conditions.
UPDATE "Table_name" FROM TABLE Internal_Table.
COMMIT WORK.
This sentence blocks only the records that satisfy of the WHERE conditions (not the entire table) and unlocks after commit work.
Hope this information is help to you.
Regards,
José -
Saving multiple records into text file
Can I save multiple records into a text file at one go?
My application has a list of data displayed there and when the user clicks on the save button it will save all the records on the screen.
It works but it only saves the last record.
Here are my codes
// this is to display the list of data
private JLabel[] subjects=new JLabel[20];
private JLabel[] subTotal=new JLabel[20];
private JLabel[] codes=new JLabel[20];
private JLabel[] getTotal=new JLabel[20];
String moduleCodes;
String getPrice;
double price;
int noOfNotes;
public testapp(Subjects[] subList)
int j=0;
double CalTotal=0;
for (int i=0; i<subList.length; i++)
subjects[i] = new JLabel();
subTotal[i] = new JLabel();
codes=new JLabel();
getTotal[i]=new JLabel();
if (subList[i].isSelected)
System.out.println(i+"is selected");
subjects[i].setText(subList[i].title);
subjects[i].setBounds(30, 140 + (j*30), 400, 40);
subTotal[i].setText("$"+subList[i].price);
subTotal[i].setBounds(430,140+(j*30),100,40);
codes[i].setText(subList[i].code);
getTotal[i].setText(subList[i].price+"");
CalTotal+=subList[i].price;
contain.add(subjects[i]);
contain.add(subTotal[i]);
j++;
moduleCodes=codes[i].getText();
getPrice=getTotal[i].getText();
noOfNotes=1;
// this is where the records are saved
public void readRecords(String moduleCodes,String getPrice,int notes)throws IOException
price=Double.parseDouble(getPrice);
String outputFile = "testing.txt";
FileOutputStream out = new FileOutputStream(outputFile, true);
PrintStream fileOutput = new PrintStream(out);
SalesData[] sales=new SalesData[7];
for(int i=0;i<sales.length ;i++)
sales[i]=new SalesData(moduleCodes,price,notes);
fileOutput.println(sales[i].getRecord());
out.close();I suggest writing a method that takes a SalesData[]
parameter and a filename. Example:
public void writeRecords(SalesData[] data,
String filename) throws IOException
BufferedWriter out = new BufferedWriter(new
FileWriter(filename, true));
for (int i = 0; i < data.length; i++)
out.write(data.getRecord());
out.newLine();
out.close();
And it's good to get in the habit of doing things like closing resources in finally blocks. -
Insert multiple records into Oracle using Java
Hi,
Has anyone tried to insert multiple records into an Oracle table from Java? I have my data in a Java collection.Can I send a Java Collection to an Oracle Package as a PL/SQL Table Type? My problem is I dont want to instantiate a CallableStatement object everytime I do an insert. Instead I want to do that only once and then insert multiple records in one operation.
Any suggestions will be appreciated,
Thanks,
AlexHi Mensa,
I went thru the code example in your book in chapter 8 (downloaded it from OTN). It looks like the java code for "public class myPLSQLIndexTab" might be a java stored procedure stored in the oracle database?
Pardon my ignorance because I've never worked on java code in the oracle database itself but how would I call such a program outside the oracle database? For example say I have a batch job that downloads data from a webservice and that batch job is written in java and its sitting on a batch server somewhere on the network. But the java program that inserts data into the database is sitting in the oracle database (also somewhere in the same network). How can the java code sitting on the batch server talk to the java code sitting on the oracle server? Is it the same as calling a pl/sql package using CallableStatement?
Thanks
Alex -
How to concatenate multiple records into one
Hi everybody:
I want to know if exist some way to concat multiple records into one without using cursors. For example, I have a table named "Authors" like this:
Lan|Author
English|Ernest Hemingway
Spanish|Octavio Paz
Spanish|Mario Vargas Llosa
English|Sinclair Lewis
Spanish|Gabriel García Márquez
And I want to get this:
Author
Octavio Paz, Mario Vargas Llosa, Gabriel García Márquez
I have worked with SQL Server and I can do something like this:
CREATE FUNCTION dbo.MyConcat (@lan varchar(10))
RETURNS varchar(5000) AS
BEGIN
declare @retvalue varchar(5000)
set @retvalue=''
select @retvalue = @retvalue + Author +',' from Authors where lan = @lan
return substring(@retvalue,1,len(@retvalue)-1)
END
ie, do not use cursors to concatenate records. However, with ORACLE, I have to do someting like this.
FUNCTION MyConcat(P_Lan IN VARCHAR2) RETURN VARCHAR2 IS
v_ret VARCHAR2(4000);
v_element VARCHAR2(4000);
v_cursor sys_refcursor;
BEGIN
OPEN v_cursor FOR SELECT Author FROM Authors where Lan = P_Lan
LOOP
FETCH v_cursor INTO v_elemento;
EXIT WHEN v_cursor%NOTFOUND;
IF v_ret IS NULL THEN
v_ret := v_element;
ELSE
v_ret := v_ret || ', ' || v_element;
END IF;
END LOOP;
RETURN v_ret;
END;
Exist some other way to do this?
Best Regards
JackTks both for answer... I forgot to mention that I am using Oracle 10g. I read about LISTAGG() but this function is available for Oracle 11g release 2.
I wil read about the other techniques than Hoek mention
Best Regards.
Jack -
Insert multiple records into a table(Oracle 9i) from a single PHP statement
How can I insert multiple records into a table(Oracle 9i) from a single PHP statement?
From what all I've found, the statement below would work if I were using MySQL:
insert into scen
(indx,share,expire,pitch,curve,surface,call)
values
(81202, 28, 171, .27, 0, 0, 'C' ),
(81204, 28, 501, .25, 0, 0, 'C' ),
(81203, 17, 35, .222, 0, 0, 'C' ),
(81202, 28, 171, .27, 2, 0, 'C' ),
(81204, 28, 501, .20, 0, 1, 'C' ),
(81203, 28, 135, .22, 1, 0, 'C' )
The amount of records varies into the multiple-dozens. My aim is to utilize the power of Oracle while avoiding the i/o of dozens of single-record inserts.
Thank you,
WillYou could look at the INSERT ALL statement found in the documentation here:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_913a.htm#2133161
My personal opinion is that you probably won't see any benefit because under the hood I think Oracle will still be doing single row inserts. I could be wrong though.
The only way to confirm was if you did a test of multiple inserts vs an INSERT ALL, that is if the INSERT ALL met your requirements.
HTH. -
Concatenate multiple records into one single record
Hello everyone,
Can anyone guide me how to merge multiple records into one single record
like......... I am getting the data in the file like
aaaaa/bbbbbbb/ccccccccccc/dddddddddddd/eee
ffffff/gggg/hhhhhhhhhhhhhh
/123/4567/55555/99999999/kaoabfa/eee
fffff/kkkkkkkk/llllllllllllllllllllllll
when i use gui_upload I am getting the data into the internal table in the above format.
My main intension is to split the record at / to multiple lines and dowload it into another file.
What i am planning to do is... if the line does not start with / then i want to concatenate the multiple lines into single line and then split it into multiple records. Can anyone guide me how to achieve this.Yes, it should work.
In my example
Loop at itab.
concatenate i_text itab into i_text.
endloop.
You change that loop for the loop of your internal table with the file records
So if you have this three records
'aaaa/bbb/ccc'
'/dddd/efg'
'hijk/lmn'
i_text will look like this at the end
'aaaa/bbb/ccc/dddd/efghijk/lmn'
then in this part of the code
split i_text at '/' into table itab2.
itab2 will have the records looking like this
aaaa
bbb
ccc
dddd
efghijk
lmn' -
Insert Multiple Records into Multiple ZTABLEs inside the BAPI
Hi,
I have a requirement to Insert or Update Multiple Records into a ZTABLE inside the BAPI. Is there any special approach inside the BAPI to insert or update ZTABLEs with multiple records. It looks like the simple INSERT Statement is not working. Can you please suggest me a Suitable solution for this req?
Thanks and Regards,
KannanHi,
INSERT ZTABLE FROM TABLE ITAB.
The itab structure should be of the structure ZTABLE..
Same for MODIFY and update.
MODIFY ZTABLE FROM TABLE ITAB..
Thanks,
Naren -
Splitting of a CSV File with Multiple Records into Multiple XML File
Dear All,
<b> I am doing a Scenario of CSV to XML Files. I am using BPM for the same. My incoming CSV File has got multiple records. I want to break this Multiple records into Multiple XML Files having one record each.</b>
Can someone suggest how can I break this rather Split this into Multiple XML Files.
Is Multimapping absoltely necesaary for this. Can't we do this without Multimapping. Can we have some workaround in the FCC parameters that we use in the Integration Directory.
Kindly reply ASAP. Thanks a lot to all in anticipation.
Pls Help.
Best Regards
Chakra and SomnathDear All,
I am trying to do the Multimapping, and have 0....unbounded also. Someways it is not working.
<b>
Smitha please tell me one thing...Assigning the Recordsets per Message to 1, does it mean that it will write multiple XML Files as I want.</b>
Also I am usinf Set to Read only. So once the File is read it becomes RA from A. Then will it write the other Records.
I have to use a BPM because there are certain dependencies that are there for the entire Process Flow. I cannot do without a BPM.
Awaiting a reply. Thanks a lot in anticipation.
Best Regards
Chakra and Somnath
Maybe you are looking for
-
Siebel Sales Rep Visibility in BI Publisher, Bug???
Hi, I have run into an issue with a bi publisher report in Siebel 8.1.1.0 and BI Publisher 10.1.3.4.0 where there is a Siebel View with a Visibliity Applet Type = Sales Rep. The data showing in the report on this view is not filtered according to "Sa
-
Workflow not working for users across domains
Hi, The workflow that i have created works perfectly for me, but they work intermittently for my colleague who sits in another country and hence domain. They sometimes work for him, when he creates a new item but they don't work most of the time and
-
White border in cell when adding background colour.
In Numbers for Mac. When I add a background color there is a white border inside the cell. How do I have the entire cell filled with the colour? I go through, the 'format'menu, 'text','layout', 'border' and 'background colour'.
-
Hello All, Does anyone know of a way of using windows authentication (via Active Directory) to automate the login prompt in the BeX Excel Analyzer? I have found a solution for the BI portal via SPNego, but have not been able to find any discussion o
-
Organizar carpetas en marcadores Android
Quisiera poder organizar los marcadores de mi dispositivo movil Android, ya que pasado el tiempo tengo gran cantidad de ellos y quisiera discriminarlos utilizando distintas carpetas. Desconozco si se puede hacer, pero no lo he conseguido y tampoco he