Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: What is wrong?

Re: What is wrong?

From: Ken Denny <kendenny_at_bnr.ca>
Date: 1997/09/25
Message-ID: <342AA243.55EB@bnr.ca>#1/1

I see you are using struct_ptr->field construct as host variables. I think the only way you can use a struct as a host variable in Pro*C is to define a struct having the same number and types of fields as are defined in the select list of a cursor, then fetch the cursor into the struct variable. AFIK that's the only context in which SQL understands struct variables.

Hope this helps
Ken Denny
kendenny_at_bnr.ca (work)
kdenny_at_interpath.com (home)

Jean Xu wrote:
>
> When I use proc to compile the following Embedded SQL statements, I have
> this error:Segmentation Fault (core dumped). I do not know what is wrong
> because all the other similar statements can pass the compilation. Can
> someone give me any suggestion about that?
>
> strcpy(sql_statement," ");
> strcpy(sql_statement,"UPDATE ");
> strcat(sql_statement,file_tname);
> strcat(sql_statement," SET gap_flag = :file_rec->gap_flag, attr
> = :file_rec->attr, loc = :file_rec->loc, file_len =
> :file_rec->file_len, dtc = :file_rec->dtc, dta =
> :file_rec->dta, ref_count = :file_rec->ref_count, aux_loc =
> :file_rec->aux_loc, aux_file_len = :file_rec->aux_file_len,
> perms_owner_person = :file_rec->perms.owner.person,
> perms_owner_group = :file_rec->perms.owner.group, perms_owner_org =
> :file_rec->perms.owner.org, perms_mode_person =
> :file_rec->perms.mode.person, perms_mode_group =
> :file_rec->perms.mode.group, perms_mode_org =
> :file_rec->perms.mode.org, perms_mode_worl =
> :file_rec->perms.mode.world, comment_path = :file_rec->comment WHERE
 file_name = :file_rec->file_name AND volume_name =
> :file_rec->volume_name");
>
>
> EXEC SQL PREPARE S9 FROM :sql_statement;
>
> EXEC SQL EXECUTE S9 USING :file_rec->gap_flag,:file_rec->attr,
> :file_rec->loc,:file_rec->file_len, :file_rec->dtc,
> :file_rec->dta,:file_rec->ref_count,:file_rec->aux_loc,:file_rec->aux_file_len,
> :file_rec->perms.owner.person,:file_rec->perms.owner.group,
> :file_rec->perms.owner.org,:file_rec->perms.mode.person,:file_rec->perms.mode.group,
> :file_rec->perms.mode.org, :file_rec->perms.mode.world,
> :file_rec->comment,:file_rec->file_name,:file_rec->volume_name;
> EXEC SQL COMMIT RELEASE;
  Received on Thu Sep 25 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US