Home » SQL & PL/SQL » SQL & PL/SQL » types
types [message #355077] Wed, 22 October 2008 08:33 Go to next message
rags11
Messages: 21
Registered: October 2008
Junior Member
Hi,
I have a type "A"created with 10 fields.
i want to initialize the type when i pass 2 filed values to it.
For eg,
pr_proc(test_type A)
begin
IF (A.exists(test_type.fieldvalue1) and (A.exists(test_type.fieldvalue2) then
"retreive A value and assign to test_type variable"
test_type = A.pid and A.name
(since here pid and name are not the key value iam unable to assign the value.

if i pass only one fieldvalue which is primary key,then this could be acheived using:

pr_proc(test_type A)
begin
IF (A.exists(test_type.fieldvalue1) then
"retreive A value and assign to test_type variable"
test_type = A.fieldvalue1;

let me know hw to achive this

Thanks for the help.
Re: types [message #355144 is a reply to message #355077] Wed, 22 October 2008 20:53 Go to previous messageGo to next message
rags11
Messages: 21
Registered: October 2008
Junior Member
Hi,
can anyone help on this issue.let me know if you didnot understand the issue.

Thanks.
Re: types [message #355149 is a reply to message #355077] Wed, 22 October 2008 22:15 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member

Yes. I couldn't understand .

Could you please explain with example you tried instead of pseudo code. Also the error you got if any .

Smile
Rajuvan.
Re: types [message #355158 is a reply to message #355149] Wed, 22 October 2008 23:12 Go to previous messageGo to next message
rags11
Messages: 21
Registered: October 2008
Junior Member
--simple case here id is primary key for type "A"
pr_proc(test_type A)
begin
IF (A.exists(test_type.id) then
"retreive A value and assign to test_type variable"
test_type = A.id;

--complex case iam not getting id,instead iam getting diffrent 2 columns.

pr_proc(test_type A)
begin
IF (A.exists(test_type.col1)and (A.exists(test_type.col2) then
"retreive A value and assign to test_type variable"
test_type = A.??;//(?HOW CAN WE ASSIGN THE RETREIVED RECORD NOW?)
Re: types [message #355162 is a reply to message #355158] Wed, 22 October 2008 23:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I didn't understand the question yesterday and I still don't today.
As Jo said, remove the pseudo-code and explain your point with words and only words.

If you have some code that works, post it then we can see what you are trying to do.

Before posting any code, please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel
Re: types [message #355164 is a reply to message #355077] Wed, 22 October 2008 23:26 Go to previous messageGo to next message
rajavu1
Messages: 1574
Registered: May 2005
Location: Bangalore , India
Senior Member


Quote:
As Jo said, remove the pseudo-code and explain your point with words and only words.$


It is not Jo . It is Me Cool

Smile
Rajuvan.
Re: types [message #355176 is a reply to message #355164] Thu, 23 October 2008 00:36 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Sorry, reading a dozen of topics at same time. Wink

Regards
Michel
Re: types [message #355277 is a reply to message #355176] Thu, 23 October 2008 05:53 Go to previous messageGo to next message
rags11
Messages: 21
Registered: October 2008
Junior Member
OK.
I have a type "sample" created
type sample is
record
(id tablea.id%type
,name tablea.name%type
,value tablea.value%type
,x tablea.value%type
,y tablea.value%type)

i have a proc which will get name and value as parmeters
and have to get the records from tablea and store it in type sample.
tablea primarykey is id

pr_proc(test_type A)
begin
IF (A.exists(test_type.id) then
"retreive A value and assign to test_type variable"
test_type = A.id;

--complex case iam not getting id,instead iam getting diffrent 2 columns.

pr_proc(test_type A)
begin
IF (A.exists(test_type.col1)and (A.exists(test_type.col2) then
"retreive A value and assign to test_type variable"
test_type = A.??;//(?HOW CAN WE ASSIGN THE RETREIVED RECORD NOW?)

Hope it undetstands now:)
sorry for the confusion
Re: types [message #355281 is a reply to message #355277] Thu, 23 October 2008 06:01 Go to previous messageGo to next message
Michel Cadot
Messages: 64130
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
It is not, you just repeated the same thing.
You post a type but it is nowhere after.
There is:
"pr_proc(test_type A) "
What is "test_type"? What is "A"?

What does "IF (A.exists(test_type.id) THEN" want to mean?

REMOVE ALL PSEUDO CODE AND SAY IT WITH WORDS.

Isn't this clear?

Regards
Michel
Re: types [message #355308 is a reply to message #355176] Thu, 23 October 2008 06:50 Go to previous message
rags11
Messages: 21
Registered: October 2008
Junior Member
type sample is
record
(id tablea.id%type
,name tablea.name%type
,value tablea.value%type
,x tablea.value%type
,y tablea.value%type)

i have a proc which will get name and value as parmeters
and have to get the records from tablea and store it in type sample.
tablea primarykey is id

now i pass name and value to a proc and want to store the record in type sample.
my question is how we can assign the record to the type as we normally do
create a variable test_type of type sample.
test_type sample;
and
TYPE t_cach IS TABLE OF sample
INDEX BY tablea.id%TYPE;

test_type = t_cach(test_type.id);

the above is possible since i pass id ,if i pass name and value how can i achieve the above statement.

sorry for the confusion:)

Thank you.



Previous Topic: Built in Package for encryption and decryption process.
Next Topic: SQL query
Goto Forum:
  


Current Time: Wed Dec 07 08:24:53 CST 2016

Total time taken to generate the page: 0.07332 seconds