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: Bola Ogunlana <bolao_at_incads.demon.co.uk>
Date: 1997/09/11
Message-ID: <9Epo+JA3rDG0EwOV@incads.demon.co.uk>#1/1

When I've had problems like this in the past, its been because the string containing the SQL statement was not correctly terminated &/or wasn't defined within an SQL DECLARE section.

Define a varchar variable within the SQL declare section of your procedure/function & having built the SQL statement copy the string to the varchar variable, the method to use involves setting both the text & length portions of the VARCHAR (see the PRO*C manuals). Don't forget to set the length bit of the Varchar. Use the varchar variable in the "EXEC SQL PREPARE .." statement.  

In article <34171F31.3F85_at_platinum.com>, Jean Xu <xu_at_platinum.com> writes
>
>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;
 

-- 
Bola Ogunlana
Received on Thu Sep 11 1997 - 00:00:00 CDT

Original text of this message

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