| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
|  |  | |||
Home -> Community -> Usenet -> c.d.o.misc -> Re: What is wrong?
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;
Is your sql_statement character array large enough?  Double
its size and see if it works.  Segmentation faults usually
mean you are clobbering memory somewhere.  The biggest culprit
in that is overflowing arrays.
|  |  |