cursor implement [message #596475] |
Mon, 23 September 2013 12:30 |
|
Mary1234
Messages: 4 Registered: March 2012 Location: India
|
Junior Member |
|
|
Hi Please help me how to write below query in pl/sql cursor.
The help table has two associated tables, help_txt and help_id, which will have strings of data concatenated into one sales contact record. There are multiple lines of text per comment and multiple lines of resolution text at 40 characters per line. The key to the help_text table (id, date,seqno) is the main key to the help_txt table and help_id t table with a sequence added to each table
The formatted string will contain some text and variables with the comment lines (1-10 or more) concatenated first, followed by the resolution lines (1-10 or more). There will be multiple comment and multiple resolution lines. The Cust_Cmnt_Txt lines and the Resolved_Desc lines should be concatenated and formatted in the following string (% marks the variable string) :
'help taken ' %help.Taken_Dte 'received from the following source: ' %help.id. 'Remark Text: ' %help_text (where help_txt_Seq = 1) %help_text (where help_text_seq = 2-10 or more) 'Resolution: ' %help_id_Res_Txt.Resolved_Desc (where help_ID_Txt_Seq = 1) %help_ID_Res_Txt.Resolved_Desc (where help_id_Txt_Seq = 2-10 or more)
|
|
|
|
Re: cursor implement [message #596479 is a reply to message #596476] |
Mon, 23 September 2013 12:44 |
|
Mary1234
Messages: 4 Registered: March 2012 Location: India
|
Junior Member |
|
|
create table help (id number(10),date date,seq number(4),desc varcha2(100))
create table help_text (id number(10),date date,seq number(4),varchar2(100))
create table help_id (id number(10),date date,seq number(4),varchar2(100))
|
|
|
|
Re: cursor implement [message #596483 is a reply to message #596479] |
Mon, 23 September 2013 12:50 |
John Watson
Messages: 8930 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Mary, I'm feeling generous, so I'll take you through all the errors in just one of your CREATE TABLE statements. You really should test your code before posting it. Here you go:orclz>
orclz> create table help (id number(10),date date,seq number(4),desc varcha2(100))
2 /
create table help (id number(10),date date,seq number(4),desc varcha2(100))
*
ERROR at line 1:
ORA-00904: : invalid identifier
orclz> create table help (id number(10),datecol date,seq number(4),desc varcha2(100))
2 /
create table help (id number(10),datecol date,seq number(4),desc varcha2(100))
*
ERROR at line 1:
ORA-00904: : invalid identifier
orclz> create table help (id number(10),datecol date,seq number(4),description varcha2(100))
2 /
create table help (id number(10),datecol date,seq number(4),description varcha2(100))
*
ERROR at line 1:
ORA-00907: missing right parenthesis
orclz> create table help (id number(10),datecol date,seq number(4),description varchar2(100))
2 /
Table created.
orclz>
|
|
|
Re: cursor implement [message #596484 is a reply to message #596480] |
Mon, 23 September 2013 12:51 |
|
BlackSwan
Messages: 26766 Registered: January 2009 Location: SoCal
|
Senior Member |
|
|
Somebody needs a refresher course in normalizing data to Third Normal Form.
It makes no sense to have multiple tables with identical columns.
Posted SQL contains syntax error.
KEYWORD like "DATE" should never be used as column_name.
[Updated on: Mon, 23 September 2013 12:51] Report message to a moderator
|
|
|
|
|
|